python Pydantic AI Releases · · 2.9.0

Pydantic-AI v2.9.0: Security fix, GPT-5.6 models, usage command

sdkaipreviewengineerpython-agentic
security feature patch

Pydantic-AI v2.9.0 addresses a security advisory impacting message sanitization and backports a fix to version 1.107.1. This release also introduces new features like GPT-5.6 model support, a `/usage` command for the `clai` CLI, and exposes `usage_limits` to tools. Several bug fixes improve Anthropic Files API integration, message repr handling, FIPS compliance, agent robustness, and output strategies, affecting users of version 2.0.0 and above.

  • Affected: pydantic-ai / pydantic-ai-slim >= 2.0.0, < 2.5.0 (v2) and >= 1.88.0, < 1.107.1 (v1)
  • Patched: 2.5.0 (v2) and 1.107.1 (v1)
  • Add /usage slash command to clai CLI for cumulative token usage by @adtyavrdhn in https://github.com/pydantic/pydantic-ai/pull/6245
  • feat(openai): add GPT-5.6 models and reasoning mode by @Wh1isper in https://github.com/pydantic/pydantic-ai/pull/6414
  • feat(RunContext): expose the run's usage_limits to tools and capabilities by @DouweM in https://github.com/pydantic/pydantic-ai/pull/6341
Security (3)
  • Affected: pydantic-ai / pydantic-ai-slim >= 2.0.0, < 2.5.0 (v2) and >= 1.88.0, < 1.107.1 (v1)
  • Patched: 2.5.0 (v2) and 1.107.1 (v1)
  • Not affected if every sensitive tool uses requires_approval=True / ApprovalRequiredToolset, or if your tool handlers validate their arguments and enforce authorization themselves

Features (3)
  • Add /usage slash command to clai CLI for cumulative token usage by @adtyavrdhn in https://github.com/pydantic/pydantic-ai/pull/6245
  • feat(openai): add GPT-5.6 models and reasoning mode by @Wh1isper in https://github.com/pydantic/pydantic-ai/pull/6414
  • feat(RunContext): expose the run's usage_limits to tools and capabilities by @DouweM in https://github.com/pydantic/pydantic-ai/pull/6341
Fixes (7)
  • Auto-enable Anthropic Files API beta when messages contain UploadedFile by @gaurav0107 in https://github.com/pydantic/pydantic-ai/pull/5815
  • Fix repr() crash on message parts whose field != returns a non-bool (#6415) by @hramezani in https://github.com/pydantic/pydantic-ai/pull/6421

  • fix mark non-crypto hashes with usedforsecurity=False (FIPS precaution) by @stef41 in https://github.com/pydantic/pydantic-ai/pull/5053
  • Guard against id-less MCPToolset on the DBOSAgent wrapper path by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/6406
  • fix make nested capture_run_messages capture correctly (#1568) by @DouweM in https://github.com/pydantic/pydantic-ai/pull/6345
  • Fix cancellation deadlock when a wrapped model request or agent run survives cancellation by @0ywfe in https://github.com/pydantic/pydantic-ai/pull/6426

  • Honor end_strategy='early' for NativeOutput, PromptedOutput, and image output by @DouweM in https://github.com/pydantic/pydantic-ai/pull/6427

Read the original announcement →

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

Related releases