AgentenCode · Field guide

Durable Execution for AI Agents: Reliable Long-Running Workflows

Learn checkpoints, replay, idempotency and human approval for long-running agent processes.

AgentenCode Editorial · November 25, 2026 · Expanded technical reference

Original AgentenCode conceptual editorial illustration: Durable Execution
Original editorial illustration; not a vendor image or documentary screenshot.

Why chat history is not enough

After an interruption an agent may remember user intent without knowing whether an external service accepted a request. Chat history does not substitute for reliable execution state. Durable processes need stable task identifiers, state transitions and recorded tool results. Restarting must not automatically repeat earlier actions.

Four forms of state and why they differ

Conversation state contains messages and model responses. Business state includes invoice number, validated amount and approved version. Execution state describes which steps are confirmed and which remain outstanding. External state resides at the destination: an order or posting may already exist there before the agent application learns about it. Durable execution must distinguish these layers.

When everything is stored in one prompt, links between business decisions and external effects are often ambiguous. A better design persists stable execution ID, business object version, last confirmed process status and external references. Model output can remain supplementary evidence but is not the authoritative database for a posting. Record state transitions atomically or through traceable events.

Checkpoints and replay

Temporal documents workflows backed by durable execution history; LangGraph describes checkpointers for graph state and interruptions. These models differ. In replay-based workflows, orchestration code must be deterministic enough to reconstruct decisions consistently from history. Nondeterministic model calls and external actions belong in isolated steps whose results are recorded.

Temporal and LangGraph: different execution models

Temporal describes workflows whose execution can be reconstructed from event history. Workflow code must follow replay and determinism requirements; external operations generally run as activities. An activity may be executed again after failure. Idempotent handling of external effects is therefore essential. Re-executing workflow logic is not equivalent to repeating an external effect.

LangGraph documents persisted graph state and checkpointers supporting interruption and resumption. Depending on graph structure and persistence configuration, steps or portions may execute again. Applications still must decide how model calls and external operations are bounded. These systems are not interchangeable products with identical semantics. Examine exact recovery boundaries, persistence options and versioning support for your design.

Documentation: Temporal – Workflows · Temporal – Retry policies · LangGraph – Persistence

Idempotency for side effects

A lost response may mean an external service succeeded even though an agent observed an error. Retries therefore require stable idempotency keys and status queries at the destination. If an interface lacks these capabilities, use an explicit reconciliation strategy. Do not confuse a workflow engine's guarantee with global exactly-once semantics for arbitrary external effects.

The dangerous window between action and acknowledgment

A workflow submits a posting to an ERP. The ERP records it and creates a reference. Before the worker receives the response, the worker crashes. Local state still says submitting. If restart simply reads that state and creates another posting, the same transaction may be recorded twice. This failure can occur even with a perfect language model.

A stable idempotency key such as tenant_id plus invoice_id plus posting_version lets the destination recognize repeated submissions. Ideally persist the key with the business task before the initial call. The destination must actually honor the key; a local identifier alone does not prevent repeated external effects. If status cannot be established, the workflow should enter reconciliation rather than blindly writing again.

Crash after an external side effect. The ERP may have committed even though the worker has not persisted acknowledgment.
Crash after an external side effect
The ERP may have committed even though the worker has not persisted acknowledgment.

Example: invoice review and posting

The agent extracts an invoice identifier, matches it against a purchase order and prepares a posting proposal. Approval binds to the proposal version. After approval, the workflow submits the posting using a stable key. On timeout it queries posting status first. After restart it resumes from the latest confirmed state rather than treating the original user request as a new task.

Transaction patterns: outbox, inbox and reconciliation

A common architectural pattern is the transactional outbox: business state and an event to be sent are durably stored together before a dispatcher sends the message. Since delivery may occur multiple times, a receiver can use an inbox or unique event ID for deduplication. These patterns can complement workflow engines; they are not automatically provided by every engine or tool.

Where an external system lacks a shared transaction, reconciling both states matters. A reconciliation job might locate tasks marked awaiting_confirmation and compare them against the destination. Define outcomes for found, absent, conflicting and unavailable. Automatic rollback is not always possible. A reversal or cancellation is a new business operation whose evidence must remain available.

Recovery through status checks. Conceptual decision tree: status, idempotency and reconciliation before a new write.
Recovery through status checks
Conceptual decision tree: status, idempotency and reconciliation before a new write.

Human approval over days

Approval may take hours or days. The workflow should not need an active model loop while waiting. Persist the approval request, identity, expiry and decision reason. If an amount, destination account or document version changes, invalidate the old consent. Specify how a task expires, is cancelled or is compensated.

Test and observe

A useful test kills a worker immediately before and after an external side effect. Other cases include duplicate messages, stale approvals, model timeouts, workflow version changes and faulty checkpoints. Track recovery rate, duplicate effects, unresolved tasks and time to recovery. A successful happy path does not prove robust error handling.

Worked example: retries and capacity

Suppose a workflow needs five external steps, each with a hypothetical 98 percent first-attempt success probability. Under the simplifying assumption of independent failures, the probability of all five succeeding without retries is about 90.4 percent. Among one thousand tasks, approximately 96 would have at least one failed first attempt. This is a mathematical illustration, not observed service reliability.

Retries can improve completion but cannot fix correlated outages, invalid data or missing permissions. Set retry limits, backoff, deadlines and explicit states. A task awaiting approval for three days should not occupy an active worker or model loop. A workflow system can manage waiting state and later events; model costs arise only when model calls are needed. Evaluate concrete infrastructure and storage costs separately.

First attempts: five external steps. Illustrative probabilities: 98% per independent first attempt; not measured product reliability.
First attempts: five external steps
Illustrative probabilities: 98% per independent first attempt; not measured product reliability.

A minimal state model

A durable task might have created, awaiting_approval, submitting, awaiting_confirmation, completed and failed states. Its execution ID remains stable across restarts. Every transition has allowed predecessors and retains only data needed to resume. A result object might contain the posting ID and confirmed status rather than just a textual summary of model output.

A checkpoint immediately before a side effect does not establish that the action has not already happened. Record intended calls and use the same task ID when querying status. If the result cannot be reconstructed, move to a reviewable reconciliation state instead of an endless retry loop.

Retries, deadlines and compensation

Distinguish temporary errors such as timeouts from permanent ones such as invalid authorization. Temporary failures may justify bounded retries with increasing delays. Business conflicts often require a new decision instead. Set a maximum duration and escalation path. A multi-stage process may require a compensating action for earlier effects; compensation is a new controlled action, not automatically a perfect rollback.

Treat compensation as a separate task with a stable identifier, result check and audit record. A cancelled purchase or corrected posting should not simply disappear from history. This transparency helps subsequent root-cause analysis.

Versioning and approval across long executions

Imagine an invoice review started on Monday, approved on Wednesday and scheduled for posting on Friday. Meanwhile tax schema, model version or workflow implementation changes. Approval must remain tied to the verified amount and document version. Recalculation may require new consent. Existing executions must remain understandable under their original process logic.

Depending on execution model, operate workflow versions in parallel, make compatible changes or explicitly document migrations. Deployment must not silently change the meaning of persisted states. Define how long earlier workers or versions are supported, how terminated processes are handled and who decides compensation. These are operational decisions, not questions a language model should answer spontaneously.

Documentation: Temporal – Workflows · LangGraph – Persistence

Pilot and privacy

Create a failure catalogue with deliberately injected interruptions and define expected recovery behavior at each point. Compare externally confirmed status with persisted workflow state. Begin with fictional data and a reversible destination operation. Introduce real business transactions only after documented recovery checks.

Durability also means sensitive information may persist longer. Specify retention, deletion, access control and separate telemetry. Prefer references to full confidential inputs where practical. When updating a model or workflow, ensure earlier active executions remain understandable.

Acceptance scenarios: failures at defined points

A useful integration test interrupts execution before a tool call, after sending, after the external write and after local acknowledgment. In each case eventual state must match the destination. Also test duplicate events, status endpoint outage, denied approval, expired consent and workflow upgrades during a wait. Start with fictional systems whose effects can be counted and reversed.

Operational metrics include unresolved tasks, age of pending approvals, recovery time and confirmed duplicates. Define escalation rules before real postings. A task should only be completed once authoritative external state is confirmed. For consequential effects we prefer explicit needs_reconciliation instead of declaring failure or success after an uncertain timeout.

AgentenCode assessment

For multi-step enterprise agents with real actions, durable execution is often more valuable than added autonomy. We prefer deterministic control flows around probabilistic model steps. A complex workflow engine may be unnecessary for a one-off summary; state and recovery are worth the effort for postings, payments and long-running approvals.

Decision matrix

StateProblemResponse
PendingWorker crashCheckpoint
SentLost responseQuery status
ApprovalStale approvalReapprove
DoneDuplicateCheck key

Frequently asked questions

Is durable execution memory?

No. Memory retains information; durable execution retains progress and events.

Does it guarantee exactly-once effects?

Not for arbitrary external actions. They need their own idempotency and status mechanisms.

What is a checkpoint?

A persisted state that enables resumption.

When is a retry risky?

When the previous attempt may already have caused a side effect.

Do I need Temporal?

Not necessarily. Choose by duration, failure model and existing infrastructure.

What should I test first?

An outage between an external action and its acknowledgment, followed by recovery.

Did AgentenCode lab-test the named products?

No. Our assessment combines public vendor documentation with original conceptual examples and calculations. Suitability must be tested in the specific environment.

Primary sources and methodology

Claims are grounded in the linked primary sources and original editorial analysis. Examples are illustrative; AgentenCode has not independently tested products, certified security or measured keyword volume. Sources reviewed November 25, 2026.

  1. Temporal – Workflows
  2. Temporal – Retry policies
  3. LangGraph – Persistence
  4. OpenAI – Running agents

Our evidence methodology

NEWSLETTER · FREE · GERMAN EDITION

More signal. Less AI noise.

Our source-backed German-language digest of major AI developments, agent updates and knowledge articles. The weekly edition is being prepared.

Double opt-in: Subscription starts only after email confirmation. Your details are sent to Brevo when you submit.