pydantic-graph
Graph and state machine library
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has no security vulnerabilities, uses a permissive MIT license, and installs with low friction. It solves a real problem—type-safe, readable graph execution—using standard Python idioms. The recent release and high repository stars indicate active development. Install it if you need to orchestrate multi-step workflows or state machines with explicit, debuggable control flow.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later; async/await syntax required for node execution.
- Low install friction with a pure-Python wheel and 5 runtime dependencies (anyio, httpx, logfire-api, pydantic, typing-inspection).
- Active maintenance with a release 1 day old and 19277 repository stars.
License · maintenance · safety
MIT (permissive) — MIT license (permissive) means you can use this freely in commercial and private projects with minimal restrictions.
last release 2026-08-13 (1 days) · last repo commit 2026-08-14 · 19,277 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 110,997,194 downloads/mo, #320 on PyPI
Alternatives
Verify before relying
pip install pydantic-graph
from pydantic_graph import BaseNode, End, GraphBuilder, GraphRunContext
from dataclasses import dataclass
@dataclass
class MyNode(BaseNode[None, None, int]):
value: int
async def run(self, ctx: GraphRunContext) -> End[int]:
return End(self.value)
g = GraphBuilder(input_type=int, output_type=int)
result = await g.build().run(inputs=1)- Whether logfire-api is a required runtime dependency or optional for observability only.
- Performance characteristics with large graphs or long-running state machines.
- Whether the library supports synchronous execution or only async workflows.
What it is and what it does
Pydantic Graph is a type-safe graph and state machine library built on standard Python syntax. You define nodes as dataclasses with async run methods, and edges are inferred from the return type hints—when a node returns another node type, that becomes the next step; when it returns End, the graph terminates. The library prioritizes explicit, readable code over domain-specific magic, making it suitable for workflow orchestration, multi-step processes, and decision trees whether or not you're using Pydantic AI.
It depends on pydantic for validation, anyio for async coordination, httpx for HTTP operations, typing-inspection for type introspection, and logfire-api for observability. The library is actively maintained, recently released, and carries no known security vulnerabilities. It supports Python 3.10 through 3.14 and installs with low friction as a pure-Python wheel.
Use it for
- Build multi-step workflows where each step's output determines the next node to execute.
- Implement finite state machines with type-safe transitions defined by return type hints.
- Orchestrate async tasks in a directed acyclic graph with early termination via End.
- Create decision trees or approval pipelines where each node performs validation or transformation.
- Model agent-like behavior with state transitions without requiring a full AI framework.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has no security vulnerabilities, uses a permissive MIT license, and installs with low friction. It solves a real problem—type-safe, readable graph execution—using standard Python idioms. The recent release and high repository stars indicate active development. Install it if you need to orchestrate multi-step workflows or state machines with explicit, debuggable control flow.
Install
pydantic-graph on PyPI
Before you install
Low install friction with a pure-Python wheel and 5 runtime dependencies (anyio, httpx, logfire-api, pydantic, typing-inspection). Active maintenance with a release 1 day old and 19277 repository stars.
Requires Python 3.10 or later; async/await syntax required for node execution.
License in practice
MIT license (permissive) means you can use this freely in commercial and private projects with minimal restrictions.
Quickstart
pip install pydantic-graph
from pydantic_graph import BaseNode, End, GraphBuilder, GraphRunContext
from dataclasses import dataclass
@dataclass
class MyNode(BaseNode[None, None, int]):
value: int
async def run(self, ctx: GraphRunContext) -> End[int]:
return End(self.value)
g = GraphBuilder(input_type=int, output_type=int)
result = await g.build().run(inputs=1)
Verify before relying
- Whether logfire-api is a required runtime dependency or optional for observability only.
- Performance characteristics with large graphs or long-running state machines.
- Whether the library supports synchronous execution or only async workflows.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 5 packagesanyiohttpxlogfire-apipydantictyping-inspection |
| Maintenance | Actively maintained 1 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 110,997,194 / month, #320 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleEnvironment :: MacOS XIntended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: System AdministratorsLicense :: OSI Approved :: MIT LicenseOperating System :: POSIX :: LinuxOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: InternetTopic :: Software Development :: Libraries :: Python Modules |
Evidence: pydantic_graph-2.29.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “graph state machine library”
- pydantic-graphA graph and finite state machine library that lets you define…
- taskflowTaskFlow is a library for defining and executing workflows as…
- scikit-networkscikit-network provides graph algorithms and analysis tools for…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also pydantic-ai · pydantic-evals · pydantic-ai-slim · pydantic-ai-backend · python-statemachine · pydantic-ai-harness · pydantic-tes · pydantic-ai-todo · pydantic-deep · fasta2a