This guide walks you through setting up your development environment to build agentic applications using the GitHub Copilot SDK.
To develop agentic apps with the Copilot SDK, you'll need:
- GitHub Copilot CLI - The core agent runtime
- SDK for your preferred language - Python, TypeScript, Go, or .NET
- Development tools - IDE, package managers, and runtime environments
- GitHub Account with Copilot access
- GitHub CLI (
gh) installed and authenticated - Git installed
Pick one or more SDKs to work with:
- Node.js 18+ (Download)
- npm or yarn
- Go 1.21+ (Download)
- .NET 8.0+ (Download)
If not already installed:
macOS:
brew install ghLinux:
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install ghWindows:
winget install --id GitHub.cligh extension install github/gh-copilotVerify installation:
copilot --versiongh auth loginFollow the prompts to authenticate with GitHub.
Create a new project:
mkdir my-agentic-app && cd my-agentic-app
npm init -y
npm install @github/copilot-sdk tsxCreate a virtual environment (recommended):
mkdir my-agentic-app && cd my-agentic-app
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install github-copilot-sdkOr with uv (faster):
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install github-copilot-sdkmkdir my-agentic-app && cd my-agentic-app
go mod init my-agentic-app
go get github.com/github/copilot-sdk/godotnet new console -n MyAgenticApp
cd MyAgenticApp
dotnet add package GitHub.Copilot.SDK-
Install Visual Studio Code
-
Install recommended extensions:
- GitHub Copilot
- GitHub Copilot Chat
- Language-specific extensions:
- TypeScript: ESLint, Prettier
- Python: Python, Pylance
- Go: Go
- .NET: C# Dev Kit
-
Open your project:
code .Create a .env file in your project root for configuration:
# GitHub Copilot Configuration
COPILOT_MODEL=gpt-4.1
COPILOT_STREAMING=true
# Optional: Custom CLI path
COPILOT_CLI_PATH=/path/to/copilot
# Optional: Logging
LOG_LEVEL=infoNote: Never commit .env files with sensitive data. Add .env to your .gitignore.
Recommended structure for agentic apps:
my-agentic-app/
├── .env.example # Template for environment variables
├── .gitignore # Ignore node_modules, venv, etc.
├── README.md # Project documentation
├── src/ # Source code
│ ├── agents/ # Custom agent definitions
│ ├── tools/ # Custom tool implementations
│ └── main.[ts|py|go|cs] # Entry point
└── tests/ # Test files
copilot "what is 2+2?"You should see a response from Copilot.
Create a simple test file to verify the SDK works:
TypeScript (test.ts):
import { CopilotClient } from "@github/copilot-sdk";
const client = new CopilotClient();
const session = await client.createSession({ model: "gpt-4.1" });
const response = await session.sendAndWait({ prompt: "Say hello!" });
if (response?.data.content) {
console.log(response.data.content);
} else {
console.log("No response received");
}
await client.stop();Run:
npx tsx test.tsPython (test.py):
import asyncio
from copilot import CopilotClient
async def main():
client = CopilotClient()
await client.start()
session = await client.create_session({"model": "gpt-4.1"})
response = await session.send_and_wait({"prompt": "Say hello!"})
print(response.data.content)
await client.stop()
asyncio.run(main())Run:
python test.pyNote: For comprehensive troubleshooting, see the Troubleshooting Guide.
Solution: Ensure GitHub CLI and Copilot extension are installed:
gh extension install github/gh-copilotAdd to your PATH if needed (Linux/macOS):
export PATH="$PATH:$HOME/.local/bin"Solution: Re-authenticate:
gh auth login
gh auth refresh -s copilotNode.js: Ensure dependencies are installed:
npm installPython: Activate virtual environment:
source venv/bin/activate # or .venv/bin/activate
pip install github-copilot-sdkThe SDK starts the Copilot CLI in server mode. If you see port conflicts:
Solution: The SDK handles this automatically, but if issues persist, kill existing processes:
pkill -f copilotSolution: Install in development mode:
pip install -e .For more issues and solutions, see the Troubleshooting Guide.
const client = new CopilotClient({
cliPath: "/path/to/specific/copilot",
});Control which tools are available to agents:
const session = await client.createSession({
tools: [myCustomTool],
allowAll: false, // Disable default tools
});const client = new CopilotClient({
serverUrl: "http://localhost:8080",
});Now that your environment is set up:
- Read the Getting Started Guide: docs/getting-started.md
- Explore Cookbook Examples: cookbook/
- Build Your First Agent: Start with a simple custom tool
- Join the Community: Check GitHub Discussions
- GitHub Copilot CLI Documentation
- SDK API Reference
- MCP Servers - Pre-built tool servers
- Contributing Guide
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Main README