What's Changed
🚀 Features
- Allow
MCPToolsetclients to skip optional MCP tasks viaprefer_tasksby @adtyavrdhn in #6851 - Default Gemini
VALIDATEDtool mode on supported models by @hramezani in #6353 - Stop advertising tool search for capability-owned deferred tools on Anthropic by @DouweM in #6770
- Send mid-conversation system prompts as native
systemmessages on Anthropic by @DouweM in #6765 - Add
RunContext.is_tool_availableby @DouweM in #7011
🐛 Bug Fixes
- Handle closed event loops in synchronous APIs by @adtyavrdhn in #6850
- Compare full origin, not just hostname, when dropping credentials on
safe_downloadredirects by @pydanty[bot] in #6811 - Fix Temporal workflow livelock when anyio scope cancellation hits an in-flight activity await by @DouweM in #6892
- Copy
extra_headersbeforesetdefaultin OpenAI chat and Groq models by @pydanty[bot] in #6868 - Support requesting approval or deferring a call from a tool's
args_validatorby @DouweM in #6897 - Use the workflow-prepared
tool_defin Temporal function-tool activities instead of re-runningprepareby @DouweM in #6890 - Raise a
UserErrorinstead of hanging whenrun_sync()is called on an event loop it cannot drive by @DouweM in #6905 - Fix Prefect tool-call cache keys: replay tool results on flow retry and stop colliding on
RunContextfields a tool can read by @DouweM in #6944 - Run
after_tool_validatewhen anargs_validatordefers the call by @DouweM in #6961 - Preserve the host's Logfire configuration in the Temporal
LogfirePluginby @DouweM in #6962 - Fail the workflow instead of retrying forever when a Temporal activity argument can't be serialized by @DouweM in #6893
- Install the
EnqueueGuardon the DBOS/Prefect model-request andcancel_suspended_responseunits by @DouweM in #6943 - Restore typed values in a dynamic tool's Temporal
ActivityConfigafter the activity round trip by @DouweM in #6947 - Reject unregistered
Modelinstances in durable runs instead of re-inferring them frommodel_idby @DouweM in #6898 - Heartbeat in tool, MCP, dynamic-toolset, and event-stream Temporal activities by @DouweM in #6965
- Rehydrate
sets, carryconversation_id, and hard-error on omitted fields inTemporalRunContextby @DouweM in #6891 - Allow
ApprovalRequired/CallDeferredfrom post-validation tool hooks,UserErrorfrom pre-validation ones by @DouweM in #6951 - Raise a
UserErrorwhen a history processor orfallback_onhandler has unresolvable type annotations by @DouweM in #6958 - Raise
ModelAPIErrorfor OpenRouter responses with null choices and no error envelope by @ZacharyHampton in #6901 - Inline every
$refto a union$def, not just the first one by @DouweM in #6960 - Reject unknown
ActivityConfigkeys inTemporalDurabilityby @DouweM in #6964 - Honor per-tool
TaskConfigon Prefect MCP tools and addPydanticUserErrorto its non-retryable set by @DouweM in #6952 - Pass the unprepared request to the wrapped model in
InstrumentedModelby @DouweM in #6982 - fix(mcp): inherit agent retries in
MCPToolset.tool_for_tool_defby @hramezani in #6449 - Fail the workflow on
HookTimeoutErrorandFallbackExceptionGroupinstead of retrying forever by @DouweM in #6978 - Keep thinking alive by not forcing
tool_choiceon OpenRouteranthropic/models by @DouweM in #6957 - Add configurable
max_retriestoToolSearchToolsetby @pydanty[bot] in #6740 - Fix Temporal
ActivityConfigvalidation on Python 3.10 and 3.11 by @DouweM in #6989 - Pass
pydantic_graphthrough Temporal workflow sandboxes by @DouweM in #6990 - Memoize Temporal payload
TypeAdapters by @DouweM in #7001 - Preserve
SystemPromptPartsemantics across caching and Temporal by @dsfaccini in #6984
📦 Dependencies
- Require
genai-prices>=0.1.0for detailed usage by @alexmojaki in #6933 - Declare
anyioas a direct dependency ofpydantic-ai-slimandpydantic-graphby @DouweM in #7008
New Contributors
- @ZacharyHampton made their first contribution in #6901
- @vgrozdanic made their first contribution in #6942
- @rscholz98 made their first contribution in #6858
Full Changelog: v2.21.0...v2.22.0