Skip to content
Docs
Request access

Durable runs

Coming soon

Resume after a crash Before the crash the start step was acknowledged and the work step was cut short. resume writes run.resumed and closes open reservations. After resume the start step is not run again, the work step runs again from its start in a new epoch, then the gates step runs. Before the crash startacknowledged by the moveto assigned workcut short by the crash gatesnot started resume(run_id, plan)only when the previous engine is gone; writes run.resumed,closes reservations the crash left open, runs each task from its step After resume startacknowledged:never run again workruns again from its startin a new epoch, recordedfirst as step_restarted gatesruns after work Before the crash startacknowledged by the moveto assigned workcut short by the crash gatesnot started resume(run_id, plan)only when the previous engine is gone;writes run.resumed,closes reservations the crash leftopen, runs each task from its step After resume startacknowledged:never run again workruns again from its startin a new epoch, recordedfirst as step_restarted gatesruns after work
One task whose work step was cut short. The first attempt's calls and actions may be repeated; the budget and the ledger show both.
Diagram as text
  1. Before the crash: the start step was acknowledged (the move to assigned); the work step was cut short.
  2. resume(run_id, plan) runs only when the previous engine is gone. It writes run.resumed and closes reservations the crash left open.
  3. An acknowledged step is never run again.
  4. The step that was cut short runs again from its start, in a new epoch, recorded first as a step_restarted decision.
  5. Then the gates step runs.

A run can be interrupted by a crash or a restart. A durable run keeps enough to continue.

Status: Coming soon. Durable runs are not offered until a real crash-and-resume test passes: a durable run killed mid-run, restarted, and resumed from its recorded state with the ledger intact.

What is built today: a run that is interrupted resumes from its last acknowledged step: finished steps are not run again, the step that was cut short runs again from its start, and the ledger records it (step_restarted). The light engine (SQLite or PostgreSQL) and an optional Temporal engine are supported; Temporal’s dev server is for evaluation only.

These three parts of durable runs are not built yet:

  • A decision route for tasks that need a person (needs_human).
  • CLI sign-in for starting runs.
  • Starting runs with an API token.

Each task goes through three steps. A step is acknowledged by one transaction that also writes its ledger entry.

Step Starts when the task is Acknowledged by
start proposed the move to assigned
work assigned or in_progress the move to submitted, which stores the output
gates submitted or verifying the move out of verifying

The engine’s resume(run_id, plan) continues a run that has run.started and no run.ended, and only when the previous engine is gone (see “Precondition” below). It writes run.resumed, closes reservations the crash left open, and runs each task from its step.

  • An acknowledged step is never run again: a task found in submitted or verifying does not call its worker again.
  • A step that was cut short runs again from its start, in a new epoch, recorded first as a step_restarted decision. The calls and actions of the first attempt may be repeated, and the budget and the ledger show both. No model responses are stored for replay.
  • Without stored content (an in-process run), a task found submitted goes to a human.

Resume is allowed only when the engine that was running the run is gone. Nothing in the engine can prove that, so a caller who knows passes previous_engine_gone=True. Without it, resume refuses if the run wrote to its ledger a moment ago or has a model call reserved less than the reconcile age ago (a call that may still be in flight). This keeps two engines from working on one run.

A durable run is driven by one of two engines, and the run records which one in run.started.

Engine Use it for Limits
light (the engine for a self-hosted server with no Temporal address) Self-hosting and evaluation. No cluster: it runs on your own database. One light engine per database, no horizontal scale, failover no faster than the 60 second lease, second-level timers, and a stopped server runs nothing. Not for production load.
temporal (NURAMESH_TEMPORAL_ADDRESS set) Production, and always for a hosted deployment. Needs the temporal extra (installed from the wheel, see the Temporal quickstart) and a Temporal cluster.

The Temporal dev server is for evaluation only; production needs a real Temporal cluster.

Both engines call the same engine methods with the same clock, so a run behaves the same on either. On the temporal engine, and on a runner started with the fake model only, a durable run uses the fake model only: a plan that names a real model is refused. The light engine admits a real model only when the plan passes its start checks: an approved model, a current key, a known price, a budget that covers it, the data class you state, and a sandbox for any test-command gate.

On this version the engine follows from your setup: a server with a Temporal address (NURAMESH_TEMPORAL_ADDRESS) uses Temporal; the light engine is the one for a server without it. There is no separate setting to pick the engine yet.

Switching the engine is not supported in this release. A run belongs to the engine that started it; after a switch the new engine does not pick it up, so the run is stranded (it stays unfinished and does nothing). There is no startup check that warns you and no supported way to move runs between engines yet. Finish or stop all runs first, then switch.

A task that waits for a human decision keeps its input for at most 90 days from the moment it was captured. This applies to tasks waiting in verifying, on both engines:

  • 14 days and 3 days before the end, the approvers are warned. A warning is a ledger entry (human_wait_warning); it shows as a wait_warning field on the run’s detail (GET /v1/runs/{id}) for people who may decide (the approvals list and the app do not show it yet), and, when email is configured, one short mail with fixed words (no task title, no output) to each person who may answer the gate: the approvers the gate names, or every member who may decide when it names none. A mail that fails never blocks the wait. With email off, nothing tells the approvers except that field and the ledger entry. The mail can arrive twice in a rare crash window, never more than twice.
  • At 90 days the wait stops: a human_wait_expired entry is written and the task is cancelled with a plain reason; tasks that depend on it are cancelled too. A decision that arrives later is refused as expired. The check uses the store clock and the stored times, so a clock that jumps forward cannot stop a task early.
  • A halted organization gets no warning mail and no stop while it is halted; the clock keeps running, and when the organization resumes the stop is applied if the deadline has passed.

Tasks that end in needs_human have no warning and no 90-day stop yet; the retention sweep does not remove them yet.

Durable runs on Temporal are an optional extra (the temporal extra of the wheel, the nuramesh.temporal module). The library, the command line and the in-process engine need no Temporal. The Temporal dev server is for evaluation only; production needs a real Temporal cluster.

resume is an engine call. There is no nuramesh resume command yet.

Was this page helpful?