Skip to content

.NET: Make default A2A hosting message-only - #10454

Merged
SergeyMenshykh merged 1 commit into
mainfrom
sergeymenshykh-message-only-a2a-hosting
Nov 27, 2026
Merged

SergeyMenshykh merged 1 commit into
mainfrom
sergeymenshykh-message-only-a2a-hosting

Conversation

@SergeyMenshykh

Copy link
Copy Markdown
Collaborator

Motivation

Task support in the default A2A handler was postponed in #10037, but the default server still resolved a keyed ITaskStore (or created an InMemoryTaskStore) and exposed task operations. Applications should not need to think about task-related services when tasks are not supported.

Description

  • Add an internal MessageOnlyA2AServer used when no custom IAgentHandler is registered for the agent. It does not resolve or allocate a task store.
  • Task operations (get, list, cancel, subscribe) and messages that reference a task now return UnsupportedOperation on both HTTP+JSON and JSON-RPC bindings, before the agent runs or a stream opens. contextId still continues a conversation.
  • Custom IAgentHandler registrations keep the existing task store lookup, in-memory fallback, and isolation wrapper.
  • No public API changes. Update XML docs and A2A hosting samples/guides to drop task isolation guidance for the default path.
  • Add end-to-end tests for both bindings and replace the obsolete existing-task test.

Related Issue

Follow-up to #10037.

The default A2A handler returns messages only, so the default server no longer resolves or allocates a task store and rejects task operations with UnsupportedOperation. Custom IAgentHandler registrations keep the existing task store behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 26, 2026 19:22
@github-actions github-actions Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net labels Nov 26, 2026
@SergeyMenshykh SergeyMenshykh self-assigned this Nov 26, 2026
@SergeyMenshykh
SergeyMenshykh marked this pull request as ready for review November 26, 2026 19:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the message-only default A2A hosting change.

No open issues 🎉

What changed in this PR

Completes the message-only default A2A hosting path introduced in #10037, removing task-store resolution while preserving task support for custom handlers. No public APIs change.

Changes:

  • Adds a message-only server that rejects task operations and task references before agent execution or streaming.
  • Preserves custom-handler task storage and isolation, with tests covering both HTTP+JSON and JSON-RPC.
  • Updates documentation and sample comments to distinguish default session isolation from custom-handler task isolation.
File Description
dotnet/​tests/​Microsoft.Agents.AI.Hosting.A2A.UnitTests/​A2AServerServiceCollectionExtensionsTests.cs Verifies default task-store avoidance and retains custom-handler isolation coverage.
dotnet/​tests/​Microsoft.Agents.AI.Hosting.A2A.UnitTests/​A2AEndpointRouteBuilderExtensionsTests.cs Tests message responses and task rejection across both bindings.
dotnet/​src/​Microsoft.Agents.AI.Hosting.A2A/​MessageOnlyA2AServer.cs Implements message-only handling and task-operation rejection.
dotnet/​src/​Microsoft.Agents.AI.Hosting.A2A/​A2AServerServiceCollectionExtensions.cs Selects the message-only default while preserving custom-handler storage.
dotnet/​src/​Microsoft.Agents.AI.Hosting.A2A.AspNetCore/​A2AEndpointRouteBuilderExtensions.cs Clarifies task support and isolation in XML documentation.
dotnet/​samples/​05-end-to-end/​A2AClientServer/​README.md Removes default task-isolation guidance.
dotnet/​samples/​05-end-to-end/​A2AClientServer/​AUTHENTICATION.md Focuses isolation guidance on retained agent sessions.
dotnet/​samples/​05-end-to-end/​A2AClientServer/​A2AServer/​Program.cs Updates isolation comments without changing sample behavior.
dotnet/​samples/​04-hosting/​README.md Distinguishes default session isolation from custom-handler task isolation.

Review effort: Balanced

@github-code-quality

Copy link
Copy Markdown
Contributor

Code coverage overview

Languages: C#

C# / code-coverage/dotnet

main 9be7ded sergeymenshykh-messa... c916d44 +/-
86% 86% 0%
View coverage of the 5 most impacted files.
File main 9be7ded sergeymenshykh-messa... c916d44 +/-
/home/runner/wo...SessionStore.cs 100% 56% -44%
/home/runner/wo...geExtensions.cs 93% 93% 0%
/home/runner/wo...onExtensions.cs 94% 94% 0%
/home/runner/wo...pedTaskStore.cs 98% 98% 0%
/home/runner/wo...nlyA2AServer.cs 0% 74% +74%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

@SergeyMenshykh
SergeyMenshykh added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit 73e0b2a Nov 27, 2026
38 of 39 checks passed
@SergeyMenshykh
SergeyMenshykh deleted the sergeymenshykh-message-only-a2a-hosting branch November 27, 2026 10:50

This branch was previously deployed

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

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants