.NET: assign AgentCard's URL to mapped-endpoint if not defined explicitly (#2047)

* fix serialization in chat completions on tools

* nit

* write e2e test for agent card resolve + adjust behavior

* nit
This commit is contained in:
Korolev Dmitry
2025-11-10 12:06:59 +00:00
committed by GitHub
parent 42da3cb6a4
commit 866b4198bf
6 changed files with 134 additions and 28 deletions
@@ -83,7 +83,16 @@ public static class AIAgentExtensions
{
// A2A SDK assigns the url on its own
// we can help user if they did not set Url explicitly.
agentCard.Url ??= context;
if (string.IsNullOrEmpty(agentCard.Url))
{
var agentCardUrl = context.TrimEnd('/');
if (!context.EndsWith("/v1/card", StringComparison.Ordinal))
{
agentCardUrl += "/v1/card";
}
agentCard.Url = agentCardUrl;
}
return Task.FromResult(agentCard);
};