Favicon of Pydantic AI

Pydantic AI

Open source Python AI agent SDK with typed outputs, Ollama support, and an optional self-hosted model gateway. Licensed MIT.

Screenshot of Pydantic AI website

Pydantic AI is a Python SDK for developers building AI agents into their own applications. Its main draw is Pydantic validation across agent tools and results, so an agent can return structured data that application code can check and use. The SDK is MIT licensed.

Agents run in a Python application, including on a server you control. Pydantic AI supports Ollama for local models alongside providers such as OpenAI, Anthropic, and Google. Model requests go to the backend you choose. Its built-in test model works fully offline for trying agent behavior, but it doesn't call a real LLM. The optional Pydantic AI Gateway can also be self-hosted.

The same agent can sit behind a web interface, run in a terminal, handle live voice, or work through a background job. Developers can give it function tools and require validated output, which suits tasks such as data extraction and support workflows. The SDK also covers embeddings and image generation. Pydantic AI Harness adds reusable capabilities for longer agent tasks, including memory, planning, guardrails, and a coding agent with file and shell access.

For work that must survive interruptions, Pydantic AI integrates with workflow engines including Temporal, DBOS, and Prefect. It emits OpenTelemetry data for tracing, while separate Pydantic packages cover graph workflows and agent evaluation. Voice agents can use OpenAI Realtime or Gemini Live, and agents can connect to tools through MCP.

Similar to Pydantic AI