Skip to content

Conversation

@SergeyMenshykh
Copy link
Member

@SergeyMenshykh SergeyMenshykh commented Nov 21, 2025

This PR adds support for AgentTask to the A2A agent and also includes support for background responses to the non-streaming RunAsync method, enabling consumers to poll for task completion.

The following items are out of scope for this PR and will be addressed separately in follow-up PRs:

  • Support for input requests from the A2A agent
  • Internal polling for agent task completion in the RunAsync method
  • Background responses for the streaming API: RunStreamingAsync

Contributes to: #95

@SergeyMenshykh SergeyMenshykh self-assigned this Nov 21, 2025
Copilot AI review requested due to automatic review settings November 21, 2025 16:54
@SergeyMenshykh SergeyMenshykh added .NET a2a Issue relates to A2A labels Nov 21, 2025
@markwallace-microsoft markwallace-microsoft added the documentation Improvements or additions to documentation label Nov 21, 2025
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 pull request adds support for AgentTask and background responses to the A2A agent, enabling consumers to poll for long-running task completion using continuation tokens.

Key changes:

  • Introduces A2AContinuationToken for tracking background task execution state
  • Updates A2AAgentThread to store both conversation context ID and task ID
  • Enhances A2AAgent.RunAsync to handle task responses and support polling via continuation tokens
  • Adds comprehensive unit tests for the new functionality
  • Includes a sample demonstrating polling for task completion

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
dotnet/src/Microsoft.Agents.AI.A2A/A2AAgent.cs Core implementation of task support, continuation token handling, and streaming task event processing
dotnet/src/Microsoft.Agents.AI.A2A/A2AContinuationToken.cs New class implementing ResponseContinuationToken for task state tracking
dotnet/src/Microsoft.Agents.AI.A2A/A2AAgentThread.cs Enhanced to store task ID alongside context ID with proper serialization
dotnet/src/Microsoft.Agents.AI.A2A/A2AJsonUtilities.cs New utility class providing JSON serialization configuration for A2A types
dotnet/src/Microsoft.Agents.AI.A2A/Extensions/A2AArtifactExtensions.cs Refactored to extract ToAIContents method for better code reuse
dotnet/src/Microsoft.Agents.AI.A2A/Extensions/A2AAgentTaskExtensions.cs Enhanced with new ToAIContents method and nullable return types for better null handling
dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/A2AAgentTests.cs Extensive new tests covering continuation tokens, task responses, and streaming scenarios
dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/Extensions/A2AArtifactExtensionsTests.cs New unit tests for artifact extension methods
dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/Extensions/A2AAgentTaskExtensionsTests.cs New unit tests for agent task extension methods
dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/A2AContinuationTokenTests.cs New comprehensive tests for continuation token serialization and deserialization
dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/A2AAgentThreadTests.cs New tests for thread state serialization
dotnet/samples/GettingStarted/A2A/A2AAgent_PollingForTaskCompletion/Program.cs New sample demonstrating polling for long-running task completion
dotnet/src/Microsoft.Agents.AI.A2A/Microsoft.Agents.AI.A2A.csproj Removed version overrides for package references and added trim attributes configuration
dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/Microsoft.Agents.AI.A2A.UnitTests.csproj Removed version overrides and added NoWarn for MEAI001

…etion/README.md

Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
…nsions.cs

Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
…etion/Program.cs

Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
@SergeyMenshykh SergeyMenshykh added this pull request to the merge queue Nov 24, 2025
Merged via the queue into microsoft:main with commit a610a47 Nov 24, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a2a Issue relates to A2A documentation Improvements or additions to documentation .NET

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants