Uh oh!
There was an error while loading. Please reload this page.
Python: Migrate GitHub Copilot package to SDK 0.2.x - #5107
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the agent-framework-github-copilot Python integration to be compatible with github-copilot-sdk 0.2.x by migrating type imports away from the removed copilot.types module, updating session/tool invocation call shapes, and adding sample-level OpenTelemetry enablement plus new Copilot CLI telemetry environment variables.
Changes:
- Bump dependency constraints to
github-copilot-sdk>=0.2.0,<0.3.0(and updateuv.lockaccordingly). - Migrate Copilot SDK imports and API usage (e.g.,
create_session(**kwargs),send(prompt)/send_and_wait(prompt)), and update tests/samples to match. - Add OTel instrumentation wrapper (
GitHubCopilotAgentviaAgentTelemetryLayer) and document Copilot CLI telemetry env vars in the samples README.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| python/uv.lock | Locks github-copilot-sdk to 0.2.1 and updates resolver markers. |
| python/packages/github_copilot/pyproject.toml | Bumps github-copilot-sdk dependency range to 0.2.x. |
| python/packages/github_copilot/agent_framework_github_copilot/_agent.py | Migrates SDK imports/APIs, adds telemetry layer wrapper, adds default permission handler + CLI telemetry wiring. |
| python/packages/github_copilot/agent_framework_github_copilot/init.py | Exports RawGitHubCopilotAgent alongside the instrumented agent. |
| python/packages/core/agent_framework/github/init.py / init.pyi | Re-exports RawGitHubCopilotAgent from the core agent_framework.github shim. |
| python/packages/github_copilot/tests/test_github_copilot_agent.py | Updates mocks/assertions to reflect SDK 0.2.x API shapes and dataclass access. |
| python/samples/README.md | Documents new Copilot CLI telemetry environment variables. |
| python/samples/02-agents/providers/github_copilot/*.py | Updates import paths; enables OTel providers in select samples. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Dineshsuriya D (droideronline)
commented
Apr 5, 2026
Dmytro Struk (@dmytrostruk)Eduard van Valkenburg (@eavanvalkenburg)Evan Mattson (@moonbox3)Tao Chen (@TaoChenOSU) - requesting your review on this PR. Thanks! |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Dineshsuriya D (droideronline)
commented
Apr 9, 2026
Eduard van Valkenburg (@eavanvalkenburg)Evan Mattson (@moonbox3) - Can I get any update on this, we need Otel in one of our use case. |
Evan Mattson (moonbox3)
commented
Apr 9, 2026
Eduard van Valkenburg (@eavanvalkenburg) please have a look when you can. |
Eduard van Valkenburg (eavanvalkenburg)
left a comment
There was a problem hiding this comment.
overall looks good, let's get on the latest with this PR
Uh oh!
There was an error while loading. Please reload this page.
cb1f9fe to
f7a737fCompareReplace all imports from the non-existent copilot.types module with correct SDK 0.2.x module paths (copilot.session, copilot.client, copilot.tools, copilot.generated.session_events). Fix PermissionRequest attribute access from dict-style .get() to dataclass attribute access. Add OTel telemetry support to Copilot samples via configure_otel_providers and document new telemetry environment variables in samples README.
…tures - Remove RawGitHubCopilotAgent split and AgentTelemetryLayer inheritance - Remove TelemetryConfig plumbing and OTLP/file telemetry settings - Remove configure_otel_providers() calls from samples - Remove telemetry env var rows from samples README - Retain only: import path fixes, PermissionRequest attribute access fix, log_level default fix, session kwargs typed fix, dependency pin
- SubprocessConfig replaces CopilotClientOptions dict - create_session and resume_session now use keyword args - send and send_and_wait take plain string prompt instead of MessageOptions - on_permission_request is always required; deny-all fallback replaces omission
Tighten the upper bound from <0.3.0 to <=0.2.0 to avoid pulling in 0.2.1+ which has breaking API changes relative to 0.2.0. The lower bound stays at >=0.2.0 since this migration requires the 0.2.x import paths; 0.1.x would fail at import time.
f7a737f to
9b28250Compare
Fixes#5106
Summary
Scoped to SDK 0.2.x compatibility fixes only. OTel/telemetry integration will follow in a separate PR.
copilot.typesmodule with correct SDK 0.2.x module paths across_agent.py, the test file, all 7 samples, and the sample validation scriptPermissionRequest.get("kind")dict-style access to.kindattribute access (PermissionRequestis a dataclass in 0.2.x, not aTypedDict)start()to useSubprocessConfiginstead of the removedCopilotClientOptionsdict; only passlog_levelwhen explicitly set to preserve SDK default behavior_create_sessionand_resume_sessionto call the SDK with direct keyword arguments instead of the removedSessionConfig/ResumeSessionConfigTypedDicts; add_deny_all_permissionsfallback sinceon_permission_requestis now requiredpyproject.tomldependency constraint togithub-copilot-sdk>=0.2.0,<0.3.0Root Cause
copilot.typesdoes not exist in SDK 0.2.x. Types were reorganised:PermissionRequest,SessionEvent,SessionEventTypecopilot.generated.session_eventsPermissionRequestResult,MCPServerConfig,SystemMessageConfigcopilot.sessionTool,ToolInvocation,ToolResultcopilot.toolsAdditionally the following APIs changed:
CopilotClientOptionsdict removed;CopilotClientnow takesSubprocessConfigSessionConfig/ResumeSessionConfigTypedDicts removed;create_session/resume_sessionnow take keyword argumentssend/send_and_waitnow take a plainstrprompt instead of aMessageOptionsdicton_permission_requestis now a required parameter forcreate_session/resume_sessionTest Plan
uv run poe testpasses (77 tests, 0 failures)uv run poe lintpasses (ruff, pyright, mypy)ModuleNotFoundError