CustomAgents - Ignores agents loaded from .github/agents folder

Open
#1,889 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
csharp

Research direction

Start at SessionConfig.CustomAgents and the Agent.ListAsync entry point, then trace how agents are discovered from .github/agents when EnableConfigDiscovery is true. Reproduce the example with a custom agent and a sample.agent.md file, and verify that the resulting list includes both sources while preserving the documented agent behavior. Review the CustomAgents handling alongside agent properties such as Handoffs and SessionHandoffEvent.

Written by the indexing model from the issue text.

Description

enhancement

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.

Dominant language
Java
Stars
10.5k
Forks
1.5k
Avg merge
1d 12h
Merged PRs (30d)
133

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github/copilot-sdk

All issues in github/copilot-sdk

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.