A ready-to-use template for building agentic applications with the GitHub Copilot SDK and Python.
- ✅ Pre-configured Python setup
- ✅ Example custom tools (calculator, time)
- ✅ Interactive CLI interface
- ✅ Streaming responses
- ✅ Environment variable support
- ✅ Type hints and documentation
-
Create and activate virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Create environment file:
cp ../../.env.example .env
-
Run the application:
python src/main.py
-
Create and activate virtual environment:
uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies:
uv pip install -r requirements.txt
-
Create environment file:
cp ../../.env.example .env
-
Run the application:
python src/main.py
.
├── src/
│ ├── __init__.py # Package marker
│ └── main.py # Main application with example tools
├── requirements.txt # Python dependencies
└── .env # Environment variables (create from .env.example)
Edit src/main.py and add your tool using the @define_tool decorator:
@define_tool(description="Description of what your tool does")
async def my_tool(params: dict) -> dict:
"""
Your tool documentation
Args:
params: Dictionary with your parameters
"""
# Your tool logic here
return {"result": "success"}
# Add to session:
session = await client.create_session({
"tools": [my_tool, get_time, calculator],
})Set the model in .env:
COPILOT_MODEL=gpt-4.1Or modify directly in code:
session = await client.create_session({
"model": "gpt-4.1",
})pip install -r requirements.txt
pip install pytest black ruff mypy # Optional dev toolsblack src/ruff check src/mypy src/- Read the Getting Started Guide
- Explore Cookbook Examples
- Learn about MCP Servers
Issue: copilot: command not found
Solution: Install GitHub Copilot CLI:
gh extension install github/gh-copilotIssue: Import errors
Solution: Ensure virtual environment is activated:
source venv/bin/activate # or .venv/bin/activate
pip install -r requirements.txtIssue: Module not found
Solution: Install in development mode:
pip install -e .