github / github/copilot-sdk

CustomAgents - Ignores agents loaded from .github/agents folder

Ouverte
#1,889 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
enhancement
Langage dominant
Java
Étoiles
10.5k
Forks
1.5k
Merge moyen
1 j 11 h
PR mergées (30 j)
128

Description

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

```cs
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:
```md
---
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.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
csharp
Domaine
api, developer-experience
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
48/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.