Pydantic AI
A Python agent framework published by the Pydantic team. You declare the type of the expected answer, and every model reply is validated against it: if it doesn't fit, the model is asked again to fix it. Switching models takes one string, and a second model can take over when a provider goes down.
Strengths
- Typed output: every reply is validated against the type you declare
- Automatic retry of the model when validation fails
- Provider-independent: switching models takes one string, with an optional fallback model
- MIT licence
Limitations
- Python only
- The output retry budget defaults to 1: raise it if your model often misses the format
Best for
- Structured data extraction from text, with a result your code can read without checking
- Python agents that need to be able to switch model provider