github pydantic/pydantic-ai v2.38.0
v2.38.0 (2026-09-02)

4 hours ago

What's Changed

🚀 Features

  • Add context_window to ModelProfile and context_window_used to RunContext by @adtyavrdhn in #4611
  • Add profile flag to reject streams without finish_reason by @jonashaag in #7096
  • Add gemini-3.8-flash model by @dsfaccini in #8021
  • Let application code and capabilities emit typed CustomEvents and CapabilityEvents into the run event stream and subscribe with @on_event by @DouweM in #6258
  • Add Claude Fable 5.1 (claude-fable-5-1) and Claude Mythos 5.1 (claude-mythos-5-1) support by @dsfaccini in #7989

🐛 Bug Fixes

  • Support CancellationToken in UI adapter run methods by @dsfaccini in #7743
  • Stop pytest tests/durable_exec/temporal from crashing when the suite's requirements are missing by @dsfaccini in #7898
  • Fix DeepSeek and Together forced tool_choice handling and support NativeOutput on DeepSeek's Responses API by @dsfaccini in #7450
  • Restore raw tool-call IDs when replaying Bedrock Mantle Responses history by @dsfaccini in #7962
  • Keep a run cancelled during its first tool call resumable by @DouweM in #7993
  • Fix CodeExecutionTool uploads never reaching a fresh Anthropic container on a multi-turn history by @dsfaccini in #7864
  • Prevent synthetic reasoning IDs from reaching OpenAI Responses by @dsfaccini in #8020
  • Emit REASONING_* events from ag-ui-protocol 0.1.11 instead of 0.1.13 by @dsfaccini in #7226
  • Accept the environment-key call pattern in GoogleProvider's overload by @dsfaccini in #8030
  • Fix XaiModel streamed text after a native tool call being merged into the ended pre-call part by @pydanty in #7925
  • Persist Anthropic stale thinking-block recovery across turns by @dsfaccini in #8037

📦 Dependencies

New Contributors

Full Changelog: v2.37.0...v2.38.0

Don't miss a new pydantic-ai release

NewReleases is sending notifications on new releases.