pydantic/pydantic-ai
PydanticAI is a production-grade Python agent framework built by the team behind Pydantic — the validation library that powers OpenAI, Anthropic, Google, LangChain, and LlamaIndex SDKs. It brings the same FastAPI feeling to generative AI development: a clean, type-safe, developer-first API that catches errors at development time rather than runtime surprises in production. At its core, PydanticAI lets you define agents as composable containers holding instructions, typed tools, dependency injections, and structured output validators. Agents are model-agnostic and support 20+ LLM providers including OpenAI, Anthropic, Google Gemini, Amazon Bedrock, Mistral, Groq, Cohere, and self-hosted options via Ollama. The dependency injection system makes it straightforward to swap backends for testing without mocking. The framework ships with streaming structured outputs validated in real time, human-in-the-loop tool approval workflows, graph-based workflow orchestration via pydantic-graph, durable execution for long-running tasks, and native Model Context Protocol and Agent2Agent protocol support. First-class observability is built in via Pydantic Logfire (OpenTelemetry-compatible). Released in late 2024, it has grown to over 15,600 GitHub stars with an extremely active release cadence.
Why It Matters
PydanticAI brings rigorous type safety and validation — already trusted by every major LLM SDK — directly into the agent layer, making it significantly easier to build reliable, testable, production-ready AI systems in Python with model-agnostic design that runs against any supported provider without restructuring.