Durable Jobs: Work That Resumes Where It Stopped
ForkTex Engineering · November 27, 2026 · 3 min
A durable workflow is work split into steps whose progress is saved after every step. If the process running it crashes or is redeployed, the next process picks up at the step that was interrupted. forktex-flow is our open-source Python library for exactly that.
Your own processes do the work, and PostgreSQL holds every workflow's state. There is no message broker, no queue and no extra service to run.
The problem
Most software has work that does not belong inside a web request: importing a supplier's catalogue, sending a report every morning, setting up a server. The usual answer adds a message broker and a fleet of workers, and with them a second system to deploy, watch and back up. When a worker dies halfway, the work is lost or half done, and someone finds out later.
How it works
| Concept | What it is |
|---|---|
| Definition | A process: steps joined by arrows, using the element names of BPMN. Each change is a new version. |
| Instance | One run of a definition, with its own variables. It finishes on the version it started on. |
| Step | An async Python function that returns only what it changed. |
| Job | One step of one instance. Two processes never claim the same job. |
| Leader | One process at a time fires schedules and hands back the jobs of a process that died. |
BPMN (Business Process Model and Notation) is the standard diagram language for business processes. Because the names match, a process drawn in Camunda Modeler can be imported, and a process written in code reads the same to someone who draws them.
Two steps in one file
flow = Flow(os.environ["DATABASE_URL"], drive=True)
async def create_account(ctx: Ctx, signup: Signup) -> dict:
return {"user_id": "u_" + signup.email.split("@")[0]}
async def send_welcome(ctx: Ctx, signup: Signup) -> dict:
return {"welcomed": True}
flow.pipeline("users.signup", state=Signup, steps=[create_account, send_welcome])If the process dies after create_account, the next process to start finishes the workflow with send_welcome. create_account does not run again.
Beyond a pipeline
- Schedules: a workflow on a cron, fired once, by the leader.
- People: a task waits until someone approves it, and the process then branches on the answer.
- Customers: each one's definitions and instances live in a namespace of their own, and a definition can be deployed as data while the system runs.
- Agents: a language model can decide which tools to call, and each call is kept like any other step.
Where it runs
A tyre e-commerce store we built imports supplier feeds on a timer and from uploaded files, sends a daily report and prunes expired sessions. All of it runs inside the store's API process, one job at a time, so a long import never crowds out customers.
Our deployment platform plans deployments, applies releases and tears environments down as workflows, and reconciles what is running every thirty minutes. Our ERP platform moves its background work onto it next.
What to know
A job can run more than once: if a process dies mid-job, the job runs again, so its side effects must be safe to repeat. A definition has no loops; repeated work is a new instance. And the connection to PostgreSQL must be direct, or through a pooler in session mode, because the leader is elected with a lock.
Try it
pip install forktex-flowforktex-flow is open source, on GitHub and PyPI, under AGPL-3.0-or-later or a commercial licence. It needs Python 3.14 and PostgreSQL 14 or newer.
Case Studies
ForkTex Cloud, Declarative Deployment
Our own deployment platform: one manifest describes a system, and the platform provisions its servers, writes its DNS, obtains its certificates and ships it into blue and green slots.
Tyre Catalogue and Storefront Rebuild
A typed catalogue platform replacing an ageing off-the-shelf storefront, with faceted search, an ingestion pipeline and an admin surface that a non-developer can run.