A step-by-step guide to building real applications with the GitHub Copilot SDK for Python.
New to the SDK? Start with the language-agnostic overview and concepts — what the GitHub Copilot SDK is and is not, plus common setup for installing the Copilot CLI and authenticating with GitHub. This page focuses on the Python edition.
Each tutorial pairs a documentation page with a self-contained CLI script that you can run directly:
| # | Tutorial | Script | What You Learn |
|---|---|---|---|
| 1 | CLI Chatbot | 01_chat_bot.py |
CopilotClient, sessions, single prompt, interactive loop |
| 2 | Issue Triage Bot | 02_issue_triage.py |
Custom tools with @define_tool, Pydantic I/O |
| 3 | Streaming Review | 03_streaming_review.py |
Streaming with ASSISTANT_MESSAGE_DELTA |
| 4 | Skills Doc Generation | 04_skills_docgen.py |
Agent Skills via SKILL.md files |
| 5 | Audit Log | 05_audit_hooks.py |
Session hooks, permission handling |
| 6 | BYOK Azure OpenAI | 06_byok_azure_openai.py |
Bring Your Own Key with Azure OpenAI |
All scripts live in
src/python/scripts/tutorials/.
Make sure the Copilot CLI is installed and authenticated first — see the common Getting Started guide. Then:
# 1. Install SDK and tutorial dependencies (uses src/python/pyproject.toml)
cd src/python
uv sync --all-groups
# 2. Run your first tutorial script (the SDK launches the CLI on demand)
uv run python scripts/tutorials/01_chat_bot.py --prompt "Hello, Copilot!"For Python-specific setup, see Getting Started (Python).
All Python tutorial scripts keep telemetry off by default. To export
OpenTelemetry traces, start the local collector stack and pass the shared
--otel-* options:
uv run python scripts/tutorials/01_chat_bot.py \
--otel-endpoint http://localhost:4318 \
--otel-bsp-schedule-delay 500 \
--prompt "Hello, Copilot!"The same settings can still come from the environment variables:
OTEL_EXPORTER_OTLP_ENDPOINT,
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT, and
OTEL_BSP_SCHEDULE_DELAY. See Observability with OpenTelemetry.
In scope:
- GitHub Copilot SDK concepts (what it is / is not)
- Architecture and operation principles
- Python SDK API design and interfaces
- Sample code and step-by-step guides for concrete use cases
- Agent Skills, Custom Tools, Session Hooks, Permission Handling, Streaming, BYOK
Out of scope:
- TypeScript / .NET SDK details (see References)
- Copilot CLI standalone usage guide
- Production scaling and infrastructure
- GitHub OAuth App authentication flow (see CopilotReportForge docs)
template_github_copilotpackage internals (tutorial scripts are self-contained)
| Document | Description |
|---|---|
| Overview | Language-agnostic concepts and language chooser |
| Architecture | How the SDK, CLI server, and Copilot API interact |
| Getting Started (Python) | Python-specific setup and first run |
| CLI Server Mode | Run the Copilot CLI as a standalone TCP server |
| References | API reference and external links |