Skip to content

Python: Fix inconsistent response_id in A2AAgent message handling#5276

Open
kartikmadan11 wants to merge 1 commit intomicrosoft:mainfrom
kartikmadan11:fix/5263-a2a-consistent-response-id
Open

Python: Fix inconsistent response_id in A2AAgent message handling#5276
kartikmadan11 wants to merge 1 commit intomicrosoft:mainfrom
kartikmadan11:fix/5263-a2a-consistent-response-id

Conversation

@kartikmadan11
Copy link
Copy Markdown
Contributor

Motivation and Context

A2AAgent sets response_id inconsistently depending on the response type:

  • A2AMessage path: response_id = message_id (a per-message identifier)
  • Task path: response_id = task.id (a per-operation identifier)

This means downstream code receiving response_id gets semantically different values depending on which wire format the remote agent chose, even for the same logical operation.

Fixes #5263

Description

response_id now consistently uses task_id (the operation-level identifier) across both code paths, falling back to a generated UUID for standalone messages that have no associated task.

message_id is propagated to the dedicated message_id field on AgentResponseUpdate, which was previously unused in the A2AMessage path.

Before:

response_id=str(getattr(item, "message_id", uuid.uuid4()))
# message_id not propagated

After:

response_id=item.task_id or str(uuid.uuid4()),
message_id=item.message_id,

Contribution Checklist

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

…oft#5263)

A2AAgent set response_id to message_id when processing A2AMessage
responses but used task.id for Task-based responses, causing
inconsistent response_id values across the two code paths.

Now response_id consistently uses task_id (falling back to a generated
UUID for standalone messages), while message_id is propagated to the
dedicated message_id field on AgentResponseUpdate.

Fixes microsoft#5263
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.

Python: [Bug]: Inconsistent handling of response_id in returned messages by A2AAgent

2 participants