copilot-sdklisted
Install: claude install-skill Ronnasayd/aipp
# GitHub Copilot Python SDK
Python SDK for programmatic control of GitHub Copilot CLI via JSON-RPC.
> **Requirements:** Python 3.11+, GitHub Copilot CLI installed and accessible.
## Installation
```bash
pip install -e ".[telemetry,dev]"
# or
uv pip install -e ".[telemetry,dev]"
```
---
## Core Pattern: CopilotClient + Session
Always prefer async context managers — they handle startup and cleanup automatically.
```python
import asyncio
from copilot import CopilotClient
from copilot.session import PermissionHandler
async def main():
async with CopilotClient() as client:
async with await client.create_session(
on_permission_request=PermissionHandler.approve_all,
model="gpt-5",
) as session:
done = asyncio.Event()
def on_event(event):
if event.type.value == "assistant.message":
print(event.data.content)
elif event.type.value == "session.idle":
done.set()
session.on(on_event)
await session.send("Hello!")
await done.wait()
asyncio.run(main())
```
**Key rule:** `on_permission_request` is **required** in `create_session()` and `resume_session()`. Use `PermissionHandler.approve_all` for dev/trusted environments; write a custom handler for production.
---
## create_session() Parameters
| Parameter | Type | Notes