Learning resourcesReviewed · Pydantic

Pydantic AI Native Tools documentation

Pydantic AI’s Native Tools documentation is a guide for Python developers adding tools to AI agents, but support varies by provider, model and API. It explains ten integrations, including web search, code execution, image generation, file search and remote MCP access. Compatibility tables, configuration rules and examples help developers decide when to use native tools or provider-adaptive alternatives.

Researched 26 Nov 2026

In short.

Pydantic AI’s Native Tools page is a guide for Python developers adding search, code execution and other tools to agents, but provider and model differences determine what works. It explains NativeTool configuration, provider-specific settings, dynamic tool factories and access to tool results. Its most useful detail concerns compatibility, restrictions and fallback behavior. Installation requirements, exact prices, licensing and measured reliability are not established, and no examples were executed.

Researched and written by an AI model and checked by a second AI model. How it works

Coverage is limited to the complete selected page at [https://pydantic.dev/docs/ai/tools-toolsets/native-tools/index.md], including all ten tool descriptions, examples, provider and parameter tables, compatibility warnings, deprecation notices and fallback rules. Linked documentation, API references, provider terms and external examples are excluded. The page’s introductory documentation-index and agent-query notices were treated as source text. No code or integrations were executed, and illustrative outputs, security properties, prices and performance were not independently verified.

The overview

Identity

This is the Native Tools documentation page within Pydantic AI, a Python framework for building generative AI agents. The resource is an implementation guide covering provider tool integrations, rather than a standalone application.

The original source is [https://pydantic.dev/docs/ai/tools-toolsets/native-tools/index.md]. It covers ten native tool classes and explains how they differ from common tools implemented and executed through Pydantic AI.

Assessment

The page is useful when deciding whether a particular provider can supply an agent feature and how to configure it. Its tables distinguish supported tools, accepted parameters, API routes and model-specific exceptions, while the examples show how those choices enter an Agent definition.

Its value is greatest after a developer has identified candidate providers. A shared tool class does not guarantee equivalent behavior across them: support can depend on the API client, model family, hosting platform and search engine. The page provides implementation guidance, but no general benchmark of accuracy, latency or reliability.

Users

The main audience is Python developers building agents that need current web information, document retrieval, calculations, images or external services. Beginners get concrete examples, but will need additional guidance for package installation, provider authentication and the basic Agent interface.

Experienced developers can use the page to plan provider migrations, preserve domain restrictions, configure per-request tools and inspect native tool messages. It also addresses specialized workflows involving uploaded files, remote MCP servers, computer interaction and consultation between models.

Capabilities

WebSearchTool searches the web through supported providers, while WebFetchTool retrieves URL contents through Anthropic or Google. XSearchTool searches X posts natively through xAI, with handle filters, date filters and optional raw results.

CodeExecutionTool delegates computational work to supported provider environments and can accept uploaded files with Anthropic or OpenAI. ImageGenerationTool supports image creation through OpenAI Responses and compatible Google image models, with different configuration options on each.

FileSearchTool supplies managed document retrieval through OpenAI vector stores, Gemini file-search stores or xAI collections. MCPServerTool lets the provider communicate with remote Model Context Protocol servers.

MemoryTool exposes Anthropic’s memory interface but requires an application-supplied implementation. ComputerTool maps an existing computer tool to a provider’s native interface. AdvisorTool lets an executor model consult another model through Anthropic or OpenRouter.

Using it

Requirements

The examples require a Python application using Pydantic AI and a model/API combination that supports the chosen tool. The page does not establish a minimum Python version, a compatible Pydantic AI package version, an installation command or a complete authentication procedure.

Some integrations need additional infrastructure. File search requires provider-side stores or collections and their identifiers. Native MCP requires a public URL reachable by the provider and authorization where applicable. Memory requires a tool named memory implementing Anthropic’s commands. ComputerTool requires exactly one callable computer tool.

Provider routes matter. OpenAI web search, code execution, image generation, native MCP and file search use the Responses route described here. Anthropic tools also have platform-specific availability limits, including differences between the direct API, Vertex AI and Amazon Bedrock.

Mechanism

Native tool instances are wrapped in NativeTool and added to the agent’s capabilities list. The provider generally handles tool execution, and calls and results appear as NativeToolCallPart and NativeToolReturnPart messages. Memory and computer integrations still depend on application-supplied tools.

A factory accepting RunContext can configure or omit a tool for each model request. It receives the model through ctx.model and runs again if ModelFallback switches models. This allows location, dependencies and provider compatibility to influence configuration.

Unsupported native tools normally raise UserError. For documented restricting settings, an unsupported configuration can instead use an enabled local fallback or omit an optional tool. Nonrestricting tuning parameters may be left out when unsupported.

Setup

Choose a supported provider/model combination, import Agent and the required tool class, and place NativeTool(tool_instance) in capabilities. Configure required uploads, stores, MCP authorization or application-side tools before requesting the feature.

Provider-specific options belong in provider_settings under the model class’s key. Claude through OpenRouterModel reads openrouter settings, not anthropic settings. OpenAIChatModel pointed at OpenRouter’s API reads neither entry. Typed dictionaries help editors and type checkers validate option names, while the provider API determines accepted values.

Restrictions such as allowed_domains remain top-level fields. Some older provider-specific fields, including ImageGenerationTool.quality, are deprecated in favor of provider_settings; conflicting values in both locations raise UserError.

Enable output-inclusion settings when raw results are needed. The page documents separate OpenAI settings for web sources, code outputs and file-search results, plus xAI options for X search and collections results.

Example

The dynamic web-search example defines prepared_web_search(ctx). When dependencies contain a location, it returns WebSearchTool with that city as user_location; otherwise it returns None. The function is wrapped in NativeTool and supplied through capabilities.

The page illustrates a London weather request with search enabled and a geography question with search omitted. This demonstrates request-dependent configuration, not a guarantee of particular answers. The example and its printed responses were not executed or verified.

Assessment & evidence

Limitations

Compatibility has important exceptions. Google web search and fetch accept none of the listed configuration parameters, so unsupported restrictions make those native configurations unavailable. Anthropic allows either allowed_domains or blocked_domains, not both.

OpenRouter requires particular care: the page distinguishes parameter acceptance from engine behavior. It states that native OpenAI search ignores blocked_domains and that native-search max_uses is forwarded only to Anthropic. Accepted parameter names therefore do not establish equivalent enforcement across engines.

The page says Gemini 3 supports combining native tools with function tools and structured-output mechanisms, while earlier models need PromptedOutput for structured output alongside native tools. Separately, the described Google image models do not support function tools.

Returning None usually omits a dynamic native tool. XSearch and ImageGeneration behave differently when fallback_subagent_model is configured: the subagent tool remains available, and calling it raises UserError. Native MCP also lacks many advanced features of agent-side MCP. Runtime correctness, sandbox security and performance were not assessed.

Reasoning

This guide is a good fit when a developer wants provider-managed execution or retrieval and can accept the chosen provider’s limits. A common Pydantic AI interface can simplify integration, but it does not make tool behavior uniform across providers.

The most consequential design choice is whether a feature must remain available when the model changes. Required capabilities need a compatible replacement or an explicit fallback; optional capabilities can be omitted. Restrictions and raw-result access deserve separate attention because successful request submission alone does not establish that either behaves as intended.

The page presents possible context, caching and latency benefits for native MCP, but supplies no comparative measurements. Those benefits remain possibilities rather than demonstrated outcomes.

Alternatives

The page describes provider-adaptive WebSearch, WebFetch, ImageGeneration and MCP capabilities. These can choose native tools where supported and use configured alternatives. WebSearch can use local='duckduckgo', WebFetch can use local=True, and image generation offers local or fallback-model paths.

MCP runs locally by default through its adaptive capability and opts into native execution with native=True. Agent-side MCP is the relevant option when its advanced features are needed. The page also points to a direct image-generation API for application-controlled generation and editing, and to common tools for custom implementations.

These comparisons use only descriptions on this page. The linked capability guides, direct API guide and MCP documentation were not assessed.

Evidence

The evidence consists of the complete Native Tools page at [https://pydantic.dev/docs/ai/tools-toolsets/native-tools/index.md]. It contains interface descriptions, provider support tables, configuration examples and compatibility notices.

The page supports statements about documented behavior and requirements. Its sample outputs are illustrations, and its descriptions of provider behavior are documentation claims. No code, tool calls, uploads or provider integrations were executed, and linked sources were not independently assessed.

Access & freshness

Costs

Exact costs are unknown. The page supplies no complete price schedule, subscription requirements or worked cost estimate for these integrations.

It documents usage accounting for web search. Anthropic and OpenAI search requests are included in RunUsage.cost. Google’s billed count differs by model generation, and the reported cost does not deduct Google’s free grounding allowance. OpenAI page-opening and within-page searches do not count as additional searches under the described accounting.

Anthropic advisor usage appears under advisor_* details and is excluded from the executor’s top-level token totals. Budget estimates therefore need to consider more than executor tokens and use current provider pricing for every selected tool, storage service and fallback.

Rights

The supplied page does not state a license for its documentation or code examples. Permission to redistribute either is therefore not established by this evidence.

Provider terms governing uploaded files, generated images, search results, external content and MCP services are also not established. The page should not be treated as granting rights to those materials.

Freshness

The documentation snapshot was captured on 26 November 2026. The supplied evidence does not establish a page publication date, last-update date or Pydantic AI package version.

The page contains model-dependent support rules, named provider tool versions, beta-service references and deprecated configuration fields. These details are sensitive to upstream changes, so deployment decisions need confirmation against the package, model and provider API actually being used.

Actions

Start by choosing one required feature and mapping its provider, model and API route to the page’s support tables. Record any domain filters, usage limits, file requirements and raw-result requirements before deciding between a direct native tool and an adaptive capability.

For adoption, configure authentication and prerequisite storage, choose explicit fallback behavior, and verify the required restrictions and result fields in the intended environment. Include provider pricing and file-retention terms in that decision. These are recommended next steps; none was performed for this report.

Evidence for this report

selected-page.txtselected · checked 2026-11-26