Quick commands and references for setting up and using the GitHub Copilot SDK.
# Check if prerequisites are installed
gh --version # GitHub CLI
copilot --version # Copilot CLI
node -v # Node.js (optional)
python3 --version # Python (optional)
go version # Go (optional)
dotnet --version # .NET (optional)# macOS
brew install gh
# Linux (Debian/Ubuntu)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/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 gh
# Windows (PowerShell)
winget install --id GitHub.cligh extension install github/gh-copilot# Node.js - visit https://nodejs.org/
# macOS: brew install node
# Python - visit https://python.org/
# macOS: brew install python
# Go - visit https://go.dev/
# macOS: brew install go
# .NET - visit https://dotnet.microsoft.com/
# macOS: brew install --cask dotnet-sdk# Run automated setup (Linux/macOS)
bash scripts/setup-dev-env.sh
# Run automated setup (Windows PowerShell)
.\scripts\setup-dev-env.ps1
# Validate your environment
bash scripts/validate-env.sh# Create from template
cp -r templates/typescript-quickstart my-app
cd my-app
# Setup
npm install
cp ../../templates/.env.example .env
# Run
npm start# Create from template
cp -r templates/python-quickstart my-app
cd my-app
# Setup
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp ../../templates/.env.example .env
# Run
python src/main.pymkdir my-app && cd my-app
go mod init my-app
go get github.com/github/copilot-sdk/godotnet new console -n MyApp
cd MyApp
dotnet add package GitHub.Copilot.SDK
dotnet run# Node.js/TypeScript
npm install @github/copilot-sdk tsx
# Python
pip install github-copilot-sdk
# Python with uv (faster)
uv pip install github-copilot-sdk
# Go
go get github.com/github/copilot-sdk/go
# .NET
dotnet add package GitHub.Copilot.SDK# Login to GitHub
gh auth login
# Refresh Copilot token
gh auth refresh -s copilot
# Check auth status
gh auth statusCreate .env file:
COPILOT_MODEL=gpt-4.1
COPILOT_STREAMING=true
LOG_LEVEL=infocopilot "what is 2+2?"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: "Hello!" });
if (response?.data.content) {
console.log(response.data.content);
}
await client.stop();npx tsx test.tsimport 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": "Hello!"})
print(response.data.content)
await client.stop()
asyncio.run(main())python test.pygh extension install github/gh-copilot
# Add to PATH if needed
export PATH="$PATH:$HOME/.local/bin"gh auth login
gh auth refresh -s copilot# The SDK handles this automatically
# If issues persist, find and kill processes
ps aux | grep copilot
kill <PID>npm installsource venv/bin/activate # or .venv/bin/activate
pip install -r requirements.txtCheck available models:
copilot modelsCommon models:
gpt-4.1- Latest GPT-4 (recommended)gpt-4o- GPT-4 Optimizedclaude-3.5-sonnet- Claude 3.5 Sonnet
my-agentic-app/
├── .env # Environment variables
├── .gitignore # Git ignore rules
├── src/ # Source code
│ ├── agents/ # Custom agent definitions
│ ├── tools/ # Custom tool implementations
│ └── main.[ts|py] # Entry point
└── tests/ # Test files
- Environment Setup Guide
- Getting Started Guide
- Project Templates
- Cookbook Examples
- GitHub Copilot Docs
- Issues: https://github.com/github/copilot-sdk/issues
- Discussions: https://github.com/github/copilot-sdk/discussions
- Documentation: Main README.md
| Script | Purpose | Usage |
|---|---|---|
scripts/setup-dev-env.sh |
Automated setup (Linux/macOS) | bash scripts/setup-dev-env.sh |
scripts/setup-dev-env.ps1 |
Automated setup (Windows) | .\scripts\setup-dev-env.ps1 |
scripts/validate-env.sh |
Validate installation | bash scripts/validate-env.sh |
| Template | Language | Features |
|---|---|---|
typescript-quickstart |
TypeScript | Interactive CLI, Custom tools, Hot reload |
python-quickstart |
Python | Interactive CLI, Custom tools, Async/await |
- ✅ Validate environment:
bash scripts/validate-env.sh - ✅ Choose a template:
cd templates/typescript-quickstart - ✅ Install dependencies:
npm installorpip install -r requirements.txt - ✅ Create
.env:cp ../../templates/.env.example .env - ✅ Run:
npm startorpython src/main.py - ✅ Customize tools and build your app!