一键导入
copilot-sdk
Use GitHub Copilot SDK to programmatically call Copilot from Python. Use when integrating AI capabilities via Copilot CLI into applications.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use GitHub Copilot SDK to programmatically call Copilot from Python. Use when integrating AI capabilities via Copilot CLI into applications.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Search IMDB for movies, TV series, and people. Get details by name or ID, browse upcoming/popular titles. Use when looking up movie/TV/celebrity info from IMDB.
Search and download ebooks from Library Genesis (LibGen). Use when the user needs to find or download ebooks, EPUBs, or PDFs from LibGen.
Search and retrieve TV series, movie, and people info from TheTVDB. Get details by ID, list episodes, seasons, and artwork. Use when looking up TV/movie metadata from TheTVDB.
Search and download movie torrents from YTS (YIFY releases). Use when the user needs to find or download movie torrents with quality and rating filters.
Manage audiobooks: download missing covers, organize metadata, embed cover art, and download from AudiobookBay. Use when working with audiobook libraries, cover images, or AudiobookBay searches.
Interact with the Audiobookshelf API to manage audiobook libraries, update metadata, scan directories, and manage authors. Use when working with Audiobookshelf server instances.
| name | copilot-sdk |
| description | Use GitHub Copilot SDK to programmatically call Copilot from Python. Use when integrating AI capabilities via Copilot CLI into applications. |
| license | MIT |
| compatibility | Requires GitHub Copilot subscription and gh CLI authenticated |
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.
scripts/gh extension install github/gh-copilot)gh auth login)uv pip install github-copilot-sdk
Your Application
|
SDK Client (Python)
| JSON-RPC
Copilot CLI (server mode)
| 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 |
| 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 |
| 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 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 |
gpt-5-miniimport 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())