Samples demonstrating the stdio transport model. The SDK spawns copilot as a child process and communicates over standard input/output using Content-Length-framed JSON-RPC 2.0 messages.
┌─────────────┐ stdin/stdout (JSON-RPC) ┌──────────────┐
│ Your App │ ──────────────────────────▶ │ Copilot CLI │
│ (SDK) │ ◀────────────────────────── │ (child proc) │
└─────────────┘ └──────────────┘
Each sample follows the same flow:
- Create a client that spawns
copilotautomatically - Open a session targeting the
gpt-4.1model - Send a prompt ("What is the capital of France?")
- Print the response and clean up
| Directory | SDK / Approach | Language |
|---|---|---|
typescript/ |
@github/copilot-sdk |
TypeScript (Node.js) |
python/ |
github-copilot-sdk |
Python |
go/ |
github.com/github/copilot-sdk/go |
Go |
- Copilot CLI — set
COPILOT_CLI_PATH - Authentication — set
GITHUB_TOKEN, or rungh auth login - Node.js 20+ (TypeScript sample)
- Python 3.10+ (Python sample)
- Go 1.24+ (Go sample)
TypeScript
cd typescript
npm install && npm run build && npm startPython
cd python
pip install -r requirements.txt
python main.pyGo
cd go
go run main.go./verify.shRuns in two phases:
- Build — installs dependencies and compiles each sample
- E2E Run — executes each sample with a 60-second timeout and verifies it produces output