diff --git a/dotnet/samples/GettingStarted/A2A/A2AAgent_AsFunctionTools/Program.cs b/dotnet/samples/GettingStarted/A2A/A2AAgent_AsFunctionTools/Program.cs index f0b138c2c7..a6f701cde3 100644 --- a/dotnet/samples/GettingStarted/A2A/A2AAgent_AsFunctionTools/Program.cs +++ b/dotnet/samples/GettingStarted/A2A/A2AAgent_AsFunctionTools/Program.cs @@ -23,7 +23,7 @@ A2ACardResolver agentCardResolver = new(new Uri(a2aAgentHost)); AgentCard agentCard = await agentCardResolver.GetAgentCardAsync(); // Create an instance of the AIAgent for an existing A2A agent specified by the agent card. -AIAgent a2aAgent = await agentCard.GetAIAgentAsync(); +AIAgent a2aAgent = agentCard.GetAIAgent(); // Create the main agent, and provide the a2a agent skills as a function tools. AIAgent agent = new AzureOpenAIClient( diff --git a/dotnet/src/Microsoft.Agents.AI.A2A/Extensions/A2AAgentCardExtensions.cs b/dotnet/src/Microsoft.Agents.AI.A2A/Extensions/A2AAgentCardExtensions.cs index 3c59abcef0..39d7107430 100644 --- a/dotnet/src/Microsoft.Agents.AI.A2A/Extensions/A2AAgentCardExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.A2A/Extensions/A2AAgentCardExtensions.cs @@ -2,7 +2,6 @@ using System; using System.Net.Http; -using System.Threading.Tasks; using Microsoft.Agents.AI; using Microsoft.Extensions.Logging; @@ -28,7 +27,7 @@ public static class A2AAgentCardExtensions /// The to use for HTTP requests. /// The logger factory for enabling logging within the agent. /// An instance backed by the A2A agent. - public static async Task GetAIAgentAsync(this AgentCard card, HttpClient? httpClient = null, ILoggerFactory? loggerFactory = null) + public static AIAgent GetAIAgent(this AgentCard card, HttpClient? httpClient = null, ILoggerFactory? loggerFactory = null) { // Create the A2A client using the agent URL from the card. var a2aClient = new A2AClient(new Uri(card.Url), httpClient); diff --git a/dotnet/src/Microsoft.Agents.AI.A2A/Extensions/A2ACardResolverExtensions.cs b/dotnet/src/Microsoft.Agents.AI.A2A/Extensions/A2ACardResolverExtensions.cs index f458f74a1f..2da58222b8 100644 --- a/dotnet/src/Microsoft.Agents.AI.A2A/Extensions/A2ACardResolverExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.A2A/Extensions/A2ACardResolverExtensions.cs @@ -42,6 +42,6 @@ public static class A2ACardResolverExtensions // Obtain the agent card from the resolver. var agentCard = await resolver.GetAgentCardAsync(cancellationToken).ConfigureAwait(false); - return await agentCard.GetAIAgentAsync(httpClient, loggerFactory).ConfigureAwait(false); + return agentCard.GetAIAgent(httpClient, loggerFactory); } } diff --git a/dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/Extensions/A2AAgentCardExtensionsTests.cs b/dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/Extensions/A2AAgentCardExtensionsTests.cs index 48d1c699e9..16e80b4b26 100644 --- a/dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/Extensions/A2AAgentCardExtensionsTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/Extensions/A2AAgentCardExtensionsTests.cs @@ -31,10 +31,10 @@ public sealed class A2AAgentCardExtensionsTests } [Fact] - public async Task GetAIAgentAsync_ReturnsAIAgentAsync() + public void GetAIAgent_ReturnsAIAgent() { // Act - var agent = await this._agentCard.GetAIAgentAsync(); + var agent = this._agentCard.GetAIAgent(); // Assert Assert.NotNull(agent); @@ -56,7 +56,7 @@ public sealed class A2AAgentCardExtensionsTests Parts = [new TextPart { Text = "Response" }], }); - var agent = await this._agentCard.GetAIAgentAsync(httpClient); + var agent = this._agentCard.GetAIAgent(httpClient); // Act await agent.RunAsync("Test input");