From 0d853662fae67ce06951a5fcf097977fccd74c37 Mon Sep 17 00:00:00 2001 From: Copilot <223556219+Copilot@users.noreply.github.com> Date: Sat, 16 May 2026 14:32:19 -0400 Subject: [PATCH] Fix Python Quick Start example to compile with current SDK The Quick Start snippet in python/README.md called create_session(model=...) without the required keyword-only on_permission_request argument, so running it raised: TypeError: CopilotClient.create_session() missing 1 required keyword-only argument: 'on_permission_request'. Add the PermissionHandler import and pass on_permission_request=PermissionHandler.approve_all. Apply the same one-line fix to the API Reference snippet directly below, which had the identical bug. Fixes #1079 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- python/README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/python/README.md b/python/README.md index 8f0fd477b..79f97cf04 100644 --- a/python/README.md +++ b/python/README.md @@ -28,12 +28,16 @@ import asyncio from copilot import CopilotClient from copilot.generated.session_events import AssistantMessageData, SessionIdleData +from copilot.session import PermissionHandler async def main(): # Client automatically starts on enter and cleans up on exit async with CopilotClient() as client: # Create a session with automatic cleanup - async with await client.create_session(model="gpt-5") as session: + async with await client.create_session( + on_permission_request=PermissionHandler.approve_all, + model="gpt-5", + ) as session: # Wait for response using session.idle event done = asyncio.Event() @@ -113,7 +117,10 @@ from copilot import CopilotClient, SubprocessConfig from copilot.session import PermissionHandler async with CopilotClient() as client: - async with await client.create_session(model="gpt-5") as session: + async with await client.create_session( + on_permission_request=PermissionHandler.approve_all, + model="gpt-5", + ) as session: def on_event(event): print(f"Event: {event.type}")