New Tool Radar

AI Agents & Automation

How to Build Checkpoints So a Long-Running Agent Can Resume

Save checkpoints during a long agent run, so a crash resumes from the last good step instead of starting over.

Schematic illustration with three step boxes: pick the checkpoint points, save state at each point, and test a crash resume.

A long-running agent that holds all its state in memory loses everything when it crashes: the plan, the tool results, the partial draft. Checkpoints fix that by saving the state at defined points, so the run can resume from the last good step. The checkpoint must hold the full state the agent needs to continue, not just a status flag.

Before you start

An agent that runs for minutes or hours, and a store where checkpoints can be written and read back.

Pick the checkpoint points

Choose the points where the state is complete and worth saving: after each major tool result, after each stage of a multi-step task, and before any irreversible action. A checkpoint after every step is safest but slowest; a checkpoint only at the end is no checkpoint at all.

Write the points into the workflow, not into the prompt: the agent cannot be trusted to save its own state.

Save the full state at each point

At each checkpoint, save the plan, the completed steps, the tool results so far, and the next step to run. A checkpoint that saves only the status cannot resume the work.

Save the state to durable storage, not to memory, and confirm the write succeeded before the run continues.

Test a crash and a resume

Kill the agent mid-run in a test environment and resume it from the last checkpoint. Confirm it continues from the right step, does not repeat the irreversible actions it already did, and finishes the task.

Test the resume after a long gap too: a checkpoint that expires in an hour is useless for a run that resumes tomorrow.

Practice check: fictional Maple Corner research agent, 12-step task

The table below is fictional practice material, worked out by hand from the stated checkpoint plan. It is the expected result for the practice run, not a run of any agent.

Checkpoint State saved Resume test Verdict
After step 4, search done Plan + 4 results Resumed at step 5 Pass
After step 8, draft done Plan + draft Resumed at step 9 Pass
After step 12, sent Final state No resume needed Pass
Crash at step 7 Last checkpoint step 4 Resumed at step 5 Pass

A crash at step 7 resumes from the step 4 checkpoint and continues at step 5, redoing only three steps. No irreversible action is repeated.

Expected result. UNTESTED: the checkpoints in the practice table are worked out by hand, not measured by running an agent. Pick the checkpoint points in your own long run, save the full state at each one, and test a crash resume in a safe environment.

Limits

  • A checkpoint that saves only a status flag cannot resume the work: save the plan, the results and the next step.
  • Resuming must not repeat irreversible actions: the checkpoint must record which ones already ran.

Sources

See all