python Pydantic AI Releases · · 2.51.0

pydantic-ai v2.51.0 Adds OpenAI GPT-Live Support and Refines AI Model Compatibility

sdkaiazureengineerpython-agentic
breaking feature patch

pydantic-ai v2.51.0 introduces support for OpenAI GPT-Live through `OpenAILiveModel` and exposes `context_window_used` on realtime sessions, providing better visibility into token usage. The update also includes compatibility adjustments for Gemini 3.1 Flash Live and 3.8 Live, specifically rejecting dated IDs and raising `RealtimeError` for close codes. Additionally, it improves error handling by raising `UserError` for forced tool calls in OpenAI, Azure OpenAI, and xAI models, alongside several bug fixes.

  • →Add OpenAI GPT-Live support with OpenAILiveModel by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8390
  • →Reduce RunContext copying overhead in capability hooks by @Kludex in https://github.com/pydantic/pydantic-ai/pull/8775
  • →Buffer text deltas in CompletedStreamedResponse replay by @Kludex in https://github.com/pydantic/pydantic-ai/pull/8799
  • →Cache the agent graph instead of rebuilding it on every Agent.run() by @Kludex in https://github.com/pydantic/pydantic-ai/pull/8658
Features (2) ›
  • Add OpenAI GPT-Live support with OpenAILiveModel by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8390
  • Expose context_window_used on realtime sessions, from GPT-Live's reported ratio or response usage by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8803

Fixes (6) ›
  • Reduce RunContext copying overhead in capability hooks by @Kludex in https://github.com/pydantic/pydantic-ai/pull/8775
  • Keep provider_details on OpenAI Realtime tool-call responses and the response id on replies cut off by a drop or close() by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8762

  • Buffer text deltas in CompletedStreamedResponse replay by @Kludex in https://github.com/pydantic/pydantic-ai/pull/8799
  • Resend a recent image with a typed Gemini Live turn, which doesn't see video frames by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8756

  • Cache the agent graph instead of rebuilding it on every Agent.run() by @Kludex in https://github.com/pydantic/pydantic-ai/pull/8658
  • Stop spawning a task group when a toolset or capability fan-out has a single child by @Kludex in https://github.com/pydantic/pydantic-ai/pull/8774

Read the original announcement →

https://github.com/pydantic/pydantic-ai/releases/tag/v2.51.0

Related releases