Skip to content

Project Setup

This guide walks you through setting up a local development environment for AgentSchema.

You’ll need the following tools installed:

ToolPurposeInstallation
Node.js (v18+)TypeSpec compiler & emitternodejs.org
.NET SDK (9.0+)C# runtime developmentdotnet.microsoft.com
Python (3.11+)Python runtime developmentpython.org
uvPython package managerpip install uv or docs.astral.sh
Go (1.21+)Go runtime developmentgo.dev
  1. Clone the repository

    Terminal window
    git clone https://github.com/microsoft/AgentSchema.git
    cd AgentSchema
  2. Install emitter dependencies

    Terminal window
    cd agentschema-emitter
    npm install
  3. Install schema compiler dependencies

    Terminal window
    cd ../agentschema
    npm install
  4. Set up Python environment

    Terminal window
    cd ../runtime/python/agentschema
    uv venv
    uv sync --all-extras
  5. Install TypeScript test dependencies

    Terminal window
    cd ../../typescript/agentschema
    npm install
  • DirectoryAgentSchema/
    • Directoryagentschema/ TypeSpec source (schema definitions)
      • Directorymodel/ .tsp files - THE SOURCE OF TRUTH
        • main.tsp entry point
        • agent.tsp agent definitions
        • tools.tsp tool definitions
      • tspconfig.yaml compiler configuration
    • Directoryagentschema-emitter/ Code generator
      • Directorysrc/
        • emitter.ts main entry point
        • csharp.ts C# generator
        • python.ts Python generator
        • typescript.ts TypeScript generator
        • Directorytemplates/ Nunjucks templates
          • Directorycsharp/
          • Directorypython/
          • Directorytypescript/
          • Directorygo/
      • Directorydist/ compiled output
    • Directoryruntime/ Generated libraries (DO NOT EDIT)
      • Directorycsharp/
      • Directorypython/
      • Directorytypescript/
      • Directorygo/
    • Directoryschemas/ Generated JSON schemas (DO NOT EDIT)
    • Directorydocs/ Documentation site

Run the full build to verify everything works:

Terminal window
# Build the emitter
cd agentschema-emitter
npx tsc
cp -r src/templates dist/src/
# Generate all code
cd ../agentschema
npm run generate
# Run all tests
cd ../runtime/csharp && dotnet test
cd ../python/agentschema && uv run pytest tests/
cd ../../typescript/agentschema && npm test
cd ../../go/agentschema && go test ./...

All tests should pass. If you encounter issues, check:

  • Node.js version is 18+
  • .NET SDK is installed and in PATH
  • Python environment is activated

We recommend VS Code with these extensions:

  • TypeSpec for VS Code - Syntax highlighting for .tsp files
  • Python - Python language support
  • C# Dev Kit - C# development
  • Nunjucks - Template syntax highlighting

The repository includes .vscode/settings.json with recommended settings.