Skip to content

Releases: pydantic/pydantic-ai

v2.3.0 (2026-07-01)

Choose a tag to compare

@dsfaccini dsfaccini released this 02 Jul 02:09
fb3c19c

What's Changed

πŸš€ Features

πŸ› Bug Fixes

  • fix(test): set provider_name on TestModel non-streaming responses by @syf2211 in #6066
  • Keep Bedrock tool results non-empty for empty lists by @Whning0513 in #6155
  • fix(huggingface): don't silently drop file content in tool returns by @HaozheZhang6 in #5881
  • fix: skip OpenAI thinking-only chat history messages by @adtyavrdhn in #6182
  • Don't send defer_loading without tool_search on models without native tool search by @adtyavrdhn in #6144
  • Route remaining instrumentation serialization through safe_to_json by @dsfaccini in #6073
  • fix: reconstruct multimodal ToolReturnPart.content via a ToolReturnContent discriminator by @DouweM in #6191
  • Fix AGUIAdapter.dump_messages reordering ToolReturnPart after UserPromptPart by @amarjaleelbanbhan in #5969
  • fix: track new_messages() boundary by position so a rebuilt resumed request isn't leaked by @klplentific in #6034
  • Preserve tool_kind in Vercel AI and AG-UI message round-trips by @adtyavrdhn in #5873
  • Make durable-exec MCP get_tools caching replay-deterministic by @dsfaccini in #5883
  • Preserve FilePart.content.vendor_metadata in AG-UI and Vercel AI adapter round-trips by @Navaneethp007 in #6095
  • Resolve dynamic toolset get_instructions in an activity under Temporal by @dsfaccini in #5925

New Contributors

Full Changelog: v2.2.0...v2.3.0

v2.2.0 (2026-06-30)

Choose a tag to compare

@dsfaccini dsfaccini released this 01 Jul 00:01
a207fe1

What's Changed

πŸš€ Features

  • feat: add TwelveLabs Pegasus video-understanding example by @mohit-twelvelabs in #6061
  • Add Claude Sonnet 5 (claude-sonnet-5) support by @dsfaccini in #6161
  • Allow factory functions as lifecycle arg for Dataset.evaluate by @nlsfnr in #6107
  • feat: Add prompt and completions cost fields to OpenRouter by @ali-corpo in #4899
  • feat: add retry_options parameter to GoogleProvider by @graydeon in #4966

πŸ› Bug Fixes

  • Forward image detail from vendor_metadata for GroqModel and MistralModel by @pydanty[bot] in #6014
  • fix(utils): run sync callbacks inline on Pyodide/emscripten by default by @syf2211 in #6088
  • Fix group_by_temporal emitting first item alone when delayed past soft_max_interval by @pydanty[bot] in #5947
  • Fix missing output_audio_tokens in usage accumulation by @jnMetaCode in #4594
  • fix(heroku): route model names through family profiles so thinking isn't dropped by @Bartok9 in #6070
  • Guard TogetherProvider.model_profile against model names without a / by @immuhammadfurqan in #6113
  • fix(GoogleModel): include CodeExecutionTool in include_server_side_tool_invocations check by @aarsh767 in #6052
  • fix(groq): surface reasoning_tokens in usage details by @tcconnally in #5986
  • Fix map downstream_join_id double-firing the join on a non-empty iterable by @clavedeluna in #6009
  • fix: de-duplicate output_audio_tokens accumulation in _incr_usage_tokens by @dsfaccini in #6141
  • Suppress ClosedResourceError when cancelling a graph run mid-send by @conradlee in #6149
  • fix(ui): round-trip file vendor_metadata through Vercel AI & AG-UI adapters by @Bartok9 in #5790
  • Handle CRLF markdown JSON fences in strip_markdown_fences by @CodingFeng101 in #6090
  • fix(heroku): avoid duplicating /v1 in base_url by @VectorPeak in #6142
  • Fix absolute schema_path handling in Dataset.to_file by @VectorPeak in #6143
  • Fix deps deserialization in non-streaming Temporal model-request activity by @dsfaccini in #5900

New Contributors

Full Changelog: v2.1.0...v2.2.0

v2.1.0 (2026-06-29)

Choose a tag to compare

@adtyavrdhn adtyavrdhn released this 29 Jun 09:39
b2124d0

What's Changed

πŸš€ Features

  • feat: Add Anthropic _20260209 web tools with server-tool replay by @adtyavrdhn in #4844
  • Serialize instrumentation message attributes with to_json instead of json.dumps by @Kludex in #6045
  • Add TypeAdapter for EvaluatorContext by @hon-gyu in #3373

πŸ› Bug Fixes

  • Convert ExceptionGroup-wrapped tool errors to ModelRetry in MCPToolset by @dmontagu in #6004
  • fix: prevent cancel() from flipping complete state on finished stream by @Oxygen56 in #5795
  • fix(temporal): add return type annotation to PydanticAIPlugin.__init__ by @syf2211 in #6065
  • fix(anthropic): support Bedrock token counting by @dyscott in #5480

New Contributors

Full Changelog: v2.0.0...v2.1.0

v2.0.0 (2026-06-23)

Choose a tag to compare

@dsfaccini dsfaccini released this 23 Jun 15:38
e19e180

πŸŽ‰ Pydantic AI V2.0 is here!

After seven betas, Pydantic AI V2 is now stable. V2 leans into a harness-first design with capabilities as a core primitive β€” a single composable unit that bundles an agent's tools, hooks, instructions, and model settings, reaching every layer of the agent through one concept.

Install it with:

uv add pydantic-ai

See the Upgrade Guide for everything that's changed and the recommended path from V1.


What's Changed

πŸš€ Features

πŸ› Bug Fixes

  • Don't send Gemini function_calling_config without function declarations by @glendigity in #5791
  • fix(openai): map image UploadedFile parts to input_image by @Oxygen56 in #5809
  • Fix unified thinking handling for Groq qwen3 and Cerebras gpt-oss by @dsfaccini in #5850
  • Disallow non-finite Evaluator outputs by @alexmojaki in #5863
  • Fix AnthropicModel.count_tokens divergence on ToolSearchTool replay history by @dsfaccini in #5855
  • Send reasoning_content on synthesized tool-call turns for DeepSeek thinking models by @adtyavrdhn in #5842
  • Validate UploadedFile.provider_name in tool returns and consolidate the guard into Model._validate_uploaded_file_provider by @Oxygen56 in #5860
  • Replay Cerebras zai-glm reasoning in <think> tags and bump to zai-glm-4.7 by @dsfaccini in #5891
  • Retain dropped usage fields across GoogleModel streaming chunks by @dsfaccini in #5886
  • Accumulate output_audio_tokens in RunUsage by @HaozheZhang6 in #5904
  • fix(output): validate union kind discriminator in text output by @ret2libc in #5845
  • fix(openai): prevent AG-UI stalls during multi-server MCP discovery by @cooleryu in #5443
  • Forward additionalModelRequestFields in Bedrock count_tokens by @dsfaccini in #5910
  • Fix MCPToolset(http_client=...) crash on FastMCP's follow_redirects kwarg by @he-yufeng in #5694
  • fix(cohere): forward tool_choice from ModelSettings to v2 chat API by @Julien-ser in #5833
  • Route max_tokens to max_completion_tokens or max_tokens via OpenAIModelProfile flag by @dsfaccini in #5926
  • Forward top_k model setting to Bedrock additionalModelRequestFields by @dsfaccini in #5922
  • Fix FallbackModel declaring an unassigned _model_name dataclass field by @dorukgezici in #5932
  • fix(groq): add groq_reasoning_effort setting by @Oxygen56 in #5797
  • fix: use running loop in chat app example by @Ghraven in #5971
  • fix(cohere): forward usage.cached_tokens as cache_read_tokens by @bdpgmbv in #5957
  • fix(mistral): forward penalties in completions by @he-yufeng in #5695
  • Emit reasoning_effort='none' for Cerebras, deprecate cerebras_disable_reasoning, add cerebras_clear_thinking by @dsfaccini in #5897

New Contributors

Full Changelog: v2.0.0b7...v2.0.0

v2.0.0b7 (2026-06-10)

v2.0.0b7 (2026-06-10) Pre-release
Pre-release

Choose a tag to compare

@dsfaccini dsfaccini released this 10 Jun 14:54

πŸš€ Pydantic AI V2 Beta 7 is here!

For more information on Pydantic AI V2, see the release notes for v2.0.0b1 and the Upgrade Guide.

Beta 7 adds no new breaking or v2-specific changes, but pulls in these changes from v1.107.0:

What's Changed

πŸ›‘οΈ Security

  • Handle UploadedFile consistently with FileUrl in UI adapters by @dsfaccini in #5772
    • Security advisory: VercelAIAdapter trusts client-controlled provider metadata to construct UploadedFile references (confused-deputy file read) GHSA-h7p7-w5gc-xj3w
    • This fix went out in v1.106.0 and v2.0.0b6.
    • You are affected only if your application passes untrusted client-submitted message history to an agent through a UI adapter (e.g. VercelAIAdapter), AND your model-provider or cloud-storage account holds files referenceable by an attacker-guessable UploadedFile id or storage URI (e.g. s3://…, gs://…).
    • You are not affected if you do not pass untrusted client-submitted message history to the agent, or you strip UploadedFile parts before running it.
    • You are not affected via AGUIAdapter / Agent.to_ag_ui on defaults β€” the preserve_file_data flag that re-enables this path is off by default.

πŸš€ Features

  • Add known_model_names() to enumerate KnownModelName members by @dsfaccini in #5803
  • feat(openrouter): add CachePoint and prompt caching support by @Adversarian in #4604
  • Add Claude Fable 5 (claude-fable-5) and Claude Mythos 5 (claude-mythos-5) support by @dsfaccini in #5849

πŸ› Bug Fixes

  • fix(anthropic): guard message=None Bedrock start events in stream path by @Bartok9 in #5818
  • Fix AnthropicModel.count_tokens with native tools by @kazmer97 in #5704

πŸ“¦ Dependencies

  • chore(deps): bump the python-packages group across 1 directory with 18 updates by @dependabot[bot] in #5768

New Contributors

Full Changelog: v2.0.0b6...v2.0.0b7

v1.107.0 (2026-06-10)

Choose a tag to compare

@dsfaccini dsfaccini released this 10 Jun 14:40
b1d7af9

What's Changed

πŸ›‘οΈ Security

  • Handle UploadedFile consistently with FileUrl in UI adapters by @dsfaccini in #5772
    • Security advisory: VercelAIAdapter trusts client-controlled provider metadata to construct UploadedFile references (confused-deputy file read) GHSA-h7p7-w5gc-xj3w
    • This fix went out in v1.106.0 and v2.0.0b6.
    • You are affected only if your application passes untrusted client-submitted message history to an agent through a UI adapter (e.g. VercelAIAdapter), AND your model-provider or cloud-storage account holds files referenceable by an attacker-guessable UploadedFile id or storage URI (e.g. s3://…, gs://…).
    • You are not affected if you do not pass untrusted client-submitted message history to the agent, or you strip UploadedFile parts before running it.
    • You are not affected via AGUIAdapter / Agent.to_ag_ui on defaults β€” the preserve_file_data flag that re-enables this path is off by default.

πŸš€ Features

  • Add known_model_names() to enumerate KnownModelName members by @dsfaccini in #5803
  • feat(openrouter): add CachePoint and prompt caching support by @Adversarian in #4604
  • Add Claude Fable 5 (claude-fable-5) and Claude Mythos 5 (claude-mythos-5) support by @dsfaccini in #5849

πŸ› Bug Fixes

  • fix(anthropic): guard message=None Bedrock start events in stream path by @Bartok9 in #5818
  • Fix AnthropicModel.count_tokens with native tools by @kazmer97 in #5704

πŸ“¦ Dependencies

  • chore(deps): bump the python-packages group across 1 directory with 18 updates by @dependabot[bot] in #5768

New Contributors

Full Changelog: v1.106.0...v1.107.0

v2.0.0b6 (2026-06-04)

v2.0.0b6 (2026-06-04) Pre-release
Pre-release

Choose a tag to compare

@dsfaccini dsfaccini released this 05 Jun 01:45

πŸš€ Pydantic AI V2 Beta 6 is here!

For more information on Pydantic AI V2, see the release notes for v2.0.0b1 and the Upgrade Guide.

Beta 6 adds no new breaking or v2-specific changes, but pulls in these changes from v1.106.0:

What's Changed

πŸ›‘οΈ Security

  • Handle UploadedFile consistently with FileUrl in UI adapters by @dsfaccini in #5772
    • Security advisory: VercelAIAdapter trusts client-controlled provider metadata to construct UploadedFile references (confused-deputy file read) GHSA-h7p7-w5gc-xj3w
    • You are affected only if your application passes untrusted client-submitted message history to an agent through a UI adapter (e.g. VercelAIAdapter), AND your model-provider or cloud-storage account holds files referenceable by an attacker-guessable UploadedFile id or storage URI (e.g. s3://…, gs://…).
    • You are not affected if you do not pass untrusted client-submitted message history to the agent, or you strip UploadedFile parts before running it.
    • You are not affected via AGUIAdapter / Agent.to_ag_ui on defaults β€” the preserve_file_data flag that re-enables this path is off by default.

πŸš€ Features

πŸ› Bug Fixes

  • Fix incomplete streamed response when event_stream_handler doesn't consume the stream by @adtyavrdhn in #5771
  • fix(messages): from_data_uri crashes on a valid non-base64 data URI by @devteamaegis in #5779

New Contributors

Full Changelog: v2.0.0b5...v2.0.0b6

v1.106.0 (2026-06-04)

Choose a tag to compare

@dsfaccini dsfaccini released this 05 Jun 01:16
1b42945

What's Changed

πŸ›‘οΈ Security

  • Handle UploadedFile consistently with FileUrl in UI adapters by @dsfaccini in #5772
    • Security advisory: VercelAIAdapter trusts client-controlled provider metadata to construct UploadedFile references (confused-deputy file read) GHSA-h7p7-w5gc-xj3w
    • You are affected only if your application passes untrusted client-submitted message history to an agent through a UI adapter (e.g. VercelAIAdapter), AND your model-provider or cloud-storage account holds files referenceable by an attacker-guessable UploadedFile id or storage URI (e.g. s3://…, gs://…).
    • You are not affected if you do not pass untrusted client-submitted message history to the agent, or you strip UploadedFile parts before running it.
    • You are not affected via AGUIAdapter / Agent.to_ag_ui on defaults β€” the preserve_file_data flag that re-enables this path is off by default.

πŸš€ Features

πŸ› Bug Fixes

  • Fix incomplete streamed response when event_stream_handler doesn't consume the stream by @adtyavrdhn in #5771
  • fix(messages): from_data_uri crashes on a valid non-base64 data URI by @devteamaegis in #5779

New Contributors

Full Changelog: v1.105.0...v1.106.0

v2.0.0b5 (2026-06-02)

v2.0.0b5 (2026-06-02) Pre-release
Pre-release

Choose a tag to compare

@dsfaccini dsfaccini released this 02 Jun 06:23

πŸš€ Pydantic AI V2 Beta 5 is here!

For more information on Pydantic AI V2, see the release notes for v2.0.0b1 and the Upgrade Guide.

Beta 5 adds no new breaking or v2-specific changes, but pulls in these changes from v1.105.0:

What's Changed

πŸš€ Features

  • feat: On-demand (deferred loading) capabilities, including instructions, tools, model settings, and hooks by @adtyavrdhn in #5230
  • Add Grok 4.3 reasoning_effort support and current xAI model names by @adtyavrdhn in #5454

πŸ› Bug Fixes

  • Fix gateway/ model construction inside a Temporal workflow by passing provider SDKs through the sandbox by @adtyavrdhn in #5733
  • Fix GoogleModelSettings.google_cached_content so request omits system_instruction, tools, and tool_config by @gaurav0107 in #5681

New Contributors

Full Changelog: v2.0.0b4...v2.0.0b5

v1.105.0 (2026-06-02)

Choose a tag to compare

@dsfaccini dsfaccini released this 02 Jun 06:05
2a6a1a6

What's Changed

πŸš€ Features

  • feat: On-demand (deferred loading) capabilities, including instructions, tools, model settings, and hooks by @adtyavrdhn in #5230
  • Add Grok 4.3 reasoning_effort support and current xAI model names by @adtyavrdhn in #5454

πŸ› Bug Fixes

  • Fix gateway/ model construction inside a Temporal workflow by passing provider SDKs through the sandbox by @adtyavrdhn in #5733
  • Fix GoogleModelSettings.google_cached_content so request omits system_instruction, tools, and tool_config by @gaurav0107 in #5681

New Contributors

Full Changelog: v1.104.0...v1.105.0