In short.
Pydantic AI's Timeouts page is a technical guide for Python developers controlling AI agent delays, but a deadline covers only its stated scope and may leave synchronous tool threads running. It distinguishes individual model attempts, complete requests, first streamed output, tool calls and whole runs. Its practical value lies in explaining retry and fallback interactions, exception types, partial history and provider-specific limitations. No code was executed; actual timing, installed-version compatibility and costs are unassessed.
Researched and written by an AI model and checked by a second AI model. How it works
Covers the complete captured page at [https://pydantic.dev/docs/ai/core-concepts/timeouts/index.md], including its introductory documentation-index and query-parameter notices, timeout comparisons, examples, durable-execution caveats and tool-termination guidance. All linked pages, the documentation index itself, package source and provider services are excluded. No code or model calls were executed. Actual timeout behavior, dependency compatibility, provider availability and charges remain unassessed; licence and pricing information is absent.
The overview
Identity
Timeouts is a page in the Pydantic AI documentation at [https://pydantic.dev/docs/ai/core-concepts/timeouts/index.md]. It explains how to limit waiting and execution time, interpret timeout failures and control whether a tool error continues or ends an agent run.
A run is the overall agent job, which can contain multiple model requests, tool calls and hooks. The page treats these as separate units requiring different controls.
Assessment
This is a useful implementation reference when an agent retries for too long, starts streaming late, waits on a stalled tool or needs an overall deadline. Its strongest feature is connecting each setting to the work it bounds, the resulting exception and the possibility of recovery.
The page supports choosing and configuring controls. It supplies no measured latency improvements, provider reliability comparisons or evidence that every operation stops when its caller times out.
Users
The main audience is Python developers already using Pydantic AI agents, especially applications involving streaming, model fallback or function tools. Developers using MCP connections, realtime sessions, Temporal, DBOS or Prefect also get specific guidance.
Beginners can use the opening comparison to distinguish a model attempt from a complete request and a complete run. Applying the examples requires familiarity with Python exceptions, asynchronous functions and agent configuration; the page does not introduce those topics.
Capabilities
The guide covers ModelSettings.timeout for individual provider attempts, request_timeout for complete model requests, first_event_timeout for the start of streamed output and timeout= on run methods for the whole job. It also explains function-tool and hook timeouts and distinguishes elapsed time from UsageLimits on requests, tool calls, tokens or cost.
For MCP, it documents init_timeout with a five-second default and read_timeout with a 300-second default. For realtime sessions, it documents a 30-second handshake_timeout default for OpenAI, Azure OpenAI, xAI and Gemini. These settings have different failure paths from ordinary model requests.
The page also explains tool outcomes: ModelRetry requests correction and consumes retry budget; ToolFailed returns a failure without consuming that budget; approval or deferral can produce DeferredToolRequests; RunContext.cancel() cancels the run. Successful early completion requires an output tool or output function. Realtime sessions have separate handling because they cannot pause for deferred results.
Using it
Requirements
The examples assume Python code that can import pydantic_ai and use a configured model. Installation instructions, minimum Python and Pydantic AI versions, credential setup and provider access requirements are not specified.
Whole-run timeout= requires the asyncio event loop. The page says another asynchronous backend, such as Trio, raises UserError before the run starts. Durable run deadlines use TemporalDurability, DBOSDurability or PrefectDurability; deprecated wrapper agents reject timeout=.
Mechanism
Where supported, timeout applies to one provider attempt: an SDK retry starts a fresh allowance, and streaming limits the wait for each chunk. Pydantic AI enforces request_timeout across the complete request, including retries, backoff, paused-response continuations and consumption of the stream. A slow stream consumer therefore uses part of that deadline.
first_event_timeout covers the wait until the first output part or delta, including thinking. An acknowledgement without output does not satisfy it. It has no effect on non-streamed requests and stops applying after output begins.
FallbackModel and ModelFallback give each model a fresh request or first-event deadline and fall back on these errors by default. Once streaming output has begun, they do not fall back. A whole-run deadline applies alongside request deadlines; whichever expires first determines the outcome. Whole-run expiry raises RunTimedOut and does not trigger model fallback.
RunTimedOut retains completed messages and partial streamed output for a later run's message_history. RunContext exposes the deadline and remaining time, and delegated agent runs inherit the parent's deadline. Durable run deadlines survive replay and recovery. Request-deadline persistence has additional engine-specific rules, and some recovered requests start a fresh deadline.
Setup
Set request_timeout in the agent's model_settings to bound a complete model request. Add first_event_timeout for streamed requests that must begin promptly. Set timeout= on the chosen run method to bound the entire job. For the two request-deadline settings, model-specific values apply only when neither the agent nor the run supplies a value.
Agent(tool_timeout=...) establishes a default for function tools registered on that agent. A separately constructed FunctionToolset needs its own timeout, or individual tools need timeout=. Hooks accept timeout= on their decorators. MCP, external and custom toolsets require their own server-side or transport-level controls.
Example
One documented example configures timeout=30 and request_timeout=90 in model_settings. Each provider attempt gets its own 30-second allowance, while all attempts and response consumption share the 90-second request deadline. The example catches ModelRequestTimeout and reads its model_name and timeout attributes.
A streaming example combines first_event_timeout=20 with request_timeout=600 and a fallback model. Each model gets 20 seconds to begin output and up to 600 seconds for its request. A separate example passes timeout=30 to agent.run() and catches RunTimedOut to retrieve all_messages(). These are documentation examples; none was executed.
Assessment & evidence
Limitations
ModelSettings.timeout is not supported uniformly. Some model classes ignore it with UnsupportedSettingWarning and use their client configuration instead. Google and Mistral accept numeric seconds but reject an httpx.Timeout object for that setting. request_timeout and first_event_timeout are enforced by Pydantic AI on every model.
A timed-out synchronous function tool or hook continues running in its worker thread. A timeout therefore does not prove that its side effects have stopped. Function-tool expiry produces a retryable result and consumes retry budget; hook expiry raises HookTimeoutError and aborts the run.
first_event_timeout does not limit later pauses or guarantee that a user-visible answer has begun, because thinking counts as output. A bare TimeoutError raised inside a tool can propagate or be mistaken for the configured tool deadline. The page recommends translating internally enforced deadlines into ModelRetry or ToolFailed.
BatchModelRequests includes queue-to-result waiting in request_timeout, while model_request_batch() rejects that setting. Durable execution has further distinctions involving timers, activities, retry policies and response continuations; compatibility with a particular application is unassessed.
Reasoning
The key design choice is the boundary that should expire. A request deadline lets an application abandon a slow model and potentially try another. A whole-run deadline limits the combined job, including tools and multiple model requests, but ends the run rather than starting model fallback.
Because each fallback model receives a fresh request allowance, a whole-run deadline provides an outer limit when cumulative waiting matters. Retained message history helps a later run continue, but does not establish that repeating a tool with external side effects is safe.
Alternatives
The page identifies CancellationToken for deliberately stopping an in-flight run and compares built-in run deadlines with asyncio.timeout(). RunTimedOut exposes partial state directly, while the run's deadline is visible to tools through RunContext.
UsageLimits addresses quantities such as requests, tokens and cost. Provider-client timeouts address transport behavior where needed. These are complementary controls with different scopes. The supplied page does not compare Pydantic AI with other agent frameworks.
Evidence
The evidence is the complete captured Timeouts documentation page, containing timeout comparisons, implementation caveats and Python examples. Its sample outputs illustrate intended behavior; they are not observed execution results. No independent benchmark, package-source inspection or runtime verification is available.
Linked API references, provider documentation and related guides are outside the supplied evidence. Claims requiring those pages, including complete provider support details, remain unassessed.
Access & freshness
Costs
The page supplies no prices, subscription requirements or example execution costs. Retries and fallback can involve several model calls within a deadline, so elapsed-time limits do not establish a spending cap. Cost-based UsageLimits is a separate documented control. Provider charges for cancelled, retried or partially streamed requests are unknown.
Rights
The supplied page contains no licence notice establishing reuse or redistribution permissions for its text or examples. Those permissions are unknown. It also does not establish the licences of Pydantic AI, provider SDKs or linked components.
Freshness
The page was captured on 24 November 2026 at 18:43:01 UTC. No publication date, last-update date, Pydantic AI release identifier or compatibility matrix is stated. The capture date identifies the supplied copy; it does not establish support in any particular installed release or continued availability of example models.
Actions
Use the guide to choose the required boundary: one model request, time until streamed output, a function tool or the complete run. Confirm that the installed Pydantic AI release exposes the relevant settings and that provider and toolset configuration match the documented scope.
Before relying on the limits in an application, verify retry-heavy requests, slow stream consumption, fallback, synchronous tool behavior and any durable recovery path. Define how partial history and external side effects should be handled after cancellation. The page supplies explanations and examples, but no measured results for these application-specific cases.
