When you set SessionConfig.CustomAgents all agents that would be otherwise loaded from the workspace .github/agent folder are ignored
This simple examples shows the behaviour
using GitHub.Copilot;
// path to .github folder containing agents folder
const string WorkingDirectory = @"C:\SomeWorkspace";
await using var client = new CopilotClient();
await using var session = await client.CreateSessionAsync(new SessionConfig
{
WorkingDirectory = WorkingDirectory,
EnableConfigDiscovery = true, // Note that this has to be true to get any agents to load from disk - (see https://github.com/github/copilot-sdk/issues/1887)
CustomAgents = [ // Remove this property and you'll see that all agents are loaded from the .github/agents folder
new() {
Name = "Custom"
}
]
});
var agentsList = await session.Rpc.Agent.ListAsync();
foreach (var agent in agentsList.Agents)
{
// You'll only see the "Custom" agent.
Console.WriteLine(agent.Name);
}
Agent file I was using in a .github/agents/sample.agent.md file:
---
name: sample
description: Sample Agent
---
You are an sample agent for this repository, you're just happy to be here!
The agent list isn't merged together like skills, instructions and MCPs are.
Additionally, are there any plans to bring the agents loaded in via the CustomAgents property into full parity with agents loaded from the .github/agents folder? It seems that not all properties are supported, like Handoffs, which means no SessionHandoffEvent can ever be raised and agent passing can only happen via sub-agents via the task tool.
When you set
SessionConfig.CustomAgentsall agents that would be otherwise loaded from the workspace .github/agent folder are ignoredThis simple examples shows the behaviour
Agent file I was using in a .github/agents/sample.agent.md file:
The agent list isn't merged together like skills, instructions and MCPs are.
Additionally, are there any plans to bring the agents loaded in via the CustomAgents property into full parity with agents loaded from the .github/agents folder? It seems that not all properties are supported, like Handoffs, which means no
SessionHandoffEventcan ever be raised and agent passing can only happen via sub-agents via thetasktool.