# Pydantic AI

A typed Python SDK for building AI agents that can run behind a web frontend, in a terminal, on a voice call or as a background job, with the same agent portable across models and interfaces.

Pydantic AI is a Python SDK for building AI agents: a typed, extensible agent loop where switching models is a string change. The same agent can run behind a web frontend, in a terminal, on a voice call, on a durable background queue, in GitHub Actions, or as a plain object with a run() method. Image generation and embeddings are built in, and companion packages, Pydantic Graph and Pydantic Evals, add typed control flow and testing for agent behavior.

Pydantic AI Harness adds capabilities for long-running work, such as memory, guardrails, sub-agents, planning, context management and persistence, up to a complete coding agent with workspace-rooted file access, an allowlisted shell and repository orientation.

Related components include Pydantic Logfire for observability across a whole application rather than only its model calls, a gateway that gives one key for many models with cost monitoring, a pricing lookup package, and a sandboxed Python interpreter for running model-written code.

Website: https://pydantic.dev/pydantic-ai
