Durable execution

Durable execution

Durable execution

TL;DR

TL;DR

Durable execution is a way of running multi-step code so that it survives crashes, restarts, and long waits by recording each completed step and resuming from the last one instead of starting over.

Durable execution is a way of running multi-step code so that it survives crashes, restarts, and long waits by recording each completed step and resuming from the last one instead of starting over.

What is durable execution?

Durable execution is a way of running multi-step code so that it always finishes, even when servers crash, networks fail, or the process has to wait for days. The runtime records the result of each step as it completes. If something breaks, the code resumes from the last recorded step instead of starting again.

The idea was made popular by workflow engines such as Temporal and Azure Durable Functions, and durable workflows are now offered by many platforms. A developer writes ordinary-looking code, and the durable execution engine handles state, retries, and recovery. For any process where repeating a step would be harmful, such as charging a card, this is the difference between safe and unsafe automation.

Key takeaways

  • Definition: code that survives failures by saving progress after every step.

  • How: an event history is recorded and replayed to restore state.

  • What it prevents: lost work, half-finished processes, and duplicated side effects.

  • AI relevance: agents run long, multi-step tasks with unreliable calls, which is the case durable execution was built for.

How durable execution works

A durable program is split into two kinds of code. The workflow is the orchestration logic: do this, then that, wait, branch. Activities are the steps that touch the outside world, such as calling an API, sending an email, or querying a database.

  1. The engine starts the workflow and runs the first activity.

  2. When the activity finishes, its result is written to an event history in durable storage.

  3. The workflow continues to the next step, and each result is recorded the same way.

  4. If the process dies, a new worker loads the history and replays the workflow. Completed steps return their saved results without running again.

  5. Execution continues from the first step that has no recorded result.

Two rules follow from replay. Workflow code must be deterministic, so it makes the same decisions when replayed. Activities should be idempotent, meaning that running one twice has the same effect as running it once, because a crash can happen after an action completes but before its result is saved.

What a durable execution engine provides

Capability

What it does

Example

Persistent state

Saves progress after every step

A refund workflow survives a deployment

Automatic retries

Repeats failed steps with backoff

A payment API timeout is retried three times

Durable timers

Waits for hours or days without holding a server

A reminder is sent seven days after a request

Signals

Pauses for an outside event

A workflow waits for a manager’s approval

Compensation

Undoes earlier steps when a later one fails

A reserved credit is released if the refund is declined

Visibility

Shows the state and history of each run

Support can see exactly where a case is stuck

Durable execution vs queues vs workflow automation

Approach

How state is kept

Failure handling

Best for

Durable execution

Event history managed by the engine

Automatic resume from the last step

Long, multi-step processes with side effects

Message queue

In messages and application databases

Developer writes retry and recovery logic

Simple, independent jobs

Scheduled scripts

In whatever the script writes

Manual rerun

Small periodic tasks

No-code workflow tools

In the tool’s run log

Varies by tool

Simple integrations

Durable execution is the layer underneath reliable AI workflow automation. The research paper Durable Functions: Semantics for Stateful Serverless gives a formal account of how one such engine guarantees progress.

Why durable execution matters for customer support

Many support requests are processes, and some run for a long time. A card dispute has regulated deadlines measured in days. A return is not finished until the carrier scans the parcel and the refund posts. An account review may wait for the customer to upload a document.

Without durability, a failure in the middle leaves the case in an unknown state: the refund may or may not have gone out, and nobody can tell without checking by hand. With it, each case has a recorded position and continues from there. In financial services support this matters for compliance as well as service, as the guide to Reg E error resolution workflows shows. The shift toward agents that complete work is covered in this post on how AI in customer support is evolving from workflows to AI agents.

Durable execution example

A customer asks for a refund on a returned item. The workflow checks eligibility, creates a return label, waits for the carrier to scan the parcel, issues the refund, and sends a confirmation. The wait for the scan lasts four days, during which the workflow uses no computing resources. On day four the scan arrives and the refund step runs, but the server restarts just after the payment provider accepts the request. A new worker loads the history, sees that the refund has no recorded result, and runs the step again with the same idempotency key. The payment provider recognizes the key and does not pay twice. The confirmation email goes out, and the case closes.

How is durable execution measured?

The core measure is workflow completion rate: the share of started workflows that reach a final state. Next to it, track stuck workflows that have not progressed within their expected time, retry counts per step, and time to recover after an outage.

Duplicate side effects should be zero. Any case of a double refund or a repeated message points to an activity that is not idempotent. For support, these measures roll up into autonomous resolution: a request counts as resolved only when the whole process finished.

Why AI agents need durable execution

An AI agent is a long-running program with unreliable parts. Model calls time out or hit rate limits. A tool calling step can fail halfway. A task may pause for a human in the loop approval that arrives the next morning. If the agent keeps its progress only in memory, any of these loses the work, and a restart may repeat actions already taken.

Durable execution gives an agent a recorded history of what it has done. Each model call and tool result is saved, so a restarted agent continues without redoing completed steps. This works alongside AI agent orchestration and AI agent memory: orchestration decides what to do, memory holds what the agent knows, and durability makes sure the work completes.

For buyers, the practical question is whether a platform’s actions are reliable from start to finish. Fini resolves requests that involve actions such as refunds and account changes, and escalates with context when a step needs a person. These guides compare action-taking AI support agents, AI support software for B2C refund workflows, and AI agents for multi-step ServiceNow workflows.

How to use durable execution

  1. Identify processes with side effects. Start with anything that moves money or changes an account.

  2. Separate orchestration from actions. Keep decision logic in the workflow and outside calls in activities.

  3. Make every activity idempotent. Use idempotency keys so a repeated call has no extra effect.

  4. Set retry policies per step. Retry timeouts, and stop on errors that will not fix themselves.

  5. Model waits explicitly. Use timers and signals for approvals, customer replies, and deadlines.

  6. Add compensation. Define how to undo each step if a later one fails.

  7. Log every run to an AI audit trail and alert on stuck workflows.

Common durable execution mistakes

The classic mistake is non-deterministic workflow code, such as reading the current time or a random number directly. On replay the value differs and the run fails. The second is assuming the engine prevents duplicates by itself. It guarantees a step is attempted until it succeeds, so the step must be safe to repeat.

Teams also change workflow code while long-running instances are still active, which breaks replay for cases started under the old version. Version workflows and let old runs finish on the code they started with.

Frequently Asked Questions

What is durable execution in simple terms?

Durable execution means a program remembers every step it has finished. If the server crashes or the process has to wait for days, it picks up from the last completed step instead of starting over. This makes long, multi-step processes reliable.

How does durable execution work?

The engine records the result of each step in an event history. After a failure, a new worker replays the workflow code, uses the saved results for steps that already completed, and continues from the next one. Failed steps are retried automatically according to a policy.

What is a durable execution engine?

A durable execution engine is the runtime that stores workflow state, schedules steps, retries failures, and resumes interrupted runs. Temporal, Azure Durable Functions, and AWS Step Functions are well-known examples. Developers write the workflow logic, and the engine handles reliability.

What is the difference between durable execution and a message queue?

A queue delivers messages and leaves state, ordering, and recovery to the application. Durable execution tracks the whole process, including which steps are done, and resumes it after a failure. Queues suit simple independent jobs. Durable execution suits multi-step processes.

Why do AI agents need durable execution?

Agents run long tasks made of model calls and tool calls that can fail or pause for approval. Durable execution saves each result, so an agent can resume after a crash without repeating actions such as a refund. It also lets a task wait for hours without losing its place.

Does durable execution guarantee a step runs only once?

No. It guarantees the step is retried until it succeeds, which means it may run more than once after a crash. To get the effect of exactly once, the step must be idempotent, usually through an idempotency key that the receiving system uses to ignore duplicates.

Learn More

Learn More

Workforce optimization (WFO)

W

Customer self-service

C

Prompt caching

P

AI sycophancy

A

Computer use agent

C

System prompt

S

Backchanneling

B

Omnichannel customer support

O

Voice biometrics

V

Non-human identity (NHI)

N

Semantic caching

S

Time to first token (TTFT)

T

AI audit trail

A

Conversational AI greeting

C

Agent assist vs AI agent

A

Knowledge base

K

Average handling time (AHT)

A

Telephony

T

Customer acquisition cost (CAC)

C

Business process outsourcing (BPO)

B

AI tokens

A

Human in the loop (HITL)

H

AI grounding vs retrieval-augmented generation (RAG)

A

Short message service (SMS)

S

Call center

C

Data annotation

D

Ticket routing

T

Customer service quality assurance (QA)

C

Live chat

L

Speech Synthesis Markup Language (SSML)

S

Batch inference

B

Barge-in

B

SLA compliance rate

S

Queue management

Q

Prompt versioning

P

Emotion detection

E

Retrieval-augmented generation (RAG)

R

Natural language understanding (NLU)

N

Text classification

T

Call routing

C

Customer churn rate

C

Speech-to-speech

S

Intent recognition

I

Voice of the employee (VoE)

V

Confidence score

C

Resolution-based pricing

R

AI personalization

A

Voice cloning

V

Asynchronous messaging

A

Hallucination

H

ReAct agent pattern

R

Long-term memory

L

Forecast accuracy

F

Customer feedback loop

C

Structured output

S

Outbound voice AI

O

AI guardrails

A

Direct preference optimization (DPO)

D

Prompt chaining

P

SIP transfer

S

Fallback intent

F

Conversation summarization

C

Auto-tagging

A

Cost per contact

C

VoIP jitter

V

Model card

M

Ticket prioritization

T

Sentiment analysis

S

Agent utilization rate

A

Speech-to-intent

S

Prompt engineering

P

Knowledge atlas

K

SOC 2 AI support

S

Prosody

P

Chatbot containment rate

C

Speech synthesis

S

Fine-tuning

F

ISO 42001

I

Intent-based search

I

After-call work (ACW)

A