How Python does AI
ไปฅไธๆๅฝ่ช่ฏฅไปๅบ็ README๏ผ็ๆฎต๏ผ ยท ๅจ GitHub ่ฏปๅฎๆด README โ
Agents, realtime voice, image generation, embeddings. Every model, every interface, typed end to end.
---
**Pydantic AI** is the Python AI SDK: a typed, extensible agent loop with every model a string swap away. The same agent runs everywhere you need it: behind a web frontend, in the terminal, on a voice call, on a durable background queue, in GitHub Actions, or as a plain object you call run() on. Image generation and embeddings come in the same box; Pydantic Graph and Pydantic Evals are separate packages, for typed control flow and for testing agent behavior the way pytest tests code.
**Pydantic AI Harness** has everything an agent needs for complex, long-running work, snapped on as capabilities, from memory, guardrails, and sub-agents to planning, context management, and persistence, up to a complete coding agent.
Pydantic Logfire is the AI observability platform that sees your whole app, not just the LLM calls, and the Pydantic AI Gateway is one key for every model with real-time cost monitoring and budget control; the Gateway self-hosts if you would rather, and our instrumentation is plain OpenTelemetry, so any backend you already run works. Underneath both, genai-prices keeps model pricing current, and Monty is the sandboxed Python interpreter that runs model-written code.
View the complete documentation at pydantic.dev/docs/ai.
What are you building?
From simple typed data extraction to complex, long-running multi-agent collaboration, Pydantic AI and Pydantic AI Harness have got you covered.
Coding agent
A complete coding agent in your terminal: workspace-rooted file access, allowlisted shell, repo orientation, planning, and context management that survives long sessions. Here with web search and a second-opinion advisor snapped on alongside:
Coder is a regular combined capability, not a black box: use it whole, or use the blocks it bundles directly; the two are equivalent:
Run the file and you're chatting with the agent in your terminal. To try it before writing any code, run the exported coder_agent with clai (the Pydantic AI CLI), via uvx:
**Build this โ** Coder, from the Harness
**Run it on GitHub โ** GitHub Agentic Workflows, on issues, pull requests or a schedule
Data extraction
Give the agent an output type and tools, and every run comes back validated and typed:
The @agent.tool function receives a RunContext that carries your dependencies in; the rest of its signature and its docstring become the tool schema, arguments are validated before your code runs, and the run is guaranteed to return a Sentiment, so your IDE, type checker, and the LLM all agree on the returned type.
**Build this โ** Agents, Function Tools, and Structured Output
Durable workflow
Attach TemporalDurability and the same agent runs inside a Temporal workflow under durable execution: every model and tool call becomes a durable activity, so a run working through a background queue survives restarts, failures, and long waits:
DBOS and Prefect attach the same way, first-party and co-maintained, with Restate, AWS Lambda, Kitaru, Airflow, Absurd, and pgtask integrations besides.
**Build this โ** Durable Execution
Realtime voice
Put the same agent on a live voice session, tools and capabilities included:
The model calls your tools mid-conversation while it keeps talking, and every session is instrumented; voice is just another frontend, on OpenAI Realtime, Gemini Live, Azure, and xAI Grok Voice.
**Build this โ** Realtime Voice
Image generation
Generate an image with a dedicated image model, no agent run required:
That standalone image API is for when your application decides; when an agent run decides, there is provider-native generation with output_type=BinaryImage for a typed image output, and the ImageGeneration capability with its fallbacks for models that generate no images of their own.