Learning resourcesReviewed · Pydantic

Pydantic AI Multimodal Input guide

Pydantic AI’s Multimodal Input guide helps Python developers send files and structured data to agents, but support varies by model and provider. It explains input classes, file downloads, uploaded-file references and how application data becomes model input.

Researched 14 Nov 2026

In short.

Pydantic AI’s Multimodal Input guide is a reference for Python developers building agents that accept files and application data, but its common interface retains provider-specific restrictions. It covers URL and binary inputs, structured-value rendering, uploaded files and file URL security. Particularly useful details include download limits, metadata visibility and the handling of stored structured prompts. Installation requirements, pricing, licensing and measured reliability are not established by the page. No examples were executed.

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

Covers the complete selected Multimodal Input page at [https://pydantic.dev/docs/ai/core-concepts/input/index.md], including all input types, structured-content behavior, provider routing and upload tables, file URL trust guidance, examples and associated notices. Opening documentation-index and query-parameter notices are source content, not additional evidence. Linked pages, external sample files and provider documentation are excluded. No examples or operational behavior were executed or independently verified; output quality, compatibility, security behavior, latency and costs remain unassessed.

The overview

identity

Multimodal Input is a feature reference in the Pydantic AI Python agent framework documentation. It explains how user prompts can combine text with images, audio, video, documents and structured application values. The original page is [https://pydantic.dev/docs/ai/core-concepts/input/index.md].

assessment

The guide is useful for choosing how an existing Pydantic AI application should supply content to a model. It connects concrete Python classes with operational differences: who downloads a file, which provider can read it and whether a stored upload remains accessible.

The shared input classes do not guarantee shared model capabilities. The page provides implementation guidance, but establishes no extraction accuracy, latency, reliability or comparative performance.

users

Python developers building document summarizers, image-questioning agents or applications that send interface state to a model can use the examples as starting patterns. Beginners need familiarity with Python imports, reading bytes and calling an agent; the page does not provide a complete installation or authentication tutorial.

Experienced developers will find details relevant to switching providers, restoring message histories, handling frontend uploads and controlling how structured values are rendered.

capabilities

ImageUrl, AudioUrl, VideoUrl and DocumentUrl represent file locations. BinaryContent carries file bytes with a media type. UploadedFile references a file already stored through a provider’s upload API. Actual acceptance depends on the selected model, provider and file format.

TextContent adds application-readable metadata to text; that metadata is not sent to the model. StructuredContent preserves a structured value in message history while normally sending a textual rendering to the model.

The documented File Understanding capability lets another model describe a file that the main model cannot read. The main model receives that description in place of the unsupported file. Configuration details for this capability are outside the page.

Using it

requirements

Using the examples requires a Python environment with Pydantic AI, access to a suitable model provider and permission to read the input files. The page does not specify supported Python versions, a minimum Pydantic AI release or complete credential configuration.

Uploaded files require provider_name, which the examples obtain through model.system. Matching the provider name does not establish access across accounts or endpoints. Bedrock file references require an S3 upload and an assumed role with s3:GetObject permission.

mechanism

File URLs normally go to the provider for retrieval, with exceptions listed by provider and input type. For example, OpenAIChatModel forwards image URLs but downloads document URLs, while OpenAIResponsesModel forwards both. Google Cloud accepts all listed URL types directly; the Gemini API path downloads ordinary URLs while directly accepting supported YouTube and Files API references.

Setting force_download=True requests local downloading for HTTP or HTTPS URLs. An explicitly supplied media_type takes precedence when it differs from the URL extension’s implied type; otherwise the response Content-Type is used, with an extension fallback for missing or generic headers.

StructuredContent normally renders compact JSON, optionally wrapped in a tag, and escapes characters that could close that wrapper. XML and custom renderers are supported. Rendering happens once when the item is created, so changing its value does not automatically update its stored text. A decision model receives the value itself when the prompt consists of a single StructuredContent.

setup

Start by choosing a model and confirming that it accepts the intended input type and format. Combine a question with the appropriate URL object, or read a local file into BinaryContent and supply its media_type. For provider-stored files on Anthropic, OpenAI, Google or xAI, upload through the provider client (provider.client) first, then construct UploadedFile with the returned file ID (the file URI for Google) and provider_name=model.system. For Bedrock, upload the file to S3 separately, for example with boto3, then pass its s3:// address as file_id, setting media_type when the extension is missing or ambiguous.

For StructuredContent, choose the rendering format before storing message history. To update its rendered value, create a new item or use the documented dataclasses.replace approach with content cleared, supplying the format again when applicable. These are documented setup patterns; none were executed.

example

The image example combines a company-identification question with ImageUrl pointing to a logo, calls agent.run_sync and reads result.output. A companion example supplies downloaded image bytes through BinaryContent with media_type='image/png'. The printed logo identification is illustrative documentation output, not an independently observed result.

The structured-input example creates a UIState containing url='/products/42' and cart_total=949.0, wraps it in StructuredContent with tag='ui_state', and asks why the total jumped. The ordinary model receives tagged JSON plus the question, while application code can retain the structured value. The example does not establish that this state alone explains a price change.

Assessment & evidence

limitations

Pydantic AI’s own downloads are limited to 50 MiB per file and 500 MiB across one model request; exceeding either raises ValueError. BinaryContent or provider-fetched URLs avoid that download path, but the page does not establish that a provider will accept arbitrarily large files. Unsupported user-prompt files fail without File Understanding; unsupported files returned by tools are replaced by a naming note.

UploadedFile references cannot transfer across providers. OpenAIChatModel rejects uploaded image references, while OpenAIResponsesModel supports them. Removing upload references from history can leave confusing textual references. StructuredContent reloads its value in JSON-compatible form, and its separate metadata does not round-trip through the described UI adapters. Prompt-rewriting code should replace it with plain TextContent holding the rewritten text.

Cloud file URLs can let the provider read objects using the application’s cloud credentials. The page recommends validating schemes and scope and converting frontend cloud references to server-generated signed HTTPS URLs. force_download=True does not locally fetch cloud-storage schemes; force_download='allow-local' permits local network access and is intended only for server-authored URLs. The documented protections were not independently assessed.

reasoning

The practical inference is that this guide fits developers who need explicit control over file transport and prompt representation within Pydantic AI. Its distinctions help separate model capability, file accessibility, upload ownership and message-history handling.

File Understanding introduces an intermediate text description. Whether that description preserves the details needed for a particular task is not measured. Consistent input classes also do not establish equivalent results across providers.

alternatives

The page documents several alternative input paths. Documents can be manually converted to text and passed as strings or TextContent. BinaryContent supplies bytes when URL input is unsuitable. UploadedFile references provider-stored content, and File Understanding supplies descriptions of unsupported media.

These paths change retrieval or what the main model receives; they are not established as equivalent in quality or cost. The page provides no comparison with competing agent frameworks or standalone document-processing tools.

evidence

The source is the complete documentation page [https://pydantic.dev/docs/ai/core-concepts/input/index.md], captured at 2026-11-14T21:00:13.783Z. Its source fingerprint is sha256:87be0606b2aa02f76d2a7e248c8d41cf06c173ac719f5b3db7315ed11753faf0.

The examples, compatibility tables and behavioral descriptions are documentation claims. Linked references and sample files were not examined. No code, uploads, downloads or model calls were executed, and no runtime results are established.

Access & freshness

costs

Costs are unknown. The page provides no framework pricing, provider rates, upload charges, storage charges or worked usage estimate. File Understanding involves another model describing the input, so it can add model usage, but its cost and latency are not quantified. No paid calls or cost measurements were performed.

rights

The page states no license or reuse terms for its prose, code examples or the framework. Redistribution and commercial-use permissions therefore remain unknown from this source. Provider terms governing uploaded-file retention, deletion and use of file contents are also not supplied.

freshness

The available snapshot was captured on 14 November 2026. The page does not identify a Pydantic AI release or publication date, so the minimum compatible version and subsequent changes are unknown.

It labels the Anthropic Files API as beta and describes automatic addition of its required header. That status, provider compatibility tables and example model identifiers should be confirmed against the versions and accounts used for implementation; current availability was not assessed.

actions

Before implementation, confirm the installed Pydantic AI version exposes the required classes and that the chosen model accepts representative file formats and sizes. Choose between provider retrieval, local downloading and provider-stored uploads based on access requirements.

Validate client-supplied file references and use the documented sanitize_messages function when accepting serialized message histories through a custom client API. Check structured-content rendering after persistence or redaction. Evaluate representative inputs for useful output, latency and total provider cost; these outcomes remain unassessed.

Evidence for this report

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