a2aproject / a2aproject/a2a-dotnet

[Feat]: Agent card should be customizable per request

オープン
#353 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C#
スター
262
フォーク
64
平均マージ
5日 2時間
マージ済み PR(30日)
31

説明

### 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

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。