github / github/copilot-sdk

CustomAgents - Ignores agents loaded from .github/agents folder

Đang mở
#1,889 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
Java
Star
10.5k
Fork
1.5k
Merge trung bình
1 ngày 11 giờ
Pull request đã merge (30 ngày)
127

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
csharp
Lĩnh vực
api, developer-experience
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.