-
Notifications
You must be signed in to change notification settings - Fork 829
.NET: Add support for background responses to A2A agent #2381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
SergeyMenshykh
merged 17 commits into
microsoft:main
from
SergeyMenshykh:a2a-support-background-responses
Nov 24, 2025
Merged
.NET: Add support for background responses to A2A agent #2381
SergeyMenshykh
merged 17 commits into
microsoft:main
from
SergeyMenshykh:a2a-support-background-responses
Nov 24, 2025
Conversation
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
15 tasks
Copilot finished reviewing on behalf of
SergeyMenshykh
November 21, 2025 17:03
Contributor
There was a problem hiding this 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
A2AContinuationTokenfor tracking background task execution state - Updates
A2AAgentThreadto store both conversation context ID and task ID - Enhances
A2AAgent.RunAsyncto 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 |
…/SergeyMenshykh/agent-framework into a2a-support-background-responses
dotnet/samples/GettingStarted/A2A/A2AAgent_PollingForTaskCompletion/Program.cs
Outdated
Show resolved
Hide resolved
dotnet/samples/GettingStarted/A2A/A2AAgent_PollingForTaskCompletion/README.md
Outdated
Show resolved
Hide resolved
rogerbarreto
approved these changes
Nov 24, 2025
crickman
approved these changes
Nov 24, 2025
…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/agent-framework into a2a-support-background-responses
…/SergeyMenshykh/agent-framework into a2a-support-background-responses
rogerbarreto
approved these changes
Nov 24, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
This PR adds support for
AgentTaskto the A2A agent and also includes support for background responses to the non-streamingRunAsyncmethod, 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:
RunAsyncmethodRunStreamingAsyncContributes to: #95