A typical AI agent task in production looks like this: read a support ticket, look up the order, call the payment provider, wait for a manager's approval, issue the refund, email the customer, update the CRM. Some steps take milliseconds; one takes two days.

If that runs inside an API request or a cron job, you'll eventually get the worst outcome: the refund issued twice, or the email sent with no refund. Durable execution prevents that.

How durable execution works

You write the workflow as ordinary code. The engine records the result of every step. If anything fails or restarts, it replays the workflow, skips completed steps using the recorded results, and continues.

export const refundWorkflow = workflow(async (ticketId: string) => {
  const order = await step("find-order", () => findOrder(ticketId));
  const decision = await step("draft", () => agent.proposeRefund(order));

  if (decision.amount > 100) {
    await waitForSignal("manager-approval", { timeout: "48h" });
  }

  await step("refund", () => payments.refund(order.id, decision.amount, { idempotencyKey: ticketId }));
  await step("notify", () => email.sendRefundConfirmation(order.customer));
});

The primitives you get:

  • Steps with automatic retries and backoff
  • Durable sleep and timers, for minutes or months
  • Signals and events, for human approvals and webhooks
  • Idempotency, so each step's side effect happens once
  • Visibility: see every running workflow and its current step

When you need it

Use a durable engine when a job:

  • Has multiple steps with side effects (payments, emails, external APIs)
  • Waits on humans, webhooks or rate limits
  • Must compensate on failure, for example releasing reserved stock
  • Runs longer than your serverless function timeout

For simple "send this email later" jobs, a queue is fine. For no-code orchestration of SaaS tools, see n8n vs Zapier vs custom.

The options in 2026

Engine Model Good fit
Temporal Self-hosted or cloud; workers in many languages Complex, high-volume, multi-team systems
Restate Lightweight runtime, durable functions and state Teams wanting durability with a small footprint
Inngest Event-driven; runs on your serverless functions Next.js and serverless startups
Trigger.dev Managed long-running tasks for TypeScript Background jobs and AI tasks in TS stacks
Vercel Workflow Durable workflows native to Vercel Apps already deployed on Vercel
AWS Step Functions State machines on AWS AWS-native teams

Investment in this category has grown through 2026 as agent workloads have taken off. Restate, for example, raised a $20M round. Expect the tooling to keep improving quickly.

Patterns that matter for AI agents

Make every side effect idempotent

Pass an idempotency key (the workflow or step ID) to payment, email and CRM APIs. Retries then become safe.

Put LLM calls in steps

Model calls are slow, flaky and expensive. Wrap each one in a step so a crash after a successful call doesn't pay for it twice. Route the calls through your LLM gateway for fallbacks.

Human-in-the-loop as a signal

Approvals are just events. The workflow waits, durably and at no cost, until someone clicks "approve" in Slack or your admin panel.

Version your workflows

Long-running workflows outlive deployments. Use the engine's versioning so in-flight runs finish on the old logic while new runs use the new one.

Compensate, don't just fail

If step 5 fails permanently, run compensations for steps 1–4: refund the charge, release the stock, notify the user.

Bottom line

If your agent can take more than a few seconds or touch money, make it durable from day one. It's far cheaper than reconciling half-finished jobs by hand later. It's a core layer of the production agent architecture we recommend.

Our automation and custom software teams design and build durable workflows for agents, billing and operations. Let's scope yours.

Frequently asked questions

What is durable execution?

A way of running code so that every step's result is persisted. If the process crashes, is redeployed or waits for days, the workflow resumes exactly where it left off without repeating completed steps.

Do we need durable workflows or is a queue enough?

A queue is enough for single, independent jobs. Once a job has multiple steps, waits on external events, needs compensation on failure or runs for longer than a few minutes, a durable workflow engine saves you building one badly yourself.

Which durable workflow engine should a startup use?

On Vercel or a serverless stack, Inngest, Trigger.dev or Vercel Workflow are the quickest to adopt. For complex, high-volume or multi-language systems, Temporal is the most mature. Restate is a strong lightweight option. Choose by hosting model and team skills.