python Pydantic AI Releases · · 2.46.0

Pydantic-AI v2.46.0 Enhances Type-Safe Models, Tooling, and Real-Time AI Sessions

sdkaigaengineerpython-agentic
feature patch

Pydantic-AI v2.46.0 introduces several new features improving interaction with AI models and real-time functionality. Key enhancements include expanded capabilities for `TypeSafeModel` to fill tool arguments and handle union output types, alongside new real-time session controls like `wait_for_playback()`. The release also adds support for streaming agent events via Workflow Streams and improves model profiling with `supports_text_output`. Numerous bug fixes address issues with tool call dispatch, error handling, and cost accounting in real-time sessions.

  • Let TypeSafeModel fill a tool's arguments when Jev can express them by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8501
  • Add typesafe_boolean_threshold for what a yes/no has to be before it is True by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8505
  • Let TypeSafeModel fill a union of output types by choosing the type first by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8481
  • Add a Choices helper for a set of described options built at run time by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8530
  • Refuse more options than Jev can pick from in TypeSafeModel by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8484
Features (8)
  • Let TypeSafeModel fill a tool's arguments when Jev can express them by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8501
  • Add RealtimeSession.wait_for_playback() and let the docs examples finish the reply before closing by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8141

  • Add supports_text_output to ModelProfile, and run LLMJudge and GEval on a model without it by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8480

  • Add typesafe_boolean_threshold for what a yes/no has to be before it is True by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8505
  • Let TypeSafeModel fill a union of output types by choosing the type first by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8481
  • Add event_stream_topic to TemporalDurability to stream agent events via Workflow Streams by @brianstrauch in https://github.com/pydantic/pydantic-ai/pull/6639

  • Describe an Enum's options by its member docstrings when it mixes in UseEnumMemberDocstrings by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8479

  • Add a Choices helper for a set of described options built at run time by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8530
Fixes (10)
  • Refuse more options than Jev can pick from in TypeSafeModel by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8484
  • Record a failed ToolReturnPart when a realtime tool raises, and keep a tool call and its speech in one ModelResponse by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8135

  • Dispatch tool calls with the live ToolDefinition in CombinedToolset and FunctionToolset by @adtyavrdhn in https://github.com/pydantic/pydantic-ai/pull/8082

  • Allow adaptive thinking with tool output and forced tool choice on Bedrock by @pydanty in https://github.com/pydantic/pydantic-ai/pull/7967
  • Fix gateway IDs being misclassified as OpenAI o-series models by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8512
  • Keep late realtime input transcripts attached to the user turn they belong to by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8139

  • Lay the first-run banner out for the terminal's actual width by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8517
  • Raise ModelRetry when web_fetch_tool gets a URL httpx2 rejects as invalid by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8521
  • Price realtime responses so usage.cost and UsageLimits.cost_limit work in a session by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8136

  • Re-arm coverage for code already seen when the dataclass walk resumes it by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8438
Read the original announcement →

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

Related releases