Skip to content

Comments

.NET: Implement Task support for A2A Hosting package#3732

Open
DeagleGross wants to merge 27 commits intomainfrom
dmkorolev/a2a-tasks
Open

.NET: Implement Task support for A2A Hosting package#3732
DeagleGross wants to merge 27 commits intomainfrom
dmkorolev/a2a-tasks

Conversation

@DeagleGross
Copy link
Contributor

@DeagleGross DeagleGross commented Feb 6, 2026

PR adds the support to A2A Tasks per protocol. As before it uses A2A SDK to subscribe to the events of receiving task/message updates and creation:

        taskManager.OnMessageReceived += OnMessageReceivedAsync;
        taskManager.OnTaskUpdated += OnTaskUpdatedAsync;
        taskManager.OnTaskCancelled += OnTaskCancelledAsync;

Task sessions are stored in the AgentSessionStore, and continuation token for the task is stored in the session-metadata.

Closes #406

@DeagleGross DeagleGross self-assigned this Feb 6, 2026
Copilot AI review requested due to automatic review settings February 6, 2026 18:49
@github-actions github-actions bot changed the title Implement Task support for A2A Hosting package .NET: Implement Task support for A2A Hosting package Feb 6, 2026
@DeagleGross DeagleGross requested review from SergeyMenshykh and westey-m and removed request for Copilot February 6, 2026 18:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive Task support to the A2A Hosting package, implementing the A2A protocol's Task lifecycle management capabilities for long-running agent operations.

Changes:

  • Introduces A2AResponseMode enum to control whether responses are returned as AgentMessage (lightweight), AgentTask (stateful), or determined automatically
  • Implements full task lifecycle with OnTaskUpdated and OnTaskCancelled handlers for background operation polling
  • Adds continuation token persistence in task metadata for resumable long-running operations
  • Introduces A2AHostingJsonUtilities for AOT-friendly serialization with proper resolver chaining

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
dotnet/src/Microsoft.Agents.AI.Hosting.A2A/AIAgentExtensions.cs Core implementation of task support with OnMessageReceived, OnTaskUpdated, and OnTaskCancelled handlers; continuation token storage/retrieval logic
dotnet/src/Microsoft.Agents.AI.Hosting.A2A/A2AResponseMode.cs New enum defining three response modes: Auto (default), Message, and Task
dotnet/src/Microsoft.Agents.AI.Hosting.A2A/A2AHostingJsonUtilities.cs JSON serialization utilities with proper TypeInfoResolver chaining for AOT support
dotnet/src/Microsoft.Agents.AI.Hosting.A2A/Converters/AdditionalPropertiesDictionaryExtensions.cs Updated to use A2AHostingJsonUtilities instead of A2AJsonUtilities for consistency
dotnet/src/Microsoft.Agents.AI.Hosting.A2A.AspNetCore/EndpointRouteBuilderExtensions.cs Added overloads accepting responseMode parameter across all MapA2A extension methods
dotnet/tests/Microsoft.Agents.AI.Hosting.A2A.UnitTests/AIAgentExtensionsTests.cs Comprehensive test coverage for all three response modes, task lifecycle, continuation token handling, error scenarios, and cancellation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: A2A Protocol/SDK integration in agentic-framework

3 participants