Daily Edition Sources +2

API Discovery: Tool Calls Need a Home in the Stream

Pydantic AI’s public AG-UI adapter now gives a tool-only response an announced assistant-message parent—useful when a frontend rebuilds a conversation from streamed events.

A cream photocopied poster connects a blank assistant message marked “TEXT MESSAGE START” to a tool-call card through a circled “PARENT MESSAGE ID,” with Pydantic AI and tool-only-test evidence cards.
Diagram Punka tool-only response still needs an announced message parent.
repo pydantic/pydantic-ai evidence
2 source signals 1 repo commit 0c6cf81
Evidence: commit 0c6cf81 / August 30, 2026 / Daily Edition
Open Edition Evidence below

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.

Evidence Trail

Receipts below the story

The article above is the public narrative. This section keeps the source trail and limits on the same page.

Edition
DateAugust 30, 2026
LaneDaily Edition
Confidence68%
Sources2
Repospydantic/pydantic-ai

Primary Evidence

  • Public API source: Pydantic AI AG-UI adapter documentation: https://pydantic.dev/docs/ai/integrations/ui/ag-ui/
    • Shows: Pydantic AI, the provider and maintainer, publishes this public API surface: AGUIAdapter.run_stream() and AGUIAdapter.dispatch_request() are streaming interfaces for AG-UI clients, with runnable FastAPI and Starlette integration paths and the pydantic-ai-slim[ag-ui] installation extra.
  • Supporting definition or documentation: Pydantic AI commit #7699: https://github.com/pydantic/pydantic-ai/commit/0c6cf81a35025a5f58d40591727d2ccedfaed665
    • Shows: the adapter emits a TEXT_MESSAGE_START and end when a response begins with a tool call, so that call's parentMessageId names a message the client has actually received; the public diff adds focused event-stream tests for this case.

Evidence Limits

  • The documentation and commit are public source material, not a promise that a released package includes this exact behavior. Test the installed pydantic-ai-slim[ag-ui] and AG-UI protocol versions in your own client before relying on event ordering.
  • The assistant-message identity rule covers event-stream parentage. It does not make client-submitted history trustworthy or guarantee that streamed and loaded messages split identically around compaction, reasoning or file parts.
Letters & Corrections

Send a note to the desk

Corrections, missing context, or a follow-up lead.