
Pydantic AI
Typed Python agent framework from the Pydantic team for building AI agents with structured outputs across any model provider.
46 open-source projects declare Pydantic AI in their code; no maker's live product we track uses it yet. What makers like most: Handles the agent and tool-calling loop for you and makes switching between model providers easy.
Profile checked
Works with AI agents:llms.txtHow makers use Pydantic AI
What Pydantic AI is used for
Pydantic AI vs the alternatives makers chose
| Option | Makers' products | Open source | |
|---|---|---|---|
| 66 57% | Yes | ||
| 24 21% | Yes | ||
| 16 14% | Yes | ||
| 5 4% | Yes | ||
| 3 3% | Yes | ||
| 1 1% | Yes | ||
| 0 0% | Yes |
For AI SDK & agent framework: how many of the 115 makers' products we know the AI SDK & agent framework of chose each option.
When to use Pydantic AI, and when not
Pick Pydantic AI if
- You want a small typed agent loop in Python, close to the raw API. AI SDK & Agent Framework →
Something else fits better if
- Your app is TypeScript and you want agents without adding a Python service: AI SDK or Mastra.
- Your agent works on files and runs commands, like a coding or research agent: Claude Agent SDK.
- You need many prebuilt connectors for models, tools and data sources: LangChain.
- Your agent is a long-running workflow with branches, saved state and human approval steps: LangGraph.
- The agent mostly retrieves and reasons over your own documents: LlamaIndex.
Pydantic AI is an open-source Python agent framework from the team behind the Pydantic validation library. It brings the same type-checked style to LLM code: tool arguments and agent outputs are defined as typed Python and validated, instead of parsed out of model text by hand.
More about Pydantic AI
You create an Agent with a model string such as anthropic:<model> or openai:<model>, instructions, tools (decorated Python functions whose signatures become the tool schema), and an output type, often a Pydantic model. Dependency injection passes typed services such as a database connection into tools and instructions, and lets tests swap them out. You run an agent with run, run_sync or streaming. It needs Python 3.10 or later, and pydantic-ai-slim installs only the provider extras you use.
Switching providers is a string change across OpenAI, Anthropic, Google, Bedrock, Vertex, Azure, OpenAI-compatible services and local servers. Instrumentation emits standard OpenTelemetry, so traces go to Pydantic Logfire or any OTLP backend. Durable execution integrates with Temporal, DBOS, Prefect and Restate so a run survives crashes, adapters stream to frontends built on the Vercel AI SDK or AG-UI, and TestModel lets unit tests run without real model calls. It runs in your own process; the optional Pydantic AI Gateway is hosted or self-hosted.
It is Python only. It deliberately leaves storage to you: saving a conversation means serializing the message history into your own database. Cross-conversation memory, guardrails and coding-agent tools sit in a separate Pydantic AI Harness package.
How Pydantic AI itself is built
13 tools, from its own code, website and Product Hunt page.
Pydantic AI pros and cons
Themes that recur in makers' words and Hacker News comments, each linked to what it summarises.
Pros
- Handles the agent and tool-calling loop for you and makes switching between model providers easy. HNHN 2HN 3HN 4
- Lighter and less abstracted than LangChain or Google ADK, and familiar to anyone already using Pydantic. HNHN 2HN 3
- Durable execution through DBOS or Temporal and OpenTelemetry-based observability are supported. HNHN 2HN 3
- Capabilities and hooks make it a solid base for other libraries and custom harnesses. HNHN 2HN 3HN 4
Reliability and open issues
The most wanted open issue on GitHub has 34 👍.
Most wanted on GitHub
- support batch processing👍 34 · opened May 2025 · active Sep 2026
- Prompt management, versioning, and optimization👍 22 · opened Feb 2025 · active May 2026
- Support Anthropic and OpenAI Skills built-in tool👍 14 · opened Nov 2025 · active Oct 2026
Who uses it
No maker's live product on record yet, and 46 open-source projects that declare it in their code.
We haven't found a maker's live product that uses Pydantic AI yet — only the open-source projects below, which declare it in their code.
None of these in makers' own words.
Open source: a project that declares Pydantic AI as a dependency in its public code — verifiable, but not necessarily a live product.
What its projects tell coding agents
17 of the 31 open-source products built with Pydantic AI that were worked on in the last 180 days keep instruction files for coding agents — 55%, against 53% of all the projects we read. AGENTS.md is in 16, CLAUDE.md in 10.
Alternatives to Pydantic AI
All alternatives by situation →Further reading
Questions makers ask about Pydantic AI
What are the alternatives to Pydantic AI?
For AI SDK & agent framework, the other options makers' products we track chose most are LangChain (66), Mastra (24), LlamaIndex (16), AI SDK (5), CrewAI (3), LangGraph (1). Open source or self-hostable among them: LangChain, Mastra, LlamaIndex, AI SDK, CrewAI, LangGraph. Each alternative, with the situation it fits, is on the Pydantic AI alternatives page.
When should you use Pydantic AI?
You want a small typed agent loop in Python, close to the raw API (AI SDK & agent framework). Something else fits better if: your app is TypeScript and you want agents without adding a Python service, pick AI SDK or Mastra; your agent works on files and runs commands, like a coding or research agent, pick Claude Agent SDK.
Which model providers does it support?
You pick a provider with a <provider>:<model> string: OpenAI, Anthropic, Google, AWS Bedrock, Vertex AI, Azure and others, plus OpenAI-compatible services and local model servers. Each has a setup guide covering its options. source ↗
Do I have to use Logfire for observability?
No. Instrumentation emits standard OpenTelemetry spans for every model and tool call, and any OTLP backend works. Logfire is the easiest option, not a requirement. source ↗
How do I save a chat and continue it later?
Serialize the message history to JSON with ModelMessagesTypeAdapter and store it in your own database, for example in a jsonb column. The framework leaves the schema to you. source ↗
Can a run survive a crash or restart?
Yes, with durable execution. Integrations are co-maintained for Temporal, DBOS, Prefect, Restate and AWS Lambda, and a builder lets you connect another engine. source ↗
Can I use it behind a frontend built with the Vercel AI SDK?
Yes. VercelAIAdapter speaks the AI SDK data stream protocol that useChat expects; with FastAPI or another Starlette app, one call handles the request and streams the response. source ↗
How do I test agents without calling an LLM?
Swap in TestModel or FunctionModel with Agent.override, and set ALLOW_MODEL_REQUESTS=False so tests can't hit a real model by accident. source ↗
Which Python versions are supported?
Python 3.10 and later. The pydantic-ai-slim package lets you install only the extras for the providers you use. source ↗
Is Pydantic AI free?
Yes — it is free, open-source software.
Is Pydantic AI open source or self-hostable?
Open source, and you can self-host it. source ↗
Can AI coding agents work with Pydantic AI?
It serves an llms.txt docs index.
Who uses Pydantic AI?
No maker's live product we track yet; 46 open-source projects declare it in their code. source ↗