-
Notifications
You must be signed in to change notification settings - Fork 9
Description
What would you like to be added?
I would like to be able to specify the IAgentRuntime implementation used by a given agent.
Proposal(s):
I would like to be able to assign a specific IAgentRuntime derived class per Agent.
For me, it's really not up to me to propose an interface or implementation. I'd be happy to use anything you come up with!
Maybe adding .WithAgentRuntime() to AgentCardBuilder would do the trick, but maybe you don't want to add the Agent Runtime details to the Agent Card.
Alternative(s):
Some alternative interfaces off the top of my head:
Or MapAgentRuntime(Uri, IAgentRuntime)
Or UseAgentRuntime(Func<Uri, IServiceProvider, IAgentRuntime>)
Or UseAgentRuntime(Func<A2AWellKnownAgentCard, IServiceProvider, IAgentRuntime>)
Additional info:
This is the code I'm using now:
var builder = WebApplication.CreateBuilder();
builder.Services.Configure<JsonOptions>(options => {
options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault;
});
builder.Services.AddDistributedMemoryCache();
builder.Services.AddTransient<IAgentRuntime, AgentRuntime>();
builder.Services.AddA2AWellKnownAgent((provider, builder) => {
builder
.WithName("agent1")
.WithDescription("desc")
.WithVersion("1")
.WithProvider(provider => provider
.WithOrganization("virtuallife")
.WithUrl(new("https://github.com/virtuallife")))
.WithUrl(new("/a2a/agent1", UriKind.Relative));
});
builder.Services.AddA2AWellKnownAgent((provider, builder) => {
builder
.WithName("agent2")
.WithDescription("desc")
.WithVersion("1")
.WithProvider(provider => provider
.WithOrganization("virtuallife")
.WithUrl(new("https://github.com/virtuallife")))
.WithUrl(new("/a2a/agent2", UriKind.Relative));
});
builder.Services.AddA2AProtocolServer(builder => {
builder
.UseAgentRuntime(provider => provider.GetRequiredService<IAgentRuntime>())
.UseDistributedCacheTaskRepository();
});
var app = builder.Build();
app.MapA2AWellKnownAgentEndpoint();
app.MapA2AHttpEndpoint("/a2a/agent1");
app.MapA2AHttpEndpoint("/a2a/agent2");`
So the client sees both agents on the card. One with endpoint /a2a/agent1 and one with endpoint /a2a/agent2.
The client chooses which agent to talk to by using the correct endpoint.
No matter what endpoint the client uses, the request ends up in an instance of the singular AgentRuntime class set here:
.UseAgentRuntime(provider => provider.GetRequiredService<IAgentRuntime>())"
And once there, the TaskRecord does not contain any information for the AgentRuntime to distinguish between agent1 and agent2.
Therefore, I would like to be able to assign a specific IAgentRuntime derived class per Agent.
Community Notes
- Please vote by adding a 👍 reaction to the feature to help us prioritize.
- If you are interested to work on this feature, please leave a comment.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status