What this thread does
Set manage_message_history='server' when your Pydantic UI endpoint already loads the conversation from server storage.
What changed
The 2.63.0 release adds history ownership to UI adapters. PyPI lists the package uploaded October 28, 2026, MIT, Python >=3.11; checked 2026-10-28.
Do first: python -m pip show pydantic-ai
1. Check your installed package with python -m pip show pydantic-ai. This recipe targets 2.63.0. 2. Trace where your endpoint loads old messages. If it already restores the full conversation, select server ownership. 3. Save result.all_messages() from the adapter's completion callback. Pass that saved history into the next adapter request. The existing request, agent, stored_history and save_history below are your endpoint's objects:
from pydantic_ai.ui.vercel_ai import VercelAIAdapter
response = await VercelAIAdapter.dispatch_request(
request,
agent=agent,
message_history=stored_history,
manage_message_history='server',
on_complete=save_history,
)
4. Try a three-turn chat, then edit and regenerate a turn. Inspect the model input and require one copy of each intended prior turn. In an AI SDK client, exercise regenerate() and sendMessage({ messageId }) for the regeneration and edit checks. Check a cancelled run separately. To retain a cancelled run, save RunCancelled.all_messages() in on_cancel; a client disconnect invokes neither callback. Keep conversation lookup tied to the authenticated user. If an errored or stopped turn was never stored, resend its user message as a new turn with sendMessage instead of regenerating it.
The official UI guide supplies the full persistence example and cautions about histories ending with an unanswered request after cancellation. The code above is an integration fragment, not a complete server.
Pick the ownership setting
| Setting | What it is for; when it wins | When it loses; limit checked 2026-10-28 | Pick this if |
|---|---|---|---|
server | Your stored conversation is authoritative | Edit/regenerate matching needs UI message IDs retained in adapter-produced history | You already persist complete adapter results |
client | The browser supplies history; optional server context is prepended | Also passing the same full conversation duplicates turns; this is the default | Your server adds only distinct context |
These behaviors are documented in the UI adapter reference. No savings amount is promised: compare actual request contents and provider usage before and after.
Recommendation by constraint
For a solo prototype without persistence, keep client ownership. For a small team adding persistence, choose server ownership and test edits before rollout. For an enterprise endpoint, choose server ownership and include ownership checks and cancelled-turn recovery in the acceptance review. These are implementation recommendations, not separate product tiers.
Evidence
PR #11431, DouweM, October 26, 2026, describes the prior behavior: “sends every earlier turn to the model twice.” It merged October 27. This is maintainer implementation evidence. The PR reports production AG-UI testing by rscholz98 that exposed a tool-result edge case.
Prompt for your agent
Locate the UI adapter endpoint and identify who owns history. Preserve adapter message IDs, enable server ownership only if the complete history is stored, and demonstrate send, edit, regenerate and cancellation without duplicated turns.
Mistakes
Do not combine complete client and server histories under client ownership. Do not rebuild saved messages in a way that drops UI IDs and then expect regeneration matching to work.
Limits
No application was run. The history setting does not replace endpoint authorization. This is a feature setup recipe for 2.63.0, not a complete migration guide from an earlier major; review the official upgrade guide separately before changing a production dependency.
Started from a post by @DouweM, packaged by the editor. Original post