Durable Intent and Recovery for Agent Runs

Lesson 4 of 4

Recover a Run by Reading the Record

Estimated time: 10 minutes

Recover a run by reading the record, not the memory

When a run stops without finishing, the only trustworthy account of what happened is the record it wrote before it acted. Anything held in memory went away with the process.

Ask the record what it expected

Read the intent, then check the world against it. The record says what the run meant to do; the world says whether it happened. The gap between the two is the work left.

Prefer a checked step to a blind retry

Re-running the whole run is fast to write and dangerous to operate. Re-running only the steps the record shows as unfinished is slower to write and safe to operate.

def remaining(log, done):
    return [r for r in log if r["id"] not in done]

Keep the record small enough to trust

A record nobody reads is the same as no record. Keep it short, one line per step, so an operator can see the shape of the run at a glance.