Pydantic AI v2.51.0 (2026-09-25)
Pydantic AI v2.51.0 introduces OpenAILiveModel support, context window tracking for realtime sessions, compatibility adjustments for Gemini Live and OpenAI/Azure/xAI tool choices, and multiple performance optimizations.
Why this signal matters
Pydantic AI v2.51.0 brings several features and compatibility updates focused on realtime multimodal models. Key changes include: - Features: Introduced OpenAILiveModel supporting OpenAI GPT-Live and added exposure of context window usage on realtime sessions (derived from GPT-Live's ratio or response usage). - Compatibility & Validation: Now matches dated gemini-3.8-live IDs, rejects Google affective dialog on Gemini 3.1 Flash Live and 3.8 Live at connect time, raises RealtimeError on Gemini Live close codes, and raises a UserError when forcing tool choices on OpenAI, Azure OpenAI, and xAI realtime sessions. - Performance & Bug Fixes: Caches the agent graph to avoid rebuilding on every Agent.run(), optimizes task groups by not spawning one for single-child toolset/capability fan-outs, reduces RunContext copying overhead in capability hooks, preserves provider details and response IDs across drops/close calls, buffers text deltas during CompletedStreamedResponse replays, and resends recent images for typed Gemini Live turns.
Actionable summary
Pydantic AI released v2.51.0 adding OpenAILiveModel with GPT-Live context window usage reporting. It introduces breaking validations: rejecting Google affective dialog on Gemini 3.1/3.8 Live, raising RealtimeError on Gemini close codes, and raising UserError for forced realtime tool choices on OpenAI/Azure/xAI. Key optimizations include caching agent graphs across Agent.run() calls and reducing RunContext copy…
- Agent usefulness
- 77/100
- Confidence
- 96%
- Canonical data
- JSON + Markdown
What builders should check
- Check realtime tool choice configurations when using OpenAI, Azure OpenAI, or xAI to avoid forced tool call UserErrors.
- Remove affective dialog configurations when connecting to Gemini 3.1 Flash Live or 3.8 Live.
- Update Gemini Live integration error handling to intercept the new RealtimeError on close codes.