API discovery: Pydantic AI’s public AG-UI adapter can stream an agent through AGUIAdapter.run_stream() or return a streaming FastAPI or Starlette response through AGUIAdapter.dispatch_request(). Its fresh main-branch event fix closes a very specific hole in that stream: when a response began with a tool call and no text, the tool's parentMessageId named an assistant message the client had never been told existed. The adapter now emits and closes that empty message first.
Try it
Build a small case-triage pane in which the first agent action is a tool-only lookup: fetch account history, then return a written recommendation. Render the empty owning assistant message before the lookup starts, attach the spinner and tool result beneath it, and let the later text continue as the same response. That makes a replayed event stream readable without a client inventing a parent whose ID it cannot match. Pydantic's public docs show the adapter's direct streaming and FastAPI/Starlette entry points; the change is a useful regression test for the UI layer built around them.
Copy-paste agent instruction
In a disposable Pydantic AI AG-UI integration, add a regression test for an agent response whose first output is a tool call and contains no assistant text before it. Consume the event stream and assert that a TEXT_MESSAGE_START appears before the tool call, with a message ID equal to that tool call's parentMessageId; assert the empty message is closed so the run can finish. Wire the test through the documented AGUIAdapter streaming path, pin the installed pydantic-ai-slim[ag-ui] and ag-ui-protocol versions, and do not claim main-branch behavior is released or production-proven.
Test caveat
The public docs and commit are not a release guarantee, and the basic integration still needs your own package versions, server authentication and frontend event handling. The documented adapter also warns that loaded history can split messages differently around compaction, reasoning and files. Treat this as a stream-parentage contract to test, not as proof that every transcript representation is identical or that client-supplied history is trustworthy.