You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -41,110 +53,49 @@ that is a syntax error on Python 3.9 and earlier.
41
53
42
54
Check your version:
43
55
```bash
44
-
python3 --version
45
-
```
46
-
47
-
If you have Python 3.9 or earlier, install a newer version:
48
-
```bash
49
-
brew install python@3.12 # macOS
50
-
```
51
-
52
-
## Installation
53
-
54
-
```bash
55
-
pip install github-copilot-sdk
56
-
```
57
-
58
-
> **Homebrew Python (macOS):** Homebrew Python 3.10+ enforces PEP 668 and will reject
59
-
> `pip install --user`. Use a virtual environment:
60
-
>
61
-
> ```bash
62
-
> python3.12 -m venv .venv
63
56
>source .venv/bin/activate
64
57
> pip install github-copilot-sdk
65
-
>```
58
+
import asyncio
66
59
67
-
The importable package name is `copilot` (not `github-copilot-sdk`):
68
-
```python
69
-
from copilot import CopilotClient, PermissionHandler
70
-
```
60
+
# GitHub Copilot SDK — Scripting Guide
71
61
72
-
## Prerequisites
62
+
## When to Use the SDK
73
63
74
-
> **The SDK calls the Copilot CLI — the CLI must be present and authenticated.**
75
-
> The SDK spawns `copilot` as a subprocess; if the CLI is missing or unauthenticated
76
-
> the SDK will fail to start.
64
+
Use the Copilot SDK in any deterministic script that needs to delegate non-deterministic tasks (classification, extraction, summarization, evaluation, free-form generation) to an LLM. The SDK is available for Python, Go, .NET (C#), and Node.js (JavaScript/TypeScript).
77
65
78
-
```bash
79
-
# Verify CLI is installed and authenticated
80
-
gh copilot --version
81
-
```
66
+
>**CLI dependency:** The SDK does **not** make direct API calls. It spawns and drives the **GitHub Copilot CLI** as a subprocess. The CLI must be installed and authenticated before running any SDK script. See the [official installation guide](https://docs.github.com/en/copilot/how-tos/set-up/install-copilot-cli).
82
67
83
-
Install the CLI: https://docs.github.com/en/copilot/how-tos/set-up/install-copilot-cli
84
68
85
-
## Quick Start (Python)
69
+
## Language Quick Start Examples
86
70
87
-
```python
88
-
import asyncio
89
-
from copilot import CopilotClient, PermissionHandler
Each example demonstrates how to create a client, start a session, send a prompt, and handle the response. See the referenced files for details and advanced usage.
For .NET file-based scripting, see [Microsoft Learn: File-based programs in C#](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/tutorials/file-based-programs).
117
86
118
-
asyncio.run(main())
119
-
```
120
-
121
-
## `create_session` API
122
-
123
-
**Important:** In SDK v0.2.0+, all `create_session` arguments are keyword-only.
124
-
Do **not** pass a dict positionally — use `**config` or explicit kwargs.
0 commit comments