Pydantic AI v2.51.0 (2026-09-25) adds OpenAILiveModel for OpenAI GPT-Live, exposes context_window_used on realtime sessions, tightens Gemini Live id/affective-dialog checks, and raises UserError for forced realtime tool_choice on OpenAI/Azure/xAI. PyPI pydantic-ai 2.51.0 is live.
- ✓Shipped: GitHub v2.51.0 = PyPI pydantic-ai 2.51.0; docs pydantic.dev/docs/ai
- ✓Realtime: OpenAILiveModel for GPT-Live; context_window_used on sessions from GPT-Live ratio or response usage
- ✓Compat: match dated gemini-3.8-live ids; reject google_affective_dialog at connect; RealtimeError on Gemini Live close codes
- ✓Safety: UserError for forced realtime tool_choice on OpenAI/Azure OpenAI/xAI
- ✓Perf: cache agent graph across Agent.run(); skip task group for single-child fan-out
🔗
Project Links & Resources
Direct AccessDirect access to official project resources and documentation🔬
In-Depth Technical Analysis
Background Typed agent frameworks need one Python API for structured output and realtime voice/multimodal sessions. Pain points: GPT-Live vs Gemini Live connection semantics, opaque context-window usage, dated model ids / Affective Dialog params failing mid-run, and inconsistent forced realtime tool_choice. Pydantic AI v2.51.0 (2026-09-25) follows 2.50.0's DecisionModel with Live coverage and stricter connect-time checks. ### Architecture OpenAILiveModel adds OpenAI GPT-Live (#8390). Realtime sessions expose context_window_used from GPT-Live's reported ratio or response usage (#8803). Gemini Live: match dated gemini-3.8-live ids, reject google_affective_dialog at connect for 3.1/3.8 Flash Live, raise RealtimeError on close codes (#8761). Forced realtime tool_choice on OpenAI/Azure OpenAI/xAI raises UserError (#8755). Perf: cache the agent graph across Agent.run() (#8658); skip task groups for single-child fan-out (#8774); cut RunContext copy overhead in capability hooks (#8775). ### Benchmarks No official SWE/AgentBench numbers. Use context_window_used and connect-failure rates on your own Live suites when comparing 2.50.0→2.51.0. ### Getting started pip install -U pydantic-ai==2.51.0. Docs: pydantic.dev/docs/ai. Use OpenAILiveModel for GPT-Live; for Gemini Live use dated ids and drop google_affective_dialog. Avoid forced realtime tool_choice. Full notes: GitHub release v2.51.0.
Discussion & Comments
0Sign in to join the discussion
Connect with AI developers to exchange benchmark insights.