The SessionConfig.EnableConfigDiscovery property's summary tag reads:
/// <summary>
/// When <see langword="true"/>, automatically discovers MCP server configurations
/// (e.g. <c>.mcp.json</c>, <c>.vscode/mcp.json</c>) and skill directories from
/// the working directory and merges them with any explicitly provided
/// <see cref="McpServers"/> and <see cref="SkillDirectories"/>, with explicit
/// values taking precedence on name collision.
/// <para>
/// Custom instruction files (<c>.github/copilot-instructions.md</c>, <c>AGENTS.md</c>, etc.)
/// are always loaded from the working directory regardless of this setting.
/// </para>
/// </summary>
public bool? EnableConfigDiscovery { get; set; }
Using this simple example, you can discover it's not this the case. Agents will ONLY be loaded when the value is set to true. Which is counter to:
"Custom instruction files (.github/copilot-instructions.md, AGENTS.md, etc. are always loaded from the working directory regardless of this setting"
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 = false, // switch this to true if you want agents to be actually loaded.
});
var agentsList = await session.Rpc.Agent.ListAsync();
foreach (var agent in agentsList.Agents)
{
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!
Additionally, are there any plans to support an AgentsDirectories property similar to SkillDirectories, PluginDirectories & InstructionDirectories?
The
SessionConfig.EnableConfigDiscoveryproperty's summary tag reads:Using this simple example, you can discover it's not this the case. Agents will ONLY be loaded when the value is set to true. Which is counter to:
"Custom instruction files (.github/copilot-instructions.md, AGENTS.md, etc. are always loaded from the working directory regardless of this setting"
Agent file I was using in a .github/agents/sample.agent.md file
Additionally, are there any plans to support an
AgentsDirectoriesproperty similar toSkillDirectories,PluginDirectories&InstructionDirectories?