diff --git a/dotnet/Directory.Packages.props b/dotnet/Directory.Packages.props
index 7841b9be70..92af1fff29 100644
--- a/dotnet/Directory.Packages.props
+++ b/dotnet/Directory.Packages.props
@@ -39,7 +39,7 @@
-
+
diff --git a/dotnet/samples/A2AClientServer/A2AClient/Program.cs b/dotnet/samples/A2AClientServer/A2AClient/Program.cs
index 34c9ec4563..838cbaaef8 100644
--- a/dotnet/samples/A2AClientServer/A2AClient/Program.cs
+++ b/dotnet/samples/A2AClientServer/A2AClient/Program.cs
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
using System.CommandLine;
-using System.CommandLine.Invocation;
using System.Reflection;
using Microsoft.Agents.AI;
using Microsoft.Extensions.Configuration;
@@ -15,13 +14,13 @@ public static class Program
{
// Create root command with options
var rootCommand = new RootCommand("A2AClient");
- rootCommand.SetHandler(HandleCommandsAsync);
+ rootCommand.SetAction((_, ct) => HandleCommandsAsync(ct));
// Run the command
- return await rootCommand.InvokeAsync(args);
+ return await rootCommand.Parse(args).InvokeAsync();
}
- public static async Task HandleCommandsAsync(InvocationContext context)
+ private static async Task HandleCommandsAsync(CancellationToken cancellationToken)
{
// Set up the logging
using var loggerFactory = LoggerFactory.Create(builder =>
@@ -62,7 +61,7 @@ public static class Program
break;
}
- var agentResponse = await hostAgent.Agent!.RunAsync(message, thread);
+ var agentResponse = await hostAgent.Agent!.RunAsync(message, thread, cancellationToken: cancellationToken);
foreach (var chatMessage in agentResponse.Messages)
{
Console.ForegroundColor = ConsoleColor.Cyan;