Recovers an agent run that crashed, stalled in a loop, or died with partial state: checkpoint discipline, failure classification, and resume strategies. Use when an agent run dies mid-task, a loop stops making progress, or partial work needs to be resumed instead of restarted.
./install.sh failure-recovery-playbooksname: failure_recovery_playbooks description: Recovers an agent run that crashed, stalled in a loop, or died with partial state: checkpoint discipline, failure classification, and resume strategies. Use when an agent run dies mid-task, a loop stops making progress, or partial work needs to be resumed instead of restarted. metadata: { "includeInPrompt": true }
Long agent runs die. Processes crash, loops stall, sessions vanish, and tools stop answering. Restarting from zero throws away everything the run already finished. This skill is the run-recovery playbook: keep cheap checkpoints while you work, classify the failure when it happens, and resume from the last good point instead of starting over. It operates at the agent-run level: crashes, stuck loops, and partial state. It does not cover swapping models or providers, routing requests, or degrading prompts.
A checkpoint is a small, fast-to-read record of where the run stands. Write one:
checkpoint.json in the run's working directory. One file, always overwritten, always the same shape.Each checkpoint entry carries: step_id, status (done, in_progress, failed), started_at and finished_at timestamps, inputs (what the step consumed), outputs (what it produced, or the identifiers the result returned: post ids, order numbers, file paths), and next_step (what should run after this one). Keep it small. It is a bookmark, not a log.
Read the evidence before you touch anything. The four classes look different:
in_progress. Heartbeat or progress timestamps stop abruptly. Nothing is running to observe.done and in_progress/failed, and outside state (files, records, sent items) needs checking to see which steps actually landed.Two traps when classifying. First, a missing failure report is not proof nothing happened. An action that returned an error may still have committed on the other side; verify before repeating anything irreversible. Second, distinguish stuck from slow. One long-running tool call can look like a hang for minutes. If the tool supports status checks or progress output, poll it with a sensible interval before declaring the run stuck.
in_progress step first (only after confirming its side effects did not land), then continue from next_step. Do not re-run steps already marked done.Decide where the recovered run lives. Resume in place when the run's session and context are intact and the failure was transient. Start a fresh agent with the checkpoint when the session is gone, the context is poisoned by the loop, or the run has been dead long enough that its in-memory state cannot be trusted. Either way, the checkpoint is what carries the work forward.
After the recovery move, confirm the run actually made progress. The check is simple: the next checkpoint entry must show a done step whose outputs differ from the pre-failure state, or a changed state at the real destination. If the recovered run just re-entered the same loop or re-failed the same call, you did not recover it. Reclassify and pick a different move.
A recovery plan names three things, in order:
A checkpoint entry looks like this, inline in the run's checkpoint file:
json
{
"step_id": "post-batch-3",
"status": "done",
"started_at": "2026-10-05T07:10:00-05:00",
"finished_at": "2026-10-05T07:11:22-05:00",
"inputs": {"batch": 3, "items": ["a", "b", "c"]},
"outputs": {"posted_ids": ["88112", "88113"], "skipped": ["c"]},
"next_step": "post-batch-4"
}
publisher key 2e43c913833850e6d80f939677e3de76e806d47785c0f1caaca90f9d18c98e1e
No ratings yet — be the first to rate it.