Pydantic AI
The agent framework from the Pydantic team — typed agents, structured outputs, tool calling, retries, and evals built around Pydantic validation, with first-class multi-provider and fallback support.
Production AI is a system: context, tools, permissions, traces, evals, and feedback loops around the model.
What it is
Pydantic AI is a Python agent framework: you define an agent with a model, instructions, tools, and a typed output schema, and the framework handles validation, model retries on schema failure, streaming, usage limits, and fallback across providers. Its companion pydantic-evals covers datasets, deterministic evaluators, and LLM-as-judge scoring; Pydantic Logfire instruments the runs.
Why it matters
It brings the type-safety discipline Python teams know from FastAPI to agents: structured output is the default, not an add-on, and the abstraction stays thin enough to read. For teams that found heavyweight frameworks opaque, it is the credible middle between raw SDK calls and a framework that owns your architecture.
How we use it
Pydantic AI is the default agent framework in our production stack. Every completion runs through one instrumented seam — budget check, model construction with fallback chains, the call, usage logging — and pydantic-evals drives the regression suites that gate prompt and model changes.
Related resources
The Python library for defining data schemas as typed models with runtime validation — the layer that turns model output from 'probably JSON' into objects your code can trust.
The scaffolding around an AI agent — prompt construction, tool dispatch, retry logic, trace emission, state management — that turns a model into a workflow participant.
Short for 'evaluations' — the test cases and harness that measure whether an AI workflow is working, before and after every change.
Making a model return data in a declared schema — JSON that validates against a Pydantic or Zod model — so downstream code consumes typed fields instead of parsing prose.