pydantic-graph
the six Ws · specification
Maintained by the Pydantic team alongside the Pydantic AI project.
pydantic-graph is a standalone async graph and state-machine library where nodes and edges are defined with plain Python type hints, usable with or without Pydantic AI.
Distributed as the pydantic-graph Python package, imported into any Python application.
Released alongside Pydantic AI in 2024 and updated as part of the pydantic-ai monorepo through 2026.
It exists to give advanced users explicit, typed control flow for complex agent or workflow logic instead of implicit loops.
Has no dependency on pydantic-ai itself, only on Python's typing and Pydantic core; agents built with it may call any LLM API.
Open-source under MIT license, runs entirely locally as a pure Python library with no data sent anywhere by the library itself.
alternatives