From b6bad658cf9ed5608e42b999914f4a2308bce162 Mon Sep 17 00:00:00 2001 From: Korolev Dmitry Date: Mon, 12 Jan 2026 14:20:10 +0100 Subject: [PATCH] point URL to agent, not to agentcard --- .../Microsoft.Agents.AI.Hosting.A2A/AIAgentExtensions.cs | 8 +------- .../A2AIntegrationTests.cs | 4 +++- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.A2A/AIAgentExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Hosting.A2A/AIAgentExtensions.cs index 499d724b1a..a2cb300687 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.A2A/AIAgentExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.A2A/AIAgentExtensions.cs @@ -90,13 +90,7 @@ public static ITaskManager MapA2A( // we can help user if they did not set Url explicitly. if (string.IsNullOrEmpty(agentCard.Url)) { - var agentCardUrl = context.TrimEnd('/'); - if (!context.EndsWith("/v1/card", StringComparison.Ordinal)) - { - agentCardUrl += "/v1/card"; - } - - agentCard.Url = agentCardUrl; + agentCard.Url = context.TrimEnd('/'); } return Task.FromResult(agentCard); diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.A2A.UnitTests/A2AIntegrationTests.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.A2A.UnitTests/A2AIntegrationTests.cs index 48cb19789a..f8604c7eac 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.A2A.UnitTests/A2AIntegrationTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.A2A.UnitTests/A2AIntegrationTests.cs @@ -77,7 +77,9 @@ public async Task MapA2A_WithAgentCard_CardEndpointReturnsCardWithUrlAsync() Assert.NotNull(url); Assert.NotEmpty(url); Assert.StartsWith("http", url, StringComparison.OrdinalIgnoreCase); - Assert.Equal($"{testServer.BaseAddress.ToString().TrimEnd('/')}/a2a/test-agent/v1/card", url); + + // agentCard's URL matches the agent endpoint + Assert.Equal($"{testServer.BaseAddress.ToString().TrimEnd('/')}/a2a/test-agent", url); } finally {