.NET: rename A2A extension methods (#915)

* rename

* simplify via agentProxy

* Update dotnet/src/Microsoft.Extensions.AI.Agents.Hosting.A2A.AspNetCore/WebApplicationExtensions.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update dotnet/src/Microsoft.Extensions.AI.Agents.Hosting.A2A/Microsoft.Extensions.AI.Agents.Hosting.A2A.csproj

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Korolev Dmitry
2025-09-29 17:43:50 +00:00
committed by GitHub
co-authored by Copilot
parent 9e8f5e62e7
commit fe6492ce60
6 changed files with 28 additions and 53 deletions
@@ -20,14 +20,14 @@ public static class WebApplicationExtensions
/// <param name="app">The web application used to configure the pipeline and routes.</param>
/// <param name="agentName">The name of the agent to use for A2A protocol integration.</param>
/// <param name="path">The route group to use for A2A endpoints.</param>
public static void AttachA2A(this WebApplication app, string agentName, string path)
public static void MapA2A(this WebApplication app, string agentName, string path)
{
var agent = app.Services.GetRequiredKeyedService<AIAgent>(agentName);
var loggerFactory = app.Services.GetRequiredService<ILoggerFactory>();
var actorClient = app.Services.GetRequiredService<IActorClient>();
var taskManager = agent.AttachA2A(actorClient, loggerFactory: loggerFactory);
app.AttachA2A(taskManager, path);
var taskManager = agent.MapA2A(actorClient, loggerFactory: loggerFactory);
app.MapA2A(taskManager, path);
}
/// <summary>
@@ -37,7 +37,7 @@ public static class WebApplicationExtensions
/// <param name="agentName">The name of the agent to use for A2A protocol integration.</param>
/// <param name="path">The route group to use for A2A endpoints.</param>
/// <param name="agentCard">Agent card info to return on query.</param>
public static void AttachA2A(
public static void MapA2A(
this WebApplication app,
string agentName,
string path,
@@ -47,8 +47,8 @@ public static class WebApplicationExtensions
var loggerFactory = app.Services.GetRequiredService<ILoggerFactory>();
var actorClient = app.Services.GetRequiredService<IActorClient>();
var taskManager = agent.AttachA2A(actorClient, agentCard: agentCard, loggerFactory: loggerFactory);
app.AttachA2A(taskManager, path);
var taskManager = agent.MapA2A(actorClient, agentCard: agentCard, loggerFactory: loggerFactory);
app.MapA2A(taskManager, path);
}
/// <summary>
@@ -58,7 +58,7 @@ public static class WebApplicationExtensions
/// <param name="app">The web application used to configure the pipeline and routes.</param>
/// <param name="taskManager">Pre-configured A2A TaskManager to use for A2A endpoints handling.</param>
/// <param name="path">The route group to use for A2A endpoints.</param>
public static void AttachA2A(this WebApplication app, TaskManager taskManager, string path)
public static void MapA2A(this WebApplication app, TaskManager taskManager, string path)
{
// note: current SDK version registers multiple `.well-known/agent.json` handlers here.
// it makes app return HTTP 500, but will be fixed once new A2A SDK is released.