Skip to content
AI agents in production

How should an AI agent recover when a step fails?

Make the run resumable: save state after every step so a crash or timeout resumes from the last checkpoint instead of starting again. Retry transient errors automatically, but only for steps that are safe to repeat — a tool that sends money or email must be idempotent or checked before retrying. Cap retries and steps, and hand the task to a person when a limit is reached, as OpenAI's guide recommends for exceeded failure thresholds.

Published
22 October 2026
Sources checked
22 October 2026
From
Kramiva

01

Why agents need this more than ordinary code

Agent runs are long, stateful and expensive. Anthropic notes that in agent systems errors compound, and restarting a long run from the beginning is costly and frustrating for users; it built its research agents to resume from where an error occurred instead.

02

How it works

  • Checkpoint state after each step: LangGraph's checkpointers do this per thread, with a database-backed saver for production
  • Durable execution: platforms such as Temporal record each step so a workflow continues after a crash — Temporal calls it crash-proof execution
  • Retry with backoff for transient errors: rate limits, timeouts, network faults
  • Idempotency for side effects: a repeated call must not charge, send or delete twice
  • Limits and escalation: a maximum number of steps, retries or spend, after which a person takes over

03

An illustrative example

An agent processing a batch of supplier invoices crashes on number 37 of 50 because an accounting API times out. With checkpoints, it resumes at 37. Because each posting carries a unique key, the API rejects a duplicate if invoice 37 was in fact posted before the timeout. If the API keeps failing, the batch is paused and a person is notified rather than the agent retrying indefinitely.

04

Trade-offs

Durable execution and checkpoints add infrastructure and storage. Not every agent needs them: a short, read-only task can simply be re-run. They become necessary as soon as runs are long, expensive, or able to change things in other systems.

Where Kramiva fits

In Kramiva's AI automations the system drafts and proposes and a person commits anything irreversible — which also limits what a failed or repeated step can do on its own.

Sources

  1. How we built our multi-agent research system — Anthropic, 13 June 2025
  2. LangGraph persistence — LangChain
  3. The definitive guide to Durable Execution — Temporal, 6 May 2025
  4. A practical guide to building agents — OpenAI

Accessed 22 October 2026. Kramiva is not affiliated with these publishers.

Start

Tell us what you are building.

A short brief gets you a real reply from a founder within one business day — an honest read on fit, scope, and budget.