pydantic-ai v2.13.0: New Instrumentation, Usage Metrics, and Bug Fixes
Pydantic-ai version 2.13.0 introduces new features for instrumentation and usage tracking, including the ability to omit model request parameters from spans and a new `cache_hit_ratio` property. It also enhances error handling for content filters and fixes several bugs related to streaming and temporal workflows. These updates are primarily relevant to developers integrating AI models via pydantic-ai, offering improved debugging and monitoring capabilities.
- →feat(usage): add cache_hit_ratio property to RequestUsage and RunUsage by @DouweM in https://github.com/pydantic/pydantic-ai/pull/6529
- →Add get_model, resolve_model_id, and for_agent capability hooks by @DouweM in https://github.com/pydantic/pydantic-ai/pull/6333
- →Fix MistralModel streaming settings by @adtyavrdhn in https://github.com/pydantic/pydantic-ai/pull/6563
- →Close open message parts (text, thinking, tool calls) on UI stream error by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/6550
- →fix(temporal): pass through pydantic_monty in workflow sandbox by @adtyavrdhn in https://github.com/pydantic/pydantic-ai/pull/6564
Features (4) ›
Add include_model_request_parameters instrumentation setting to omit the model_request_parameters span attribute by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/6488
Add RaiseContentFilterError capability to raise content filter error for non-empty content filter responses by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/6167
- feat(usage): add cache_hit_ratio property to RequestUsage and RunUsage by @DouweM in https://github.com/pydantic/pydantic-ai/pull/6529
- Add get_model, resolve_model_id, and for_agent capability hooks by @DouweM in https://github.com/pydantic/pydantic-ai/pull/6333
Fixes (4) ›
- Fix MistralModel streaming settings by @adtyavrdhn in https://github.com/pydantic/pydantic-ai/pull/6563
- Close open message parts (text, thinking, tool calls) on UI stream error by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/6550
Fix spurious OTel Failed to detach context error when a streamed run is interrupted mid-segment by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/6572
- fix(temporal): pass through pydantic_monty in workflow sandbox by @adtyavrdhn in https://github.com/pydantic/pydantic-ai/pull/6564
https://github.com/pydantic/pydantic-ai/releases/tag/v2.13.0
Related releases
- OpenAI Agents Python v0.19.1: Bug fixes and documentation updates OpenAI Agents SDK (Python) Releases ·
- pydantic-ai v2.20.0: New Claude Opus, OpenAI Responses API, and Usage Fixes Pydantic AI Releases ·
- LangGraph 1.2.10: Stream events typing, trace policy changes LangGraph Releases ·
- crewAI 1.15.8: WaitTool, FileWriter fix, and docs CrewAI Releases ·
- Pydantic-AI v2.19.0 adds headers and retry_after to ModelHTTPError Pydantic AI Releases ·
- OpenAI Agents Python: Programmatic Tool Calling and SDK Enhancements OpenAI Agents SDK (Python) Releases ·