.NET: Implement Task support for A2A Hosting package#3732
Open
DeagleGross wants to merge 27 commits intomainfrom
Open
.NET: Implement Task support for A2A Hosting package#3732DeagleGross wants to merge 27 commits intomainfrom
DeagleGross wants to merge 27 commits intomainfrom
Conversation
dotnet/src/Microsoft.Agents.AI.Hosting.A2A/AIAgentExtensions.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Hosting.A2A/AIAgentExtensions.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Hosting.A2A/AIAgentExtensions.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Hosting.A2A/AIAgentExtensions.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Hosting.A2A/AIAgentExtensions.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Hosting.A2A/AIAgentExtensions.cs
Outdated
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
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
A2AResponseModeenum to control whether responses are returned asAgentMessage(lightweight),AgentTask(stateful), or determined automatically - Implements full task lifecycle with
OnTaskUpdatedandOnTaskCancelledhandlers for background operation polling - Adds continuation token persistence in task metadata for resumable long-running operations
- Introduces
A2AHostingJsonUtilitiesfor 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 |
…ent-framework into dmkorolev/a2a-tasks
…ent-framework into dmkorolev/a2a-tasks
dotnet/src/Microsoft.Agents.AI.Hosting.A2A/AIAgentExtensions.cs
Outdated
Show resolved
Hide resolved
SergeyMenshykh
approved these changes
Feb 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Task sessions are stored in the
AgentSessionStore, and continuation token for the task is stored in the session-metadata.Closes #406