a2aproject / a2aproject/a2a-dotnet

[Feat]: Agent card should be customizable per request

Đang mở
#353 6 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C#
Star
262
Fork
64
Merge trung bình
5 ngày 2 giờ
Pull request đã merge (30 ngày)
31

Mô tả

### Is your feature request related to a problem? Please describe.

TLDR: Allow agent cards to by dynamic instead of a static agent card being registered on `.AddA2AAgent`.

Currently in the aspnetcore package, when you call `IServiceCollection.AddA2AAgent`, `WebApplication.MapA2A`, and `WebApplication.MapHttpA2A`, you need to provide an agent card.

This is an issue for servers that can host multiple agents and the agent changes depending on the url (and potentially other information like the current user).

Right now I can get by with:
- `IServiceCollection.AddA2AAgent` - Here I can just pass `new AgentCard()` and no issues here.
- `WebApplication.MapA2A` - This method also has an overload where you can pass in an `IA2ARequestHandler` which does not require an `AgentCard`, so we are good here.
- `WebApplication.MapHttpA2A` - This method does not have the overload like the jsonrpc method. For now we are just telling our customers that the `v1/card` operation will return an empty agent card and they should just call the `./well-known/agent-card.json` endpoint instead.

Note that we also aren't using the library's `WebApplication.MapWellKnownAgentCard`, since it uses the same static agent card that was registered on `.AddA2AAgent`, we implemented our own well known agent card endpoint.

BTW, I believe we were able to provide our own agent card on v0.3 of this library because the previous version of this library had a `.OnAgentCardQuery` handler on the task manager which allowed us to return the agent card at the time of request. Would like to have similar functionality carried over, or maybe the interface solution I mention below.

### Describe the solution you'd like

Possibly an `IAgentCard` interface that allows the developer to return an agent card in their own way will be best.

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

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

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

Đánh giá

Issue này chưa được đánh giá.

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.