Copilot sdk
Use GitHub Copilot SDK to programmatically call Copilot from Python. Use when integrating AI capabilities via Copilot CLI into applications.From its SKILL.md
npx -y skills add hevangel/media-agent-skills --skill copilot-sdkAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its file declares
Copied from the file, not written here
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
3.0 KB, as published. Nobody here has run it
GitHub Copilot SDK for Python
The GitHub Copilot SDK is a multi-platform SDK for integrating GitHub Copilot Agent into apps and services. It exposes the same engine behind Copilot CLI, providing a production-tested agent runtime you can invoke programmatically.
Note: This SDK is in technical preview and may change in breaking ways.
Reference
- Code Snippets:
scripts/ - GitHub Repository: https://github.com/github/copilot-sdk
- PyPI Package: https://pypi.org/project/github-copilot-sdk/
Prerequisites
- GitHub Copilot Subscription: Required
- Copilot CLI: Must be installed (
gh extension install github/gh-copilot) - Authentication: Must be logged into GitHub CLI (
gh auth login)
Installation
uv pip install github-copilot-sdk
Architecture
Your Application
|
SDK Client (Python)
| JSON-RPC
Copilot CLI (server mode)
API Reference
CopilotClient Options
| Option | Type | Default | Description |
|---|---|---|---|
cli_path | str | "copilot" | Path to CLI executable |
cli_url | str | None | URL of existing CLI server |
cwd | str | None | Working directory for CLI process |
port | int | 0 | Server port (0 = random) |
use_stdio | bool | True | Use stdio transport |
auto_start | bool | True | Auto-start server |
auto_restart | bool | True | Auto-restart on crash |
CopilotClient Methods
| Method | Description |
|---|---|
await client.start() | Start the CLI server |
await client.stop() | Stop the CLI server |
await client.create_session(config) | Create a conversation session |
await client.resume_session(session_id) | Resume existing session |
await client.get_models() | Get available models |
SessionConfig
| Option | Type | Description |
|---|---|---|
model | str | Model to use ("gpt-5", "claude-sonnet-4.5", etc.) |
tools | list[Tool] | Custom tools exposed to the CLI |
streaming | bool | Enable streaming responses |
mcp_servers | dict | MCP server configurations |
Event Types
| Event Type | Description |
|---|---|
assistant.message | Final assistant message |
assistant.message_delta | Streaming message chunk |
session.idle | Session finished processing |
tool.call | Tool invocation |
error | Error event |
Available Free Models
gpt-5-mini
Basic Usage
import asyncio
from copilot import CopilotClient
async def main():
client = CopilotClient()
await client.start()
session = await client.create_session({"model": "gpt-4.1"})
response = await session.send_and_wait({"prompt": "What is Python?"})
print(response.data.content)
await session.destroy()
await client.stop()
asyncio.run(main())