Description
When using Microsoft Agent Framework with GitHub Copilot SDK in .NET,
AIAgent.CreateSessionAsync() does not provide a way to pass SessionConfig.
This results in a runtime exception because OnPermissionRequest is required by the Copilot SDK during session creation.
Exception
System.ArgumentException:
"An OnPermissionRequest handler is required when creating a session.
For example, use CreateSessionAsync(new() { OnPermissionRequest = PermissionHandler.ApproveAll });"
Minimal Repro
using GitHub.Copilot.SDK;
using Microsoft.Agents.AI;
await using var copilotClient = new CopilotClient();
await copilotClient.StartAsync();
var agent = copilotClient.AsAIAgent(
tools: [],
instructions: "Test agent"
);
// ❌ No way to pass SessionConfig here
AgentSession session = await agent.CreateSessionAsync();
// ❌ Throws at runtime
var response = await agent.RunAsync("Hello", session);
Observed Behavior
* AIAgent.CreateSessionAsync() internally creates a Copilot session without SessionConfig
* This causes a runtime exception due to missing OnPermissionRequest
* CopilotClientOptions.SessionConfig is not honored during agent session creation
Expected Behavior
One of the following should be supported:
1. Provide overload:
AIAgent.CreateSessionAsync(SessionConfig config)
2. Ensure CopilotClientOptions.SessionConfig is used internally when creating sessions via AIAgent
3. Provide a unified session abstraction between:
* CopilotSession
* AgentSession
Additional Findings
* CopilotClient.CreateSessionAsync(SessionConfig) works correctly
* However, CopilotSession cannot be used with AIAgent.RunAsync(...) due to type mismatch with AgentSession
* This creates a gap where:
* SessionConfig can be set ❌
* OR Agent abstraction can be used ❌
* But not both together
Impact
* Cannot configure permission handling (OnPermissionRequest)
* Tool calling scenarios are blocked
* Limits production usage of AIAgent
Environment
* GitHub.Copilot.SDK: [0.2.2]
* Microsoft.Agents.AI: [1.1.0-preview.260410.1]
* .NET SDK: [.net 8]
* OS: [Windows]
Description
When using Microsoft Agent Framework with GitHub Copilot SDK in .NET,
AIAgent.CreateSessionAsync()does not provide a way to passSessionConfig.This results in a runtime exception because
OnPermissionRequestis required by the Copilot SDK during session creation.Exception
System.ArgumentException:
"An OnPermissionRequest handler is required when creating a session.
For example, use CreateSessionAsync(new() { OnPermissionRequest = PermissionHandler.ApproveAll });"
Minimal Repro