Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
581abad
Phase L: emit discriminated unions in Python codegen + drop hand-writ…
SteveSandersonMS May 22, 2026
56c52a3
Phase A: SessionConfig/ResumeSessionConfig renames
SteveSandersonMS May 22, 2026
c252a04
Phase B: RuntimeConnection discriminated config + CopilotClientOptions
SteveSandersonMS May 22, 2026
f037503
Phase B fixup: re-export TelemetryConfig from copilot package
SteveSandersonMS May 22, 2026
156029e
Phase B fixup: regenerate codegen, fix scenario create_session calls
SteveSandersonMS May 22, 2026
30f2d6b
Phase B fixup: run nightly rustfmt on regenerated Rust types
SteveSandersonMS May 22, 2026
9885b92
Phase B fixup: address CI e2e failures from runtime port + Kind/Type …
SteveSandersonMS May 22, 2026
0ea0bc7
Phase C: streaming/MCP/shape cleanups + disable quicktype combineClasses
SteveSandersonMS May 22, 2026
9d63384
Phase D + E: lifecycle polymorphic union + datetime timestamps
SteveSandersonMS May 22, 2026
24cafde
Phase F: internals cleanup + expand public API surface
SteveSandersonMS May 22, 2026
7531aca
Phase G: snake_case fix-up on public dataclass fields
SteveSandersonMS May 22, 2026
b23e8dc
Phase H: extract SessionConfigBase TypedDict
SteveSandersonMS May 22, 2026
b80af48
Phase I: update README + docs for new Python SDK API
SteveSandersonMS May 22, 2026
2c6bedd
Phase F/G fixup: fix new ty errors
SteveSandersonMS May 22, 2026
15a466a
E2E test fixups for renamed APIs
SteveSandersonMS May 22, 2026
b57bab8
Rename RuntimeConnection factories to for_stdio/for_tcp/for_uri
SteveSandersonMS May 22, 2026
91981ea
Address CodeQL findings: overload bodies + match-to-if-chain
SteveSandersonMS May 22, 2026
53bd275
Rename GetStatusResponse.protocolVersion -> protocol_version
SteveSandersonMS May 22, 2026
9786c53
Move on_list_models into options, drop auto_start + get_state
SteveSandersonMS May 22, 2026
5676e4f
Flatten CopilotClient options + drop unused SessionConfig TypedDicts
SteveSandersonMS May 22, 2026
886c12d
Fix missing ** spread on _make_options in propagate-options test
SteveSandersonMS May 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/auth/byok.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ const client = new CopilotClient({
from copilot import CopilotClient
from copilot.client import ModelInfo, ModelCapabilities, ModelSupports, ModelLimits

client = CopilotClient({
"on_list_models": lambda: [
client = CopilotClient(
on_list_models=lambda: [
ModelInfo(
id="my-custom-model",
name="My Custom Model",
Expand All @@ -383,7 +383,7 @@ client = CopilotClient({
),
)
],
})
)
```

</details>
Expand Down
5 changes: 2 additions & 3 deletions docs/features/custom-agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,13 @@ const session = await client.createSession({
<summary><strong>Python</strong></summary>

```python
from copilot import CopilotClient
from copilot.session import PermissionRequestResult
from copilot import CopilotClient, PermissionDecisionApproveOnce

client = CopilotClient()
await client.start()

session = await client.create_session(
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approve-once"),
on_permission_request=lambda req, inv: PermissionDecisionApproveOnce(),
model="gpt-4.1",
custom_agents=[
{
Expand Down
21 changes: 10 additions & 11 deletions docs/features/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,13 @@ const session = await client.createSession({
<summary><strong>Python</strong></summary>

```python
from copilot import CopilotClient
from copilot.session import PermissionRequestResult
from copilot import CopilotClient, PermissionDecisionApproveOnce

client = CopilotClient()
await client.start()

session = await client.create_session(
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approve-once"),
on_permission_request=lambda req, inv: PermissionDecisionApproveOnce(),
hooks={
"on_session_start": on_session_start,
"on_pre_tool_use": on_pre_tool_use,
Expand Down Expand Up @@ -262,7 +261,7 @@ const session = await client.createSession({
<summary><strong>Python</strong></summary>

```python
from copilot.session import PermissionRequestResult
from copilot import PermissionDecisionApproveOnce

READ_ONLY_TOOLS = ["read_file", "glob", "grep", "view"]

Expand All @@ -276,7 +275,7 @@ async def on_pre_tool_use(input_data, invocation):
return {"permissionDecision": "allow"}

session = await client.create_session(
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approve-once"),
on_permission_request=lambda req, inv: PermissionDecisionApproveOnce(),
hooks={"on_pre_tool_use": on_pre_tool_use},
)
```
Expand Down Expand Up @@ -578,7 +577,7 @@ const session = await client.createSession({
<!-- docs-validate: skip -->
```python
import json, aiofiles
from copilot.session import PermissionRequestResult
from copilot import PermissionDecisionApproveOnce

audit_log = []

Expand Down Expand Up @@ -630,7 +629,7 @@ async def on_session_end(input_data, invocation):
return None

session = await client.create_session(
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approve-once"),
on_permission_request=lambda req, inv: PermissionDecisionApproveOnce(),
hooks={
"on_session_start": on_session_start,
"on_user_prompt_submitted": on_user_prompt_submitted,
Expand Down Expand Up @@ -709,7 +708,7 @@ const session = await client.createSession({

```python
import subprocess
from copilot.session import PermissionRequestResult
from copilot import PermissionDecisionApproveOnce

async def on_session_end(input_data, invocation):
sid = invocation["session_id"][:8]
Expand All @@ -728,7 +727,7 @@ async def on_error_occurred(input_data, invocation):
return None

session = await client.create_session(
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approve-once"),
on_permission_request=lambda req, inv: PermissionDecisionApproveOnce(),
hooks={
"on_session_end": on_session_end,
"on_error_occurred": on_error_occurred,
Expand Down Expand Up @@ -932,7 +931,7 @@ const session = await client.createSession({
<summary><strong>Python</strong></summary>

```python
from copilot.session import PermissionRequestResult
from copilot import PermissionDecisionApproveOnce

session_metrics = {}

Expand Down Expand Up @@ -963,7 +962,7 @@ async def on_session_end(input_data, invocation):
return None

session = await client.create_session(
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approve-once"),
on_permission_request=lambda req, inv: PermissionDecisionApproveOnce(),
hooks={
"on_session_start": on_session_start,
"on_user_prompt_submitted": on_user_prompt_submitted,
Expand Down
10 changes: 4 additions & 6 deletions docs/features/image-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,13 @@ await session.send({
<summary><strong>Python</strong></summary>

```python
from copilot import CopilotClient
from copilot.session import PermissionRequestResult
from copilot import CopilotClient, PermissionDecisionApproveOnce

client = CopilotClient()
await client.start()

session = await client.create_session(
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approve-once"),
on_permission_request=lambda req, inv: PermissionDecisionApproveOnce(),
model="gpt-4.1",
)

Expand Down Expand Up @@ -286,14 +285,13 @@ await session.send({
<summary><strong>Python</strong></summary>

```python
from copilot import CopilotClient
from copilot.session import PermissionRequestResult
from copilot import CopilotClient, PermissionDecisionApproveOnce

client = CopilotClient()
await client.start()

session = await client.create_session(
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approve-once"),
on_permission_request=lambda req, inv: PermissionDecisionApproveOnce(),
model="gpt-4.1",
)

Expand Down
4 changes: 2 additions & 2 deletions docs/features/remote-sessions.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ session.on("session.info", (event) => {

<!-- docs-validate: skip -->
```python
from copilot import CopilotClient, SubprocessConfig
from copilot import CopilotClient

client = CopilotClient(SubprocessConfig(remote=True))
client = CopilotClient(enable_remote_sessions=True)
session = await client.create_session(
working_directory="/path/to/github-repo",
on_permission_request=lambda req: {"allowed": True},
Expand Down
5 changes: 2 additions & 3 deletions docs/features/skills.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@ await session.sendAndWait({ prompt: "Review this code for security issues" });
<summary><strong>Python</strong></summary>

```python
from copilot import CopilotClient
from copilot.session import PermissionRequestResult
from copilot import CopilotClient, PermissionDecisionApproveOnce

async def main():
client = CopilotClient()
await client.start()

session = await client.create_session(
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approve-once"),
on_permission_request=lambda req, inv: PermissionDecisionApproveOnce(),
model="gpt-4.1",
skill_directories=[
"./skills/code-review",
Expand Down
12 changes: 5 additions & 7 deletions docs/features/steering-and-queueing.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,14 @@ await session.send({
<summary><strong>Python</strong></summary>

```python
from copilot import CopilotClient
from copilot.session import PermissionRequestResult
from copilot import CopilotClient, PermissionDecisionApproveOnce

async def main():
client = CopilotClient()
await client.start()

session = await client.create_session(
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approve-once"),
on_permission_request=lambda req, inv: PermissionDecisionApproveOnce(),
model="gpt-4.1",
)

Expand Down Expand Up @@ -261,15 +260,14 @@ await session.send({
<summary><strong>Python</strong></summary>

```python
from copilot import CopilotClient
from copilot.session import PermissionRequestResult
from copilot import CopilotClient, PermissionDecisionApproveOnce

async def main():
client = CopilotClient()
await client.start()

session = await client.create_session(
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approve-once"),
on_permission_request=lambda req, inv: PermissionDecisionApproveOnce(),
model="gpt-4.1",
)

Expand Down Expand Up @@ -502,7 +500,7 @@ await session.send({

```python
session = await client.create_session(
on_permission_request=lambda req, inv: PermissionRequestResult(kind="approve-once"),
on_permission_request=lambda req, inv: PermissionDecisionApproveOnce(),
model="gpt-4.1",
)

Expand Down
17 changes: 8 additions & 9 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -665,13 +665,12 @@ unsubscribeIdle();

<!-- docs-validate: hidden -->
```python
from copilot import CopilotClient
from copilot import CopilotClient, PermissionDecisionApproveOnce
from copilot.generated.session_events import SessionEvent, SessionEventType
from copilot.session import PermissionRequestResult

client = CopilotClient()

session = await client.create_session(on_permission_request=lambda req, inv: PermissionRequestResult(kind="approve-once"))
session = await client.create_session(on_permission_request=lambda req, inv: PermissionDecisionApproveOnce())

# Subscribe to all events
unsubscribe = session.on(lambda event: print(f"Event: {event.type}"))
Expand Down Expand Up @@ -1968,12 +1967,12 @@ const session = await client.createSession({ onPermissionRequest: approveAll });
<summary><strong>Python</strong></summary>

```python
from copilot import CopilotClient
from copilot import CopilotClient, CopilotClientOptions, RuntimeConnection
from copilot.session import PermissionHandler

client = CopilotClient({
"cli_url": "localhost:4321"
})
client = CopilotClient(CopilotClientOptions(
connection=RuntimeConnection.for_uri("localhost:4321"),
))
Comment on lines +1970 to +1975
await client.start()

# Use the client normally
Expand Down Expand Up @@ -2138,9 +2137,9 @@ Optional peer dependency: `@opentelemetry/api`

<!-- docs-validate: skip -->
```python
from copilot import CopilotClient, SubprocessConfig
from copilot import CopilotClient, CopilotClientOptions

client = CopilotClient(SubprocessConfig(
client = CopilotClient(CopilotClientOptions(
telemetry={
"otlp_endpoint": "http://localhost:4318",
},
Expand Down
6 changes: 3 additions & 3 deletions docs/observability/opentelemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ const client = new CopilotClient({

<!-- docs-validate: skip -->
```python
from copilot import CopilotClient, SubprocessConfig
from copilot import CopilotClient

client = CopilotClient(SubprocessConfig(
client = CopilotClient(
telemetry={
"otlp_endpoint": "http://localhost:4318",
},
))
)
```

</details>
Expand Down
6 changes: 4 additions & 2 deletions docs/setup/backend-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,12 @@ res.json({ content: response?.data.content });
<summary><strong>Python</strong></summary>

```python
from copilot import CopilotClient, ExternalServerConfig
from copilot import CopilotClient, RuntimeConnection
from copilot.session import PermissionHandler

client = CopilotClient(ExternalServerConfig(url="localhost:4321"))
client = CopilotClient(
connection=RuntimeConnection.for_uri("localhost:4321"),
)
await client.start()

session = await client.create_session(on_permission_request=PermissionHandler.approve_all, model="gpt-4.1", session_id=f"user-{user_id}-{int(time.time())}")
Expand Down
4 changes: 2 additions & 2 deletions docs/troubleshooting/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const client = new CopilotClient({
```python
from copilot import CopilotClient

client = CopilotClient({"log_level": "debug"})
client = CopilotClient(log_level="debug")
```

</details>
Expand Down Expand Up @@ -131,7 +131,7 @@ const client = new CopilotClient({
```

> [!NOTE]
> Python SDK logging configuration is limited. For advanced logging, run the CLI manually with `--log-dir` and connect via `cli_url`.
> Python SDK logging configuration is limited. For advanced logging, run the CLI manually with `--log-dir` and connect via `RuntimeConnection.for_uri(...)`.

</details>

Expand Down
Loading
Loading