Skip to content

Python: GitHubCopilotAgent does not forward provider config to SessionConfig, BYOK not working #5190

Closed

Description

Description

GitHubCopilotAgent in agent-framework-github-copilot does not forward the provider field to the Copilot SDK's SessionConfig, making BYOK (Bring Your Own Key) and Azure Managed Identity authentication impossible through the Agent Framework wrapper.

How we found this

We are building an app on Azure Container Apps with Managed Identity). We wanted to use GitHubCopilotAgent with our Azure OpenAI endpoint via a bearer token, following the official GitHub docs for Azure Managed Identity with Copilot SDK. The provider config passed via default_options is not forwarded to the underlying SDK session.

Root cause

In python/packages/github_copilot/agent_framework_github_copilot/_agent.py, _create_session() builds a SessionConfig and explicitly forwards model, system_message, tools, on_permission_request, mcp_servers, and streaming — but never reads or forwards provider.

The same gap exists in _resume_session().

What the Copilot SDK supports

The underlying github-copilot-sdk fully supports this. Both SessionConfig and ResumeSessionConfig have a provider: ProviderConfig field:

# copilot/types.py
class ProviderConfig(TypedDict, total=False):
    type: Literal["openai", "azure", "anthropic"]
    base_url: str
    api_key: str
    bearer_token: str  # For Managed Identity / Entra ID tokens
    wire_api: Literal["completions", "responses"]
    azure: AzureProviderOptions

Proposed fix

Add provider passthrough in _create_session() (after the mcp_servers block):

provider = opts.get("provider") or self._default_options.get("provider")
if provider:
    config["provider"] = provider

And in _resume_session():

provider = self._default_options.get("provider")
if provider:
    config["provider"] = provider

Optionally, add provider: ProviderConfig to GitHubCopilotOptions TypedDict for type safety.

Verified locally

We patched the installed package and confirmed it works:

from azure.identity import AzureCliCredential
from agent_framework_github_copilot import GitHubCopilotAgent

credential = AzureCliCredential()
token = credential.get_token("https://cognitiveservices.azure.com/.default")

agent = GitHubCopilotAgent(
    instructions="Reply in one word.",
    default_options={
        "model": "gpt-5-mini",
        "on_permission_request": deny_all,
        "provider": {
            "type": "azure",
            "base_url": "https://my-resource.openai.azure.com",
            "bearer_token": token.token,
        },
    },
)
async with agent:
    result = await agent.run("What is 2 + 2?")
    # ✅ Response: "Four."

Environment

  • agent-framework-github-copilot==1.0.0b260402
  • github-copilot-sdk==0.1.32
  • Python 3.13

Activity

  1. added
    pythonUsage: [Issues, PRs], Target: Python
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Apr 9, 2026
  2. changed the title [-]Python: GitHubCopilotAgent does not forward provider config to SessionConfig (BYOK broken)[/-] [+]Python: GitHubCopilotAgent does not forward provider config to SessionConfig, BYOK not working[/+] on Apr 9, 2026
  3. added 2 commits that reference this issue on Apr 9, 2026
    3f95d5a
    cf9aa04
  4. removed
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Apr 14, 2026
  5. moved this from Planned to In Review in Agent Frameworkon Apr 14, 2026
  6. added a commit that references this issue on Apr 15, 2026
    eab7f09
  7. moved this from In Review to Done in Agent Frameworkon Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

pythonUsage: [Issues, PRs], Target: Python

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions