Refacto Agents

Industry story

Pydantic AI v2.2.0 adds Claude Sonnet 5 and retry options

engineering

Pydantic AI v2.2.0 is a maintenance release dressed up as a feature drop — useful, but the headline additions (Claude Sonnet 5 support, OpenRouter cost tracking, Google retry options) are table-stakes integrations, not architectural leaps. The bug fixes are the real story: silently dropped thinking-mode on Heroku and miscounted reasoning tokens on Groq are exactly the kind of invisible errors that corrupt evals and waste money before anyone notices. If you're running long agentic workflows, the ClosedResourceError fix on mid-run graph cancellation is worth the upgrade alone.

Full analysis

Pydantic AI, a Python framework for building type-safe AI agents, released v2.2.0 on June 30, 2026. Key new features include support for Anthropic's Claude Sonnet 5 model, a retry_options parameter for the Google provider (allowing agents to customize retry behavior), and cost-tracking fields for prompt and completion tokens via OpenRouter. A TwelveLabs Pegasus video-understanding example was also added, extending the framework's multimodal capabilities.

The release also ships a range of bug fixes relevant to agent builders: corrected reasoning-token surfacing for Groq models, fixes to Heroku routing that prevented 'thinking' mode from being silently dropped, and a fix for ClosedResourceError when cancelling a graph run mid-send — the last being directly relevant to long-running agentic workflows. Dataset evaluation now supports factory functions as lifecycle arguments, improving flexibility in agent eval pipelines.

Comments