Skip to content
47% off: the complete course for $79 (reg. $149)Order now →
Agent Builder
Module 11Full course17 min read

Durable Execution for Long-Running Agents

Keep agents running for hours or days without losing work: checkpoints, resumable workflows, durable execution engines, and idempotent steps.

The checkpointing worker from the last lesson survives a crash mid-run. Long-running agents need more than that. Most of a long run's life is spent waiting, not computing: for a manager to approve a refund, for a CI pipeline to finish, for a customer to reply, for the "check back in three days" follow-up. Meanwhile you deploy new code twice, a worker stalls and a second one picks up the same run, and the downstream API times out halfway through creating an invoice.

This lesson turns your checkpoints into full durable execution: a step journal, runs that suspend while waiting, durable timers, leases so a run never executes twice, steps that are safe to repeat, and runs that outlive your deploys. Then you'll see how engines like Temporal, Inngest, Restate, and DBOS package the same ideas, so you can decide whether to build or adopt.

What "durable" has to cover

The previous lesson's checkpoints covered one failure: a worker dying mid-run. A run that lasts hours or days meets a longer list:

SituationWhat goes wrong without a planThe mechanism that fixes it
Worker crashes mid-stepWork repeats or is lostCheckpoints and a step journal
Waiting for a human for two daysA worker sits blocked, or the wait is lost on restartSuspend and resume
"Follow up on Friday"An in-memory timer dies with the processDurable timers
Two workers grab the same runEvery step runs twiceLeases with fencing
A step half-completes in an external systemDuplicate or orphaned recordsIdempotent step design
You deploy new prompts mid-runThe run resumes with code that doesn't match its historyVersion pinning

Each row is a small, specific mechanism. Together they're what people mean by durable execution.