Skip to content

.NET: Send A2A session task id as message taskId#5465

Open
karimbaidar wants to merge 1 commit intomicrosoft:mainfrom
karimbaidar:codex/a2a-session-taskid-message
Open

.NET: Send A2A session task id as message taskId#5465
karimbaidar wants to merge 1 commit intomicrosoft:mainfrom
karimbaidar:codex/a2a-session-taskid-message

Conversation

@karimbaidar
Copy link
Copy Markdown

Motivation and Context

Fixes #5417.

A2AAgent sessions can carry both a contextId and a taskId through CreateSessionAsync(contextId, taskId), but outbound messages were copying the session task id into ReferenceTaskIds instead of TaskId. For an in-progress A2A task, the next client message needs taskId set so the remote agent can update that task. With the current payload, callers cannot resume that task-specific interaction through the framework path.

Description

  • Set outbound A2A Message.TaskId from A2AAgentSession.TaskId.
  • Stop treating the session task id as ReferenceTaskIds.
  • Update the RunAsync and RunStreamingAsync regression tests to use the public CreateSessionAsync(contextId, taskId) path and assert that both contextId and taskId are sent.

This is safe because it uses the existing session task id and does not add a new public API or change the session serialization shape. It aligns the wire payload with the existing overload name and with the A2A task continuation field.

Validation

  • dotnet test --project tests/Microsoft.Agents.AI.A2A.UnitTests/Microsoft.Agents.AI.A2A.UnitTests.csproj (net8.0, net9.0, net10.0; 351 passed)
  • dotnet format agent-framework-dotnet.slnx --verify-no-changes --no-restore --include src/Microsoft.Agents.AI.A2A/A2AAgent.cs tests/Microsoft.Agents.AI.A2A.UnitTests/A2AAgentTests.cs
  • git diff --check

Remaining risk / follow-up

This does not add a separate public ReferenceTaskIds session API. If callers need to start a new task while explicitly referencing earlier tasks, that should be handled as a follow-up API discussion.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@moonbox3 moonbox3 added the .NET label Apr 24, 2026
@karimbaidar karimbaidar marked this pull request as ready for review April 24, 2026 15:17
@karimbaidar
Copy link
Copy Markdown
Author

@moonbox3 can someone please review this PR ? thank you!

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: [Feature]: Update A2AAgent to set a2aMessage.TaskId if present in A2AAgentSession

2 participants