Pydantic
Data validation and settings management using Python type annotations — the cornerstone of FastAPI and the modern AI stack
Visit Pydantic →Pydantic validates data against Python type annotations at runtime, converting and rejecting bad input based on the types you’ve already declared — no separate schema definition language required. It’s the validation layer FastAPI uses for request bodies and the foundation much of the modern AI/agent tooling stack is built on for structured LLM outputs.
Pydantic AI extends the same type-safety approach specifically to building AI agents, if you’re looking for that rather than general data validation.
Upgrading from v1? See Pydantic v1 to v2, and for loading configuration from environment variables and .env files see python-dotenv vs pydantic-settings.