The Postgres-Native State Machine: Unpacking earendil-works/absurd
How a single SQL file replaces complex distributed coordinators to bring durable execution to the everyday database.

I generally try to avoid bringing in extra complexity if I can avoid it, so I wanted to see how far I can go with just Postgres. To this end, I wrote Absurd 1, a tiny SQL-only library with a very thin SDK to enable durable workflows on top of just Postgres — no extension needed.
- Absurd replaces complex distributed execution clusters with a single PostgreSQL schema using PL/pgSQL state machines.
- The system relies on explicit step checkpointing rather than full code replays, making it highly ergonomic for workflows that cannot be strictly deterministic.
- By resuming execution precisely from the last successful step, Absurd naturally fits AI workloads where repeating expensive LLM API calls is cost-prohibitive.
The Database as the Coordinator
The software industry spent a decade extracting state and orchestration out of the database into complex microservices. Systems like Temporal provide incredible durability but require deploying and managing separate clusters, external metrics, and distinct storage layers. Absurd represents a violent pendulum swing in the opposite direction.
It proves that by aggressively leveraging modern PostgreSQL features, developers can achieve durable execution without a single external coordinator service. The entire brain of this system is just a set of Postgres tables and PL/pgSQL functions. It uses a pull-based model where a claim task function relies on Postgres locking semantics to hand work to workers safely.
Checkpoints Over Replays
Traditional durable execution often requires deterministic code because it replays the entire function from the start upon failure. Absurd takes a different path by focusing on explicit checkpoints.
When a developer wraps a side effect in a step context, the SDK checks the database. If a result exists, it returns it immediately. If not, it executes the code and persists the result. This checkpointing system anchors progress so the system does not fall back to the beginning if a failure occurs.
def run_workflow(ctx: TaskContext):
# If this succeeds, the result is saved in Postgres.
# If it crashes later, this step is skipped entirely on restart.
data = ctx.step('fetch_data', fetch_from_api)
# The workflow will resume exactly here.
processed = ctx.step('process', lambda: process_data(data))
return processed
The AI Workload Sweet Spot
Developers are adopting this experimental framework for generative AI pipelines. Complex AI workflows often involve chaining multiple expensive LLM API calls.
If a worker crashes on step three of a five-prompt chain, Absurd resumes at step three. This saves the significant cost and latency of hitting the API for the first two steps all over again.
Absurd is a durable execution system: it saves checkpoints as your task progresses, so a crashed task resumes from the last checkpoint, not from scratch. For quick jobs, this distinction doesn't matter much. For multi-step workflows with expensive API calls, it's the whole point.
Pushing Back Against Complexity
The project was created by Armin Ronacher, known for building Flask and Rye. It was born out of fatigue with the operational bloat required to run reliable background jobs for mid-sized architectures.
The Boundaries of Postgres
Absurd wins on operational simplicity but places significant pressure on a single relational database. Massive horizontal scale will still demand dedicated systems like Temporal.
However, it is not just a standard job queue. While tools like Solid Queue retry failed jobs from the beginning, Absurd is a true durable state engine that remembers exactly where it left off.
| Feature | Absurd | Temporal | Standard Job Queue |
|---|---|---|---|
| Infrastructure | Postgres only | Dedicated cluster & DB | Redis or Database |
| State Location | Database (PL/pgSQL) | Server & SDKs | Queue only |
| Recovery Style | Step Checkpoints | Full Event Replay | Retry from Start |
| Best For | AI Pipelines, Simplicity | Massive Scale, Enterprises | Simple Background Tasks |