Skip to content

[Feat]: Agent card should be customizable per request #353

Description

@darena-mhaque

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

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions