Uh oh!
There was an error while loading. Please reload this page.
.NET: Implement Task support for A2A Hosting package - #3732
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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 |
- Add Option 4: Use(...) middleware + HttpContext on additional properties (Javier's recommended approach) - Restructure Decision Outcome as phased approach: Phase 1: Expose HttpContext + document Use(...) pattern (minimal) Phase 2: Factory delegates + IAgentResolver (if demand warrants) - Add Maintainer Feedback section with Javier's direct quote - Expand consulted list: @DeagleGross, @ReubenBond, @rogerbarreto, @westey-m (as requested by @javiercn) - Add reference to DeagleGross's A2A hosting work (microsoft#3732) This revision prioritizes the approach Javier suggested: minimal framework changes using established ASP.NET Core patterns rather than introducing new abstractions.
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