Skip to content

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

Closed
Baidar (karimbaidar) wants to merge 1 commit into
microsoft:mainfrom
karimbaidar:codex/a2a-session-taskid-message
Closed

Baidar (karimbaidar) wants to merge 1 commit into
microsoft:mainfrom
karimbaidar:codex/a2a-session-taskid-message

Conversation

@karimbaidar

Copy link
Copy Markdown
Contributor

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 Evan Mattson (moonbox3) added the .NET Usage: [Issues, PRs], Target: .Net label Apr 24, 2026
@karimbaidar
Baidar (karimbaidar) marked this pull request as ready for review April 24, 2026 15:17
@karimbaidar

Copy link
Copy Markdown
Contributor Author

Evan Mattson (@moonbox3) can someone please review this PR ? thank you!

@SergeyMenshykh

Copy link
Copy Markdown
Collaborator

Addressed in #5743

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

Labels

.NET Usage: [Issues, PRs], Target: .Net

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

3 participants