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 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 docs 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]'

To run the examples, follow instructions in the examples.