Skip to content

Registering multiple agents in program initialization creates a 'last man wins' situation' #182

@MattB-msft

Description

@MattB-msft

Describe the bug
If I have a program file that includes the following code:

// Add AgentApplicationOptions from appsettings config.
builder.AddAgentApplicationOptions();

// Add the Agent
builder.AddAgent<AuthAgent>();
builder.AddAgent<AuthAgent2>();

Where AuthAgent and AuthAgent2 are both AgentApplications,

The SDK Accepts this however only ever calls the 'last' agent registered.
There does not seem to be a way to attach a route or port to ither agent independently, or call for a named agent in the code:

app.MapPost("/api/messages", async (HttpRequest request, HttpResponse response, IAgentHttpAdapter adapter, IAgent agent, CancellationToken cancellationToken) =>
    {
        await adapter.ProcessAsync(request, response, agent, cancellationToken);
    })
    .AllowAnonymous();

We should either disallow multiple agents to be registered or provide a means to map a route by type or name.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions