pydantic-ai v2.26.0: Run cancellation and tool deferral
Pydantic-ai v2.26.0 introduces first-party run cancellation capabilities, allowing agents to be stopped mid-execution via `AgentRun.cancel()` or `RunContext.cancel()`. The release also enhances tool management by supporting deferred function tools, improving how tools are revealed and managed throughout agent interactions. These features, along with several bug fixes and provider updates, are available now and benefit developers building complex agentic workflows.
- →Map streamed OpenRouter reasoning details by their index by @VictorPeralta in https://github.com/pydantic/pydantic-ai/pull/7214
Features (5) ›
Support hiding function tools until revealed — via tool search, load_capability, or ToolReturn.tools — using each provider's native deferral/addition channel by @DouweM in https://github.com/pydantic/pydantic-ai/pull/7104
Add first-party run cancellation: AgentRun.cancel(), RunContext.cancel(), RunCancelled by @DouweM in https://github.com/pydantic/pydantic-ai/pull/6497
Add Model.resolve_prompt_cache_retention() to resolve effective prompt-cache retention from model settings by @DouweM in https://github.com/pydantic/pydantic-ai/pull/7254
Promote run_stream_events() iterator to public AgentRunEvents handle with cancel() and run-state access by @DouweM in https://github.com/pydantic/pydantic-ai/pull/6498
Cover and document DeepSeek V4 Flash via OpenAIResponsesModel + DeepSeekProvider by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/7202
Fixes (7) ›
Forward model_id through WrapperModel and resolve it against the active model in TemporalModel by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/7181
- Map streamed OpenRouter reasoning details by their index by @VictorPeralta in https://github.com/pydantic/pydantic-ai/pull/7214
Gate OpenRouter off native mid-conversation system messages with supports_inline_system_prompts=False by @DouweM in https://github.com/pydantic/pydantic-ai/pull/7253
Restore the released legacy profile-key shim and fix two reveal-state edges (is_tool_available, TestModel native additions) by @DouweM in https://github.com/pydantic/pydantic-ai/pull/7260
Keep deferred tools searchable after discovery and reset reveal state at CompactionPart boundaries by @DouweM in https://github.com/pydantic/pydantic-ai/pull/7225
Forward events from UIEventStream callbacks that return an async iterator without being an async generator function by @DouweM in https://github.com/pydantic/pydantic-ai/pull/7256
Send only the compacted window: drop history before the latest same-provider CompactionPart by @DouweM in https://github.com/pydantic/pydantic-ai/pull/7228
https://github.com/pydantic/pydantic-ai/releases/tag/v2.26.0
Related releases
- Pydantic-AI v2.29.0 Adds Azure AI Voice Live Support and FastMCP 4 Pydantic AI Releases ·
- Pydantic-AI v1.107.4 Addresses High-Severity Web UI Vulnerability Pydantic AI Releases ·
- Pydantic AI v1.107.3 Patches High-Severity Web Chat UI Vulnerability Pydantic AI Releases ·
- Pydantic-AI v2.28.0 Patches High-Severity Security Flaw, Adds Realtime Speech-to-Speech Pydantic AI Releases ·
- crewAI 1.15.15 Release Adds AI Flow Reporting, Fixes Bugs CrewAI Releases ·
- LangGraph 1.2.11 Adds Trace Policy to Nodes, Updates Checkpoints LangGraph Releases ·