Symptom
A response that contains only tool calls emits TOOL_CALL_START whose parentMessageId matches no TEXT_MESSAGE_START in the stream.
Evidence what you'll see
- Replaying that history uses the synthetic id, while the next text response gets a different
TEXT_MESSAGE_STARTid, so the old tool call and its result are sent again. - The report traces the id to
before_response()and_handle_tool_call_start()on version2.31.0.
Why it happens
before_response() makes a fresh message id and the tool-call event uses it as parentMessageId, but the stream emits TEXT_MESSAGE_START only when the response has a TextPart.
Affected versions
Pydantic AI 2.31.0. The linked issue does not name an operating system or a Python version.
Fix steps
0 of 1 done
Your check marks stay in this browser only.
How to check it worked
- Stream a tool-only response and confirm
TOOL_CALL_START'sparentMessageIdequals themessageIdof aTEXT_MESSAGE_STARTbefore it.
If it still fails
- The pull request says
AGUIAdapter.load_messagesdrops the empty text, so reloaded history is unchanged. The linked issue does not describe an unannounced parent onv2.37.0.
Sources and credit
Summarized in our own words from these public reports. Credit goes to their authors.
Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change
Hit an error we don't cover? Submit it