npx skills add ...
npx skills add github/awesome-copilot --skill copilot-sdk
Build agentic applications with GitHub Copilot SDK. Use when embedding AI agents in apps, creating custom tools, implementing streaming responses, managing sessions, connecting to MCP servers, or creating custom agents. Triggers on Copilot SDK, GitHub SDK, agentic app, embed Copilot, programmable agent, MCP server, custom agent.
npx skills add github/awesome-copilot --skill copilot-sdk
Embed Copilot's agentic workflows in any application using Python, TypeScript, Go, or .NET.
The GitHub Copilot SDK exposes the same engine behind Copilot CLI: a production-tested agent runtime you can invoke programmatically. No need to build your own orchestration - you define agent behavior, Copilot handles planning, tool invocation, file edits, and more.
The TypeScript, Python, and .NET packages use a bundled Copilot runtime by default, so they do not need a separate CLI installation.
Published Python wheels include a pinned runtime version. The pre-download command caches that runtime locally; if skipped, the SDK attempts to download it automatically on first use.
Run: npx tsx index.ts
Run: dotnet run
Enable real-time output for better UX:
Define tools that Copilot can invoke during reasoning. When you define a tool, you tell Copilot:
When Copilot decides to call your tool:
Copilot decides when to call your tool based on the user's question and your tool's description.
Build a complete interactive assistant:
Connect to MCP (Model Context Protocol) servers for pre-built tools. Connect to GitHub's MCP server for repository, issue, and PR access:
Define specialized AI personas for specific tasks:
Customize the AI's behavior and personality:
Run the CLI in server mode separately and connect the SDK to it. Useful for debugging, resource sharing, or custom environments.
Note: When configured to use an external server, the SDK manages only its connection and does not manage the external process.
| Event | Description |
|---|---|
user.message | User input added |
assistant.message | Complete model response |
assistant.message_delta | Streaming response chunk |
assistant.reasoning | Model reasoning (model-dependent) |
assistant.reasoning_delta | Streaming reasoning chunk |
tool.execution_start | Tool invocation started |
tool.execution_complete | Tool execution finished |
session.idle | No active processing |
session.error | Error occurred |
| Option | Description | Default |
|---|---|---|
cliPath | Path to Copilot CLI executable | System PATH |
cliUrl | Connect to existing server (e.g., "localhost:4321") | None |
port | Server communication port | Random |
useStdio | Use stdio transport instead of TCP | true |
logLevel | Logging verbosity | "info" |
autoStart | Launch server automatically | true |
autoRestart | Restart on crashes | true |
cwd | Working directory for CLI process | Inherited |
| Option | Description |
|---|---|
model | LLM to use ("gpt-4.1", "claude-sonnet-4.5", etc.) |
sessionId | Custom session identifier |
tools | Custom tool definitions |
mcpServers | MCP server connections |
customAgents | Custom agent personas |
systemMessage | Override default system prompt |
streaming | Enable incremental response chunks |
availableTools | Whitelist of permitted tools |
excludedTools | Blacklist of disabled tools |
Save and resume conversations across restarts:
Query available models at runtime:
sendAndWait with timeout for long operationsThe SDK manages the CLI process lifecycle automatically. All communication happens via JSON-RPC over stdio or TCP.
This SDK is in Technical Preview and may have breaking changes. Not recommended for production use yet.