This is an early release preview. You may encounter bugs.
Pydantic AI logo
Unclaimed

Framework coding

Pydantic AI

Python agent framework from the Pydantic team for building type-safe, model-agnostic generative-AI applications and workflows

Built by Pydantic

A+ 90/100 GitHub score ? This grade is derived from GitHub signals, not user votes. Open for the full breakdown.
100% recommend · 1 rater

01 / About

What Pydantic AI is.

Pydantic AI is a Python agent framework from the team behind Pydantic. It gives you a typed, extensible agent loop where the model is a string you swap — OpenAI, Anthropic, Google, Bedrock, Azure AI Foundry, Groq, Mistral, xAI, Ollama, and others — and the same agent definition runs as a plain object you call run() on, a command-line interface, a web chat, a realtime voice session, or a durable background job.

Typing runs end to end: give an agent an output type and every run comes back validated, dependency injection and tools are typed, and Pydantic Graph applies the same typing to graph-based control flow. Structured outputs, image generation, and embeddings are part of the same package.

Behaviour is composed from capabilities — reusable units that bundle tools, instructions, hooks, and model settings. The core package ships fundamentals such as Model Context Protocol support and web search; a companion harness package adds memory, sub-agents, context compaction, a filesystem and shell, repo orientation, and planning, and composes them into complete agents such as a coder and a researcher. Agents can also be declared in YAML or JSON specs instead of code.

Durable execution is supported first-party on Temporal, DBOS, Prefect, and Restate, with external SDK integrations for Kitaru and Airflow: model and tool calls become durable activities, so a run survives restarts and long waits, and human-in-the-loop tool approval is built in. Instrumentation is OpenTelemetry-native and works with any OTel backend, and Pydantic Evals tests agent behaviour the way pytest tests code.

Frontend integration covers the AG-UI protocol and the Vercel AI Data Stream Protocol for streaming text, tool calls, and reasoning to a UI, plus an experimental Agent Client Protocol mode that serves an agent to an editor. A built-in test model lets you start without an API key.

Features

  • Model-agnostic: swap providers with a string, or route through a gateway with one key, failover, and cost monitoring
  • Typed end to end: structured outputs, typed dependency injection, and typed tools, checked by your type checker
  • Capabilities: reusable units bundling tools, instructions, hooks, and model settings, composable into complete agents
  • Harness package: memory, sub-agents, context compaction, filesystem, shell, repo context, and planning
  • MCP and web search: Model Context Protocol servers and web search ship in the core package
  • Durable execution: first-party support for Temporal, DBOS, Prefect, and Restate, with human-in-the-loop approval
  • Every interface: the same agent runs as a library call, CLI, web chat, realtime voice session, or editor agent
  • UI event streams: AG-UI and Vercel AI Data Stream Protocol support for streaming to your own frontend
  • Observability: OpenTelemetry-native instrumentation that works with any OTel backend
  • Evaluation: Pydantic Evals scores any Python function, agents included
  • Graph control flow: Pydantic Graph brings the same typing to graph-based workflows
  • Agent specs: declare an agent in YAML or JSON instead of Python

02 / Discussion CREDIBILITY-GATED

Discussion

Reading is open to everyone. Posting and voting need a verified identity or a GitHub grade of B or higher.

  • No discussions yet.

04 / Build

Build with Pydantic AI.

Browse the catalogue for frameworks, tools, and harnesses, each scored on real GitHub credibility.

Get Pydantic AI →

Browse the catalogue