In short.
Pydantic AI's Deferred Tools guide helps Python developers build agents that wait for approval or outside results, but approval alone does not establish permission to perform an action. It explains resolving requests within one run through HandleDeferredToolCalls or continuing in a new run with DeferredToolResults and saved conversation state. Its useful detail includes validated arguments, request matching, failure handling and streaming limitations. Runtime behavior and production reliability remain untested.
Researched and written by an AI model and checked by a second AI model. How it works
Covers the complete page at [https://pydantic.dev/docs/ai/tools-toolsets/deferred-tools/index.md], including inline handlers, approvals, external execution, conversation persistence, streaming, security warnings and the v2 ordering notice. The documentation-index and agent-query notices are present in the page; linked index content, API references, related guides and GitHub issue details are excluded. No code was executed. Installation compatibility, runtime behavior, performance, pricing and redistribution rights are not independently established.
The overview
Identity
Deferred Tools is a Pydantic AI documentation guide at [https://pydantic.dev/docs/ai/tools-toolsets/deferred-tools/index.md]. It explains how an agent can request a tool action whose approval or result is unavailable immediately, including human decisions, frontend operations and background work.
Assessment
The guide is useful when an agent must obtain permission before acting, delegate work to another component or continue after a long delay. It connects these situations through explicit pending requests and corresponding decisions or results, with examples for both immediate handling and later continuation.
Its practical strength is explaining integration details that affect correctness: preserving pending requests, matching answers to tool calls and showing approvers the arguments a tool will receive. It does not establish production reliability, throughput or recovery guarantees.
Users
The main audience is Python developers building Pydantic AI agents with approval steps, frontend tools or background workers. The examples assume familiarity with functions, decorators and agent runs; asynchronous examples also use asyncio.
Frontend developers can use the streaming discussion to identify when input is needed. Backend developers get guidance on saved state, result delivery and permission checks. Beginners will benefit from understanding basic tool calling before applying the more advanced hooks and durable execution options.
Capabilities
A tool can always require approval through requires_approval=True, or conditionally raise ApprovalRequired based on its arguments or run context. A FunctionToolset can require approval for all its tools, with explicit opt-outs for functions added with requires_approval=False. Decisions can approve, deny with a message or approve changed arguments through ToolApproved(override_args=...).
External work can defer through CallDeferred or use ExternalToolset when argument schemas are available. Results can contain ordinary values, ToolReturn objects, ModelRetry for another attempt or ToolFailed to report failure without consuming the tool's retry budget. Requests can distinguish approval, question and external waits.
DeferredToolRequestsEvent announces pending requests before a handler runs. DeferredToolResultsEvent reports results supplied by a handler, including partial resolution. Results supplied directly to a new run do not emit that results event.
Using it
Requirements
The examples require Python, Pydantic AI and a configured model. The page does not specify installation commands, minimum Python or package versions, credential setup or a complete supported-model list. Applications must arrange their approval decisions, outside execution and storage as needed.
A handler accepting a resume token can wait for an answer without ending the run. By default, that wait stays in the application process. The page names Temporal and AWS Lambda durable functions as engines that can record the wait and suspend execution. Realtime sessions require approvals to resolve inline; unresolved calls are refused.
Mechanism
DeferredToolRequests separates approval requests from calls waiting for outside answers. Each call has a tool name, the model's arguments and a unique tool call ID. DeferredToolResults maps those IDs to decisions or results. The build_results helper checks that answers refer to pending requests of the correct kind.
The page recommends HandleDeferredToolCalls for inline resolution. Its handler receives pending requests and returns results; resolved work continues within the same run. A handler can resolve only some requests, allowing later handlers to respond and remaining requests to become output when DeferredToolRequests is an allowed output type.
For later continuation, the application starts a new run with the previous messages and results, or with a saved conversation and results. The new run gets its own run_id; conversation_id connects the runs. Saving the conversation preserves request kinds and metadata that cannot be reconstructed from message history alone.
Setup
For inline handling, register HandleDeferredToolCalls(handler=...) in the agent's capabilities and implement the decision or result resolver. DeferredToolRequests does not need to be an output type when the handler resolves every request. Include it alongside the normal output type when unresolved calls should return to the caller.
For separate follow-up runs, the examples use output_type=[str, DeferredToolRequests]. Save result.conversation with ConversationTypeAdapter, restore it later, read conversation.deferred_tool_requests and build the answers before resuming. Alternatively, retain the original message history and pending requests separately. A runtime output_type replaces the constructor's setting, so it must also include the original expected output type.
Example
In the supplied file example, every deletion requires approval and updates to .env defer conditionally. The caller's code approves the protected update, denies deletion with ToolDenied and resumes with an optional request to create a backup. The file functions return descriptive strings; they do not actually modify or delete files.
The background-work example creates an asyncio task, puts a separate task ID in CallDeferred metadata and later maps its result back to the tool call ID. Its calculation returns the constant 42. This illustrates result handoff using an in-process task; the surrounding explanation describes separate processes using polling or notifications for real external work. Neither example was executed for this assessment.
Assessment & evidence
Limitations
Approval controls whether the model's proposed action receives sign-off. An endpoint accepting client-supplied history and approvals can receive a fabricated approved call. The page therefore requires endpoint authentication and authorization checks inside sensitive tool functions. The answered_by field records an attributed answerer without verifying that identity.
Approvers should normally see validated_args, which includes schema validation, defaults and validation-hook changes. The page documents that run_stream() and run_stream_sync() do not populate it for calls on which they end because approval or external execution is required. It also says the AG-UI approval prompt shows only the model's original arguments.
Arguments are validated again when an approved call resumes. Hooks depending on changing information, such as time or account balance, can produce arguments different from those previously shown. The guide suggests before_tool_execute for changes intended to happen only after approval. Hook-added secrets can also become visible through stored or displayed validated arguments.
The build_results option approve_all=True automatically approves otherwise unspecified approval requests. Applications must deliberately choose whether that behavior matches their decision rules.
Reasoning
Inline handling fits a resolver that can return decisions or results while the run remains active. Ending the run fits answers arriving through a later UI request or completed background job. Saving the conversation is particularly useful across process boundaries because it retains pending-request details alongside messages.
The important design choice is where the wait and its state live. An ordinary token handler waits in the process; a supported durable engine can suspend execution; separate follow-up runs move responsibility for storage and resumption to the application.
Alternatives
For external tools with available JSON argument schemas, the page points to ExternalToolset. For tools described through Python signatures, it shows functions that raise CallDeferred. Conditional deferral can also happen in args_validator so arguments are checked before handoff.
An existing custom capability can implement handle_deferred_tool_calls directly, and the Hooks capability exposes the same hook. These offer integration choices within Pydantic AI. The page provides no comparison with competing agent frameworks.
Evidence
The evidence is the complete Deferred Tools documentation page, including API descriptions, Python examples, illustrative outputs and explicit security and streaming caveats. It supports an account of intended behavior and integration patterns.
The printed message histories are illustrative documentation outputs. No independent execution, benchmark, compatibility test or production deployment evidence is supplied. Runtime correctness, performance and recovery behavior remain unassessed.
Access & freshness
Costs
The page states no price for the feature and provides no pricing for model calls, workers, storage, approval services or durable execution engines. Total operating cost is unknown. Some illustrative message histories contain token counts and RequestUsage cost values; those examples do not establish current provider rates, typical costs or savings.
Rights
The supplied page contains no explicit license or reuse terms for its documentation or embedded code. Permission to redistribute either is unknown from this evidence. Terms for the package, model provider and optional execution services are also not established.
Freshness
The page was captured on 26 November 2026. It supplies no publication date, last-updated date or exact package release. It identifies tool results following the model's call order, rather than being grouped by tool kind, as a v2 behavior change.
The documented streaming limitation references issue 13690. Its status after the capture and the release requirements for individual APIs are unknown.
Actions
Choose where decisions and results will arrive, then select inline handling or separate follow-up runs. Define who may approve actions, enforce permissions inside tools and determine how the interface will show validated arguments. Keep credentials out of values exposed to approvers.
For delayed work, preserve the conversation and the mapping between external job IDs and tool call IDs. Use build_results to match answers. Before deployment, verify denial handling, argument overrides, streaming behavior and continuation after process restarts with the intended package version. Obtain installation requirements, license terms and service prices from their original sources.
