GitHub Copilot SDK Released, Letting You Build Custom AI Agents in Python, TypeScript, Go, and .NET
Contents
GitHub Copilot has evolved from an in-editor autocomplete tool into a full agent platform. The latest step in that direction is the GitHub Copilot SDK, now available in technical preview.
What the Copilot SDK is
The Copilot SDK is a multi-platform library that exposes the Copilot CLI agent runtime through a programmable interface. Instead of building your own orchestration layer from scratch, you can reuse a production-tested engine that already handles planning, tool calls, file editing, and multi-turn conversation.
| Item | Details |
|---|---|
| Repository | github/copilot-sdk |
| Status | Technical preview |
| Languages | TypeScript/Node.js, Python, Go, .NET |
| License | MIT |
| Authentication | GitHub OAuth, GITHUB_TOKEN, or BYOK |
| Billing | Charged against Copilot premium request quota |
Architecture
All four SDKs share the same communication model. Your application talks to the SDK client, and the SDK client talks to Copilot CLI running in server mode over JSON-RPC.
Application -> SDK client -> JSON-RPC -> Copilot CLI (server mode)
The SDK automatically manages the lifecycle of the CLI process. You can also run the CLI separately in headless server mode and connect multiple SDK clients to it, which is useful for shared development environments and debugging.
Main features
- Prompt submission and response handling: supports both streaming and non-streaming responses
- Custom tool definition: lets the agent call custom tools with typed parameters and handler functions
- MCP server connections: gives access to tools backed by the GitHub API, databases, or cloud providers
- Custom agent creation: supports agents with their own personas, system messages, and toolsets
- Model selection: in addition to Copilot-provided models, BYOK lets you use OpenAI, Azure AI Foundry, and Anthropic models with your own API keys
It works in as little as five lines
This is the minimal TypeScript setup:
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: 'What is 2 + 2?' });
console.log(response?.data.content);
await client.stop();
The Python version is similarly short.
A practical custom-tool example
For example, you could define a tool that checks Kubernetes pod status. Then the agent can answer a question like “Are there any unhealthy pods in the production namespace?” by calling the tool automatically and returning the result in natural language.
const checkPodStatus = defineTool('check_pod_status', {
description: 'Check the status of Kubernetes pods in a namespace',
parameters: {
type: 'object',
properties: {
namespace: { type: 'string', description: 'The Kubernetes namespace' },
},
required: ['namespace'],
},
handler: async (args: { namespace: string }) => {
// In practice, this would call kubectl or the Kubernetes API.
return { namespace: args.namespace, pods: [...] };
},
});
DevOps use cases
The SDK becomes especially valuable when you embed AI agents into existing operational tooling. Incident-response bots, infrastructure validators, deployment assistants, and compliance checkers are all realistic use cases when you combine the Copilot engine with your own tools.
The important shift is that Copilot no longer has to stay inside an IDE or GitHub Issues. You can now embed the agent directly into your own applications and scripts, which broadens the range of DevOps automation considerably.
References: DEV Community / github/copilot-sdk