Step-level checkpointing for agent runs — resume from the last completed step instead of restarting from scratch after a crash.
Multi-step agents crash mid-run and restart from scratch. A 20-minute agent that fails at step 8 of 10 wastes 18 minutes of compute and re-runs side effects. badgr-agent-resume wraps each step with a checkpoint so a crashed run picks up exactly where it left off.
run.step(name, fn) checks .badgr/runs/ for an existing run; if the step already completed, it returns the saved output without re-running fn.
If the process crashes mid-run, re-running the script skips completed steps and resumes exactly at the failed one.
Use run.timeline() in code, or the badgr-agent-resume resume CLI command, to see step status and durations for any saved run.
npm install badgr-agent-resumeRequires Node.js 18+ and TypeScript 5+ for type definitions.
Wrap an async workflow in agentRun() and checkpoint each step by name.
import { agentRun } from "badgr-agent-resume";
await agentRun("support-agent", async (run) => {
const plan = await run.step("create-plan", generatePlan);
const order = await run.step("fetch-order", () => fetchOrder(plan.id));
return await run.step("write-response", () => generateReply(order));
});
// Checkpoints saved to: .badgr/runs/support-agent-<timestamp>.jsoncreate-plan completed 1.2s
fetch-order completed 0.4s
write-response running ...badgr-agent-resume resume <run-id>Show the status of a saved run and resume instructions.badgr-agent-resume resume <run-id> --jsonSame as resume, with machine-readable JSON output.badgr-agent-resume connectShow an optional hosted run-history link.npm install badgr-agent-resume — no account needed to get started.