← All projects

durable-python

Make Python async functions durable and resumable with a minimal, pluggable runtime.

An open-source Python library (durable-python on PyPI, v0.1.1) that turns ordinary async def functions into checkpointable, resumable programs. An AST transformer rewrites the function body into an ordered list of CodeBlocks; a runtime drives execution, persists state on PauseForEventException, and resumes from the last checkpoint when the awaited event arrives. Ships with InMemoryStateStore and a cloudpickle-backed DiskStateStore, plus a pluggable OrchestrationBackend interface so other agent frameworks can wire in their own event bus. Python 3.12+, MIT-licensed.

Distilled from the durable-execution core inside Playbooks and released as a standalone primitive - a few hundred lines you can read end-to-end. AST-level program transformation is a corner of Python rarely touched outside frameworks like Temporal or DBOS, and the project is a worked example of extracting reusable infrastructure from a larger product and shipping it as its own package, with GitHub Actions for test/lint and full Poetry/ruff/black/pytest-cov setup.