Skip to content

pgtask

pgtask is a durable task and workflow engine for PostgreSQL.

You store tasks in your database and run them from your own processes. There is no broker, no coordinator, and no PostgreSQL extension.

You enqueue a task in the same transaction that writes your application data. If the transaction rolls back, the task never existed. That one property removes most of the consistency problems queues usually introduce:

async with connection.transaction():
    await create_report(connection, report_id)
    await Client.enqueue_on(connection, render.request({"report_id": report_id}))

Not ready for production

pgtask is under active development. The contracts described here are still changing.

What you get

Four properties describe the engine better than a feature list.

One dependency. PostgreSQL owns every durable transition. Workers are ordinary processes you deploy and scale yourself.

Leases, not acknowledgements. A worker holds a fenced lease while it runs your handler. If the worker disappears, the task returns automatically.

Durable workflows. Steps, sleeps, signals, and child tasks are database transitions, so a workflow survives a process restart.

One protocol, many languages. Rust, Python, TypeScript, Go, and plain SQL speak the same versioned set of database functions.

Where to start

Pick the entry point that matches what you need right now.