Back to all articlesEnterprise Workflows

The Replacement Is the Resume: Durable Execution So AI Agents Survive Crashes Without Duplicate Work

Record every completed step so a crashed agent can be replaced mid-run. Idempotency keys and durable journals prevent duplicate charges and lost approvals.

Mapki

Mapki

Oct 29, 2026•5 min read
Share:
The Replacement Is the Resume: Durable Execution So AI Agents Survive Crashes Without Duplicate Work

The Replacement Is the Resume: Durable Execution So AI Agents Survive Crashes Without Duplicate Work

Why a crashed agent must be replaceable

Production workers die. Deploys roll. Network partitions happen. An agent that has already completed three expensive model calls, written a draft, and is waiting on a human approval cannot restart from the beginning. Restarting is not resuming.

The New Stack published on 28 October 2026 the exact failure mode: “Restarting execution isn’t safely resuming work.” Durable frameworks record progress, but side effects that completed while a step was still pending leave the replacement agent without evidence of what the external system actually did. The journal is necessary; it is not sufficient. The system of record remains the authority.

Vercel’s Workflow SDK documentation makes the same distinction: conversation history preserves model context; execution records establish which operations completed and what should happen next.

What durable execution actually records

  • Completed step results: Model calls and tool invocations whose outputs have been persisted are not re-executed on replay.
  • Orchestration state: The coordinating logic can be re-run safely because it is deterministic.
  • Waiting points: Approvals, timers, and external signals survive process death.

LangGraph provides this via checkpointers and thread IDs. Temporal, Restate, DBOS, Inngest, and Vercel Workflows provide it via event history and activities/steps. The OpenAI Agents SDK and Pydantic AI now document integrations that wrap model requests and tool calls as durable units.

A 2026 arXiv study (2610.34620) on containerized LLM agent deployments found that of systems that must keep state beyond the process, 37.4% lose it on restart and 41.5% lose it on container replacement. The contracts exist in documentation; the guarantees are routinely missing in deployed code.

Three patterns that survive production

1. Split orchestration from activities

The workflow code decides the next step. Activities or steps perform the non-deterministic work (LLM calls, HTTP, database writes) and record their results. On recovery the workflow re-executes its logic and reuses recorded activity results.

Vercel’s pattern marks the coordinating function with 'use workflow' and the external work with 'use step'. Temporal treats the agent loop as activities inside a workflow. LangGraph nodes become activities when wrapped.

Wrapping the entire agent loop in one step loses intermediate progress. Separate boundaries for each model call and each external tool preserve the expensive work.

2. Idempotency keys on every external write

An external operation can succeed before the step result is recorded. A retry then double-executes. The fix is an idempotency key derived from the step ID or a business identifier.

From Vercel’s guide:

import { getStepMetadata } from 'workflow';

export async function submitAction(endpoint: string, payload: object) {
'use step';
const { stepId } = getStepMetadata();
const response = await fetch(endpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Idempotency-Key': `action:${stepId}`,
},
body: JSON.stringify(payload),
});
// handle response
}

The payment provider, the CRM, or the database remains the system of record. The agent’s journal narrows the investigation; it does not replace authoritative confirmation. The New Stack piece is explicit on this.

3. Human approval as a durable wait

Approvals that live only in memory die with the process. Durable hooks or signals keep the wait alive across deploys and restarts.

Vercel’s example races a hook against a seven-day timer:

using approval = createHook<{ approved: boolean }>({
token: `proposal:${proposalId}:approval`,
});
await Promise.race([
approval.then(decision => ({ kind: 'decision', approved: decision.approved })),
sleep('7d').then(() => ({ kind: 'expired' })),
]);

While suspended, no application process needs to stay running. Temporal signals and LangGraph interrupts serve the same purpose when the checkpointer is durable and the durability mode is synchronous.

Choosing the engine

Situation Starting point
Short reasoning graphs, approvals inside one system LangGraph + PostgreSQL checkpointer, "sync" durability mode
Runs that span days, deploys, or many external systems Temporal, Vercel Workflow SDK, or Restate
Existing agent SDK (OpenAI Agents, Pydantic AI) The documented durable integration rather than a rewrite
Hybrid LangGraph for the reasoning graph, Temporal for the outer durable shell

Meta’s “thin orchestrator” pattern (Engineering at Meta, 19 October 2026) pairs well: a deterministic router that owns sequencing and reliability checks, specialists that own domain work. The thin layer is easier to make durable.

Pre-ship verification

  1. Kill the worker between two steps. Confirm the run resumes and does not re-execute the completed model call.
  2. Force a retry on a side-effecting tool. Confirm the external system returns the original result rather than creating a duplicate.
  3. Deploy new code while a run is waiting for approval. Confirm the existing run stays on its original deployment (or is explicitly migrated with a replay test).
  4. Confirm that when the outcome is ambiguous, operators can still query the system of record. The journal is evidence, not authority.

These checks are mechanical. They catch the class of failures that only appear after the first production crash.

References & Community Insights

The video walks through exactly the crash-between-research-and-PDF scenario and shows the Temporal journal preventing the second LLM bill.

Durable execution does not make agents smarter. It makes them replaceable. That is the property production requires.

Want to implement this in your business?

Mapki designs bespoke AI agents, custom workflow automations, and tool-agnostic integrations tailored specifically to your existing ERP, CRM, and databases.

Tags:Durable ExecutionAI AgentsTemporalLangGraphIdempotencyProduction Reliability