Skip to content

Installation

PydanticAI is available on PyPI so installation is as simple as:

pip install pydantic-ai
uv add pydantic-ai

It requires Python 3.9+.

Use --prerelease=allow with uv

Until Pydantic v2.10 is released (very soon), you'll need to use --prerelease=allow with uv to install PydanticAI.

Use with Pydantic Logfire

PydanticAI has an excellent (but completely optional) integration with Pydantic Logfire to help you view and understand agent runs.

To use Logfire with PydanticAI, install PydanticAI with the logfire optional group:

pip install 'pydantic-ai[logfire]'
uv add 'pydantic-ai[logfire]'

From there, follow the Logfire setup cods to configure Logfire.

Running Examples

PydanticAI bundles its examples so you can run them very easily.

To install extra dependencies required to run examples, install the examples optional group:

pip install 'pydantic-ai[examples]'
uv add 'pydantic-ai[examples]'

For next steps, follow the instructions in the examples.