fix(a2a): align pydantic-ai test + docstring with direct-Message result shape

The non-streaming A2A response was changed so that `result` is the Message
itself (kind="message"), per spec / SendMessageResponse. Update the
PydanticAITransformation._transform_to_a2a_response test and docstring that
still described the old `result.message` envelope so internal consumers
match the producer.
This commit is contained in:
mateo-berri 2026-05-28 03:40:20 +00:00 • committed by Claude
parent a3f958d8d5
commit a0944e1638
No known key found for this signature in database
2 changed files with 11 additions and 10 deletions

View file

@ -289,16 +289,16 @@ class PydanticAITransformation:
Transform Pydantic AI task response to standard A2A non-streaming format.
Pydantic AI returns a task with history/artifacts, but the standard A2A
non-streaming format expects:
non-streaming format expects ``result`` to be the Message directly
(``kind="message"``), per the A2A spec / ``SendMessageResponse``:
{
"jsonrpc": "2.0",
"id": "...",
"result": {
"message": {
"role": "agent",
"parts": [{"kind": "text", "text": "..."}],
"messageId": "..."
}
"kind": "message",
"role": "agent",
"parts": [{"kind": "text", "text": "..."}],
"messageId": "..."
}
}

View file

@ -90,9 +90,10 @@ class TestPydanticAITransformation:
request_id="req-123",
)
# Should return standard A2A format with message
# Should return standard A2A non-streaming format where `result` is the
# Message itself (kind="message"), per A2A spec / SendMessageResponse.
assert result["jsonrpc"] == "2.0"
assert result["id"] == "req-123"
assert "message" in result["result"]
assert result["result"]["message"]["role"] == "agent"
assert result["result"]["message"]["parts"][0]["text"] == "The answer is 4."
assert result["result"]["kind"] == "message"
assert result["result"]["role"] == "agent"
assert result["result"]["parts"][0]["text"] == "The answer is 4."