Updated

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.

Open sourceSelf-hostableFree tier

Profile checked

Works with AI agents:llms.txt
Ask your AI about this, with this page as the source:ChatGPT ↗Claude ↗Perplexity ↗

How makers use Pydantic AI

What Pydantic AI is used for

AI SDK & Agent Framework · Thin SDK →Python agents whose outputs must validate against typed schemas, across any model provider.Trade-off: Python only, with fewer prebuilt integrations than the broad frameworks.
LangChain66Mastra24LlamaIndex16AI SDK5CrewAI3Pydantic AI0Makers' products on each, for AI SDK & agent framework

Pydantic AI vs the alternatives makers chose

OptionMakers' productsOpen source
LangChain66 57%Yes
Mastra24 21%Yes
LlamaIndex16 14%Yes
AI SDK5 4%Yes
CrewAI3 3%Yes
LangGraph1 1%Yes
Pydantic AI0 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

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.
From each decision's guide, written from what makers' products chose and why.

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

Open on 2026-10-04 in pydantic/pydantic-ai, with activity in the last year — issues and feature requests by 👍.

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.

Dify
DifyPlatform for building LLM apps, agents and RAG workflows in a visual editor, hosted as D…AI SDK & Agent FrameworkIn its code · source ↗
Zep
ZepHosted context layer for agents that turns business data, documents and conversations in…AI SDK & Agent FrameworkIn its code · source ↗
Paid
PaidBilling platform for AI agents that meters agent events into value-based units, prices a…AI SDK & Agent FrameworkIn its code · source ↗
blueking-paas
blueking-paas蓝鲸智云 PaaS 平台是一个开放式的开发平台,让开发者可以方便快捷地创建、开发、部署和管理 SaaS 应用。它提供了完善的前后台开发框架、服务总线(ESB)、API Gate…AI SDK & Agent FrameworkIn its code · source ↗

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.

659words in the median file
uvthe package manager most named, in 7 of 17 files
59%say how to test a change
Named more in these files than in other projects' — in how many of the 17:
What AGENTS.md files say about other tools →What open-source products tell their coding agents →

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 ↗