python Pydantic AI Releases · · 2.38.1

Pydantic-AI v2.38.1 Adds Gemini/Claude Models, vLLM Support, and Context Window Features

sdkaigaengineerpython-agentic
breaking feature patch

Pydantic-AI v2.38.1 introduces support for new large language models, including `gemini-3.8-flash`, Claude Fable 5.1, and Claude Mythos 5.1, alongside a new `VLLMProvider` for vLLM servers. This release also adds `context_window` management features to `ModelProfile` and enables application code to emit typed custom events into the run stream. It includes several bug fixes, particularly around tool call handling and provider interactions, while also noting a compatibility change for one-off capabilities. These updates enhance the framework's AI integration capabilities and address various operational issues for developers.

  • Add context_window to ModelProfile and context_window_used to RunContext by @adtyavrdhn in https://github.com/pydantic/pydantic-ai/pull/4611
  • Add profile flag to reject streams without finish_reason by @jonashaag in https://github.com/pydantic/pydantic-ai/pull/7096
  • Add gemini-3.8-flash model by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/8021
  • Add VLLMProvider for vLLM servers by @adtyavrdhn in https://github.com/pydantic/pydantic-ai/pull/6153
  • Support CancellationToken in UI adapter run methods by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/7743
Features (6)
  • Add context_window to ModelProfile and context_window_used to RunContext by @adtyavrdhn in https://github.com/pydantic/pydantic-ai/pull/4611
  • Add profile flag to reject streams without finish_reason by @jonashaag in https://github.com/pydantic/pydantic-ai/pull/7096
  • Add gemini-3.8-flash model by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/8021
  • Let application code and capabilities emit typed CustomEvents and CapabilityEvents into the run event stream and subscribe with @on_event by @DouweM in https://github.com/pydantic/pydantic-ai/pull/6258

  • Add Claude Fable 5.1 (claude-fable-5-1) and Claude Mythos 5.1 (claude-mythos-5-1) support by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/7989

  • Add VLLMProvider for vLLM servers by @adtyavrdhn in https://github.com/pydantic/pydantic-ai/pull/6153
Fixes (12)
  • Support CancellationToken in UI adapter run methods by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/7743
  • Stop pytest tests/durable_exec/temporal from crashing when the suite's requirements are missing by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/7898

  • Fix DeepSeek and Together forced tool_choice handling and support NativeOutput on DeepSeek's Responses API by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/7450

  • Restore raw tool-call IDs when replaying Bedrock Mantle Responses history by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/7962
  • Keep a run cancelled during its first tool call resumable by @DouweM in https://github.com/pydantic/pydantic-ai/pull/7993
  • Fix CodeExecutionTool uploads never reaching a fresh Anthropic container on a multi-turn history by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/7864

  • Prevent synthetic reasoning IDs from reaching OpenAI Responses by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/8020
  • Emit REASONING_* events from ag-ui-protocol 0.1.11 instead of 0.1.13 by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/7226
  • Accept the environment-key call pattern in GoogleProvider's overload by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/8030
  • Fix XaiModel streamed text after a native tool call being merged into the ended pre-call part by @pydanty in https://github.com/pydantic/pydantic-ai/pull/7925

  • Persist Anthropic stale thinking-block recovery across turns by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/8037
  • Preserve dynamic native factory config in XSearch and ImageGeneration fallback subagents by @CoralGarden52 in https://github.com/pydantic/pydantic-ai/pull/7541

Maintenance (1)
  • Bump genai-prices to 0.1.6 by @adtyavrdhn in https://github.com/pydantic/pydantic-ai/pull/8019
Read the original announcement →

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

Related releases