AI Agent Reliability

AI Agent Failure Recovery: Contain, Reconcile, Repair, Resume

For workflow owners who need a failed agent run to stop safely, preserve evidence, and resume without repeating an external effect.

Uli PrantzBuilds and operates all-agents
Published
Key takeaways

Key takeaways

  • Recovery begins by stopping new effects and preserving the run, not by asking the model to try the whole task again.
  • Classify the failure by what happened in the outside world: no effect, confirmed effect, ambiguous effect or harmful effect. Each needs a different path.
  • Retry only transient, idempotent operations with a budget and jitter. Never retry an ambiguous side effect until the destination has been reconciled.
  • Use rollback where state can truly be restored; use a named compensating action where it cannot, and require human approval for consequential repair.
  • Resume from the last verified checkpoint with the same business key and updated preconditions, then add the case to the regression set.
Recover an AI agent run by stopping further effects, preserving its evidence, reconciling what actually happened outside the workflow, and choosing rollback, compensation, bounded retry or human repair. Resume only from a verified checkpoint under the same business identity. A whole-task retry is unsafe whenever an earlier attempt may already have acted.

Classify the failure by its external effect before choosing a retry

“The agent failed” says nothing about recovery. The model may have returned invalid data before any action, a destination may have rejected a write, or the network may have timed out after the write succeeded. Those cases look similar in the orchestration log and require different responses.

Google's SRE guidance warns that retries can amplify failures and recommends bounded backoff with jitter; its incident guidance prioritizes stopping damage, restoring service and preserving evidence. Apply those principles at the workflow-run level.

Effect state is the recovery routing key.
Effect stateMeaningAllowed next move
No effectFailure occurred before a destination accepted the actionCorrect input or retry a transient step within budget
Confirmed effectDestination proves the intended change landed onceAdvance from the verified checkpoint; do not repeat
Ambiguous effectTimeout or partial response leaves destination state unknownReconcile by business key; block retry until known
Wrong reversible effectState changed incorrectly and can be restored completelyAuthorized rollback, then verify restoration
Wrong irreversible effectMessage sent, disclosure made or action cannot be erasedContain, notify, compensate where possible and require human incident ownership

Use a fixed recovery sequence when the run path was variable

  1. 01ContainCode
    Pause the run, stop queued effects for the same scope, trip the relevant circuit breaker and preserve the last known state. Do not erase the failed attempt.
  2. 02Preserve and notifyTrigger
    Snapshot instructions, inputs, model and tool versions, trace, approvals, idempotency keys, destination responses and timestamps. Alert the owner according to consequence and time sensitivity.
  3. 03Reconcile effectsCode
    Query destinations using stable business keys. Classify each planned action as absent, present once, duplicated, partially applied or unknown.
  4. 04Choose repairHuman approval
    For consequential cases, a named owner chooses retry, rollback, compensation, manual completion or abandonment and records why.
  5. 05Execute repair exactly onceCode
    Use a new repair ID linked to the original run while retaining the original business key. Check authorization and current preconditions before changing anything.
  6. 06Verify and resumeHuman approval
    Confirm postconditions, then resume from the last verified checkpoint. Re-read mutable source state; do not trust the stale snapshot as current truth.
  7. 07LearnCode
    Create a regression case, assign a systemic fix and track it to verified closure. Keep the incident record linked to the test.

A retry needs an eligibility rule, budget, and business key

Minimum retry contract for one step.
FieldExampleReason
Eligible errors429, 502, connection reset before acceptanceBusiness or validation errors do not improve with repetition
Maximum attempts3 totalPrevents infinite work and overload
BackoffExponential with random jitterAvoids synchronized retry storms
Time budget90 seconds or before customer deadlineA technically successful late retry may still be wrong
Idempotency keyticket-4421:eng-handoff:v2Connects attempts to one intended effect
Reconciliation queryLookup by external reference or business keyResolves a timeout-after-success ambiguity
Exhausted pathOwned recovery queue with severity clock“Failed” is not a finish condition

Retry the smallest safe step, not the entire agent plan. If classification succeeded and only a read-only lookup failed, repeat the lookup. Replanning can choose a different path and invalidate the assumptions behind prior approvals.

Circuit breakers and load shedding protect dependencies as well as the workflow. When a destination is failing broadly, adding autonomous retries can turn a small outage into a cascading one. Pause, degrade to a manual queue, or accept less work until the dependency recovers.

Rollback restores state; compensation addresses what cannot be erased

Call an action a rollback only when it returns the system to the verified prior state without leaving a material effect. Deleting a duplicate internal draft may qualify. Sending a correction after a wrong customer email does not; the first message was still read. That is compensation and incident response.

Choose the repair that matches reversibility.
Failed effectRepair patternApproval
Incorrect internal tagRestore previous tag and verify queue stateAutomatic if rule and scope are fixed
Duplicate internal recordMerge or retire duplicate; preserve cross-referenceHuman if records have downstream work
Wrong permission changeContain access, restore known-good permissions, investigate exposureSecurity owner
Incorrect customer messageStop follow-ups, approve a correction and preserve both messagesCustomer owner
Money or contract effectUse the qualified finance/legal incident and compensation processPermanent accountable human gate

Worked example: timeout after creating an engineering ticket

Simulated recovery traceSimulated example data
Run R-881 calls an engineering system with key ticket-4421:handoff:v2. The client times out and the orchestrator records an ambiguous effect. The workflow pauses rather than retrying. Reconciliation queries the destination by external reference and finds ENG-944 created once with all required fields. The run records a confirmed effect, repairs only the missing reciprocal link in the support ticket using repair ID RP-102, verifies both links and resumes at “await engineering acknowledgement.” The timeout becomes a regression case that asserts one engineering item and two reciprocal references after repeated client timeouts.

Without reconciliation, a whole-task retry could have created ENG-945 and paged a second team. The safest recovery did not ask a model what probably happened; it inspected the destination.

A workflow is not recoverable until its recovery path is exercised

  • Every external effect has a business key, reconciliation query and owner.
  • Every step states whether it is retryable, reversible, compensatable or human-only.
  • Checkpoints record verified postconditions, not merely “step completed.”
  • Repair permissions are narrower than ordinary execution where possible and fully audited.
  • The team regularly tests timeouts, partial failure, destination outage, stale approval and rollback failure.
  • Recovery measures include containment time, ambiguous-effect duration, duplicate effects, successful compensation, resume success and repeat incidence.

Preserve the failure and repair as an append-only chain: original intent, authority, events, effect reconciliation, decision, repair action, verification and regression-test reference. The AI agent audit trail guide specifies the event envelope behind that chain.

Limitations and when not to use this

  • This is a general workflow-recovery pattern, not an incident plan for safety, security, privacy, financial, legal or regulated events. Use qualified owners and the applicable response process.
  • Idempotency and rollback depend on the actual destination API and business semantics. Test them against current systems; a client-generated key alone does not guarantee deduplication.
  • Do not allow a model to authorize its own repair, infer that an external effect occurred, or decide compensation for a person. Reconcile facts and keep accountable human gates.

Sources

  1. Managing incidentsGoogle Site Reliability Engineering Accessed 3 August 2026
  2. Addressing cascading failuresGoogle Site Reliability Engineering Accessed 3 August 2026
  3. Service best practicesGoogle Site Reliability Engineering Accessed 3 August 2026

Map the recovery path

Add checkpoints, effect verification, retry budgets, compensation and escalation to one live workflow.

Map the recovery path
About the author

Uli Prantz

Builds and operates all-agents

Uli Prantz builds all-agents, the process-automation platform this site documents. He writes about the operational side of automating recurring business work: where deterministic code beats model judgment, where it does not, and where a human still has to approve.

Bring one process. We will scope it in 30 minutes.

You leave the call knowing whether it is a fit, what can become code and what still needs a person.

Book a discovery call