Project Setup
This guide walks you through setting up a local development environment for AgentSchema.
Prerequisites
Section titled “Prerequisites”You’ll need the following tools installed:
| Tool | Purpose | Installation |
|---|---|---|
| Node.js (v18+) | TypeSpec compiler & emitter | nodejs.org |
| .NET SDK (9.0+) | C# runtime development | dotnet.microsoft.com |
| Python (3.11+) | Python runtime development | python.org |
| uv | Python package manager | pip install uv or docs.astral.sh |
| Go (1.21+) | Go runtime development | go.dev |
Clone & Install
Section titled “Clone & Install”-
Clone the repository
Terminal window git clone https://github.com/microsoft/AgentSchema.gitcd AgentSchema -
Install emitter dependencies
Terminal window cd agentschema-emitternpm install -
Install schema compiler dependencies
Terminal window cd ../agentschemanpm install -
Set up Python environment
Terminal window cd ../runtime/python/agentschemauv venvuv sync --all-extras -
Install TypeScript test dependencies
Terminal window cd ../../typescript/agentschemanpm install
Project Structure
Section titled “Project Structure”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
- …
Verify Installation
Section titled “Verify Installation”Run the full build to verify everything works:
# Build the emittercd agentschema-emitternpx tsccp -r src/templates dist/src/
# Generate all codecd ../agentschemanpm run generate
# Run all testscd ../runtime/csharp && dotnet testcd ../python/agentschema && uv run pytest tests/cd ../../typescript/agentschema && npm testcd ../../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
VS Code Setup
Section titled “VS Code Setup”We recommend VS Code with these extensions:
- TypeSpec for VS Code - Syntax highlighting for
.tspfiles - Python - Python language support
- C# Dev Kit - C# development
- Nunjucks - Template syntax highlighting
The repository includes .vscode/settings.json with recommended settings.
Next Steps
Section titled “Next Steps”- TypeSpec Guide - Learn to edit schema definitions
- Emitter Guide - Learn to modify code generation