What this thread does
The problem
Routing, streamed cards or graphs changed after upgrading Pydantic AI. This is separate from BaseModel migration.
Versions and licence, checked 2026-10-20
| Package line | Verified status | Practical use |
|---|---|---|
pydantic-ai 2.58.0 | PyPI; uploaded October 20; GitHub release heading says October 19 | Target release for this audit |
| 2.57.0 | Previous minor; GitHub heading October 15, PyPI upload October 16 | Compare behavior before the upgrade |
| 1.107.8 | 1.x release on GitHub, heading October 19 | Intermediate deprecation cleanup |
PyPI lists MIT and Python >=3.11. Releases, 1.x release, 2.57 and 2.58 checked 2026-10-20. Headings and uploads differ; prices unverified.
What the October 2026 target minors changed
2.57 adds MetaProvider and fixes unavailable OpenAI Responses tool-choice names and Gemini thought-signature forwarding through OpenAIChatModel. Test a streamed tool round, not just construction. 2.57 release, checked 2026-10-20.
2.58 adds whole-run timeout=, per-request request_timeout, SDK max_retries, and an openai-chatgpt provider. Unsupported settings warn; unenforceable native-tool constraints make tools unsupported. DBOS Planning workflows with event-stream handlers may not recover: finish them or version the DBOS application. Realtime completion now marks an exchange; use PartEndEvents for response endings. 2.58 release, checked 2026-10-20.
The 1→2 changes to map explicitly
| Old usage or assumption | Replacement / decision |
|---|---|
openai: means Chat Completions | It now means Responses; use openai-chat: to retain Chat Completions or openai-responses: explicitly |
Agent constructor event_stream_handler, prepare_tools, history_processors | capabilities=[ProcessEventStream(...), PrepareTools(...), ProcessHistory(...)] as applicable |
GeminiModel, OpenAIModel | GoogleModel, OpenAIChatModel |
| GoogleProvider with Vertex-specific arguments | GoogleCloudProvider; review provider prefixes too |
result.usage(), result.timestamp() | Properties result.usage, result.timestamp |
FunctionToolResultEvent.result | .part; output tools now have their own output events |
async for ... in agent.run_stream_events(...) | Enter its async context manager before iterating |
pydantic_graph.beta.GraphBuilder | Import GraphBuilder from pydantic_graph |
These mappings come from the official migration map, checked 2026-10-20. Per-run event_stream_handler remains supported. This table is not exhaustive.
The upgrade guide, checked 2026-10-20, documents unwarned changes too. Default end_strategy becomes graceful: companion function tools can now execute side effects. Profiles become TypedDicts; generic defaults become object. Graph persistence and standalone Mermaid modules disappear; use Graph.render() for diagrams. V1 message history still deserializes; that does not prove snapshot compatibility.
Ordered migration
1. Preserve lockfile and saved messages/checkpoints in a branch. Inventory python -m pip show pydantic-ai pydantic-ai-slim pydantic-graph. Below are pip examples for an isolated environment; retain your dependency manager. 2. Use python -m pip install "pydantic-ai==1.107.8", then resolve warnings from existing tests, e.g. python -W default -m pytest. 3. Add providers omitted by slimmer defaults. Bedrock/Groq example: python -m pip install "pydantic-ai[bedrock,groq]==2.58.0". For a minimal OpenAI install, use python -m pip install "pydantic-ai-slim[openai]==2.58.0" instead. Names/extras follow the installation guide, checked 2026-10-20; pins follow the releases above. 4. Apply the table. Keep Chat Completions explicit for compatible gateways. Retain end_strategy='early' if companion tools must be skipped; test graceful side effects with fakes. 5. Rebuild legacy graphs with GraphBuilder. Snapshots have no drop-in graph equivalent. Evaluate Harness StepPersistence separately for agent save/resume/fork; do not merely rename snapshot imports. Graph removal PR by dmontagu, checked 2026-10-20. 6. Run tests, python -m pip check, and verify versions. Finish or version affected durable workflows before rollout.
Verified diagnostic and concrete breakages
Unknown model with a prefix-less name. The tagged source constructs Unknown model: {model}, optionally with a suggestion. The fallback was removed. Inspect rg -n 'Agent\(' ., add a provider prefix and rerun tests. Use openai-chat: to preserve Chat Completions; bare openai: changes the endpoint. Tagged source and removal PR by dsfaccini, checked 2026-10-20. Template verified; no traceback reproduced.
Graph imports and streamed tool cards. Modules and event fields changed. Use rg -n 'pydantic_graph\.(beta|persistence|mermaid)|event\.result|usage\(\)' . to find candidates, migrate from linked sources and test full tool/graph runs. Do not invent shim modules or rely on type-checking alone. Exact exception strings are unverified.
Community evidence
- In r/PydanticAI's migration discussion, author skvark reports agents lack current API knowledge and promotes a docs-access tool. A self-identified Pydantic AI maintainer says their Logfire agents migrated using the changelog. The promoted tool is optional.
- vstorm-co reports tool-result crashes from reading
.resultinstead of.part, hidden by an untyped event. The migration map confirms the rename. Both pages checked 2026-10-20. No success rate verified.
What to test and mistakes to avoid
Test text, structured output, tool success/failure, streamed cards, cancellation, old messages and graphs. Count fake side effects alongside output tools. Assert provider/API and extras; test DBOS recovery separately from fresh runs.
| Constraint | Recommendation |
|---|---|
| Existing app still has deprecations | Clean up on 1.107.8 first |
| Gateway accepts Chat Completions only | Keep openai-chat: explicitly |
| Old graph snapshots are essential | Design persistence migration before changing production |
| Already on 2.57 | Focus on 2.58 native-tool constraints, timeouts, realtime events and durable recovery |
A prompt to give your agent
Read the linked upgrade guide, migration map and target release notes; do not guess APIs from memory or BaseModel docs. Inventory providers, Agent kwargs, events and graph persistence. Plan edits per file; preserve API routing and extras. Run existing tests with warnings and fake tools. Report observed errors and gaps; leave production untouched.
Limits
No installs, provider requests or migrations were run; commands are proposed. Exact TypeError/ImportError/AttributeError strings for removed kwargs, graph modules, usage calls and event fields are unverified. Evidence is a small Reddit discussion and a downstream changelog; engagement thresholds and recent-minor independent confirmations are unverified. Costs, performance and checkpoint compatibility were not tested.
Started from a post by @pydantic, packaged by the editor. Original post