New Tool Radar

AI Agents & Automation

How to Recover an Agent Run That Failed on a Model Timeout With a Retry

Retry a timed-out agent run from the last good step instead of from the start, so the work already done is not repeated.

Schematic diagram with three steps: Find the last good step, Retry from the checkpoint, then Check for duplicates.

A model timeout is a failure of the call, not of the work: the steps before it are usually fine, and re-running them wastes calls and can repeat side effects. The recovery is to resume from the last good step, using the saved state or the log, and to check for duplicates before you trust the result.

Before you start

You need a failed run with its log, showing which step timed out and which steps finished before it. Note any step with a side effect, such as a sent message or a written row, because those must not run twice.

Find the last good step in the log

Open the run log and list the steps in order, marking each as done or failed. The timeout step is the failed one; everything before it is done. If the graph uses a checkpointer, the saved state already marks this boundary: LangGraph stores pending writes from nodes that completed at the same step as a failed one.

Retry from the last good step and check for duplicates

Resume the run from the last good step: in LangGraph, invoke the graph with no new input and the same thread_id, which loads the latest checkpoint and retries the unfinished work. Then check the side effects: a message or row that already exists must not be created again.

Worked example: A timed-out run for a fictional orders agent

Northwind Orders is a fictional orders desk. Its agent run timed out on the third step. The table shows the recovery.

Step Status before retry After retry
1 Done: order 1042 read Not repeated
2 Done: summary drafted Not repeated
3 Failed: model timeout Retried, reply written
4 Not reached Run completes

Expected result (UNTESTED): the retry completes the run without repeating steps 1 and 2, and the summary is written once. We checked the LangGraph checkpointers documentation, which describes resuming from the latest checkpoint, but we did not run the recovery on this machine.

Limits

A retry is only safe when the finished steps can be recognised: without a checkpoint or a log, you cannot tell what ran. For steps with side effects, check the target system before you retry, or the same refund, message or row can happen twice.

Sources

See all