Skip to content
Planning and decomposition

06.03 · Concept

Subtasks and checkpoints

Break long work so a failure costs one step, not the whole run.

Long agent work should be split into explicit subtasks with saved checkpoints between them, so recovery starts from the last valid state rather than from scratch. Treat the agent like a resumable workflow: plan a step, run it, persist the result, validate it, then choose the next action.

What this lesson answers

  • how to checkpoint long agent workflows
  • how to split AI tasks into subtasks
  • how to recover failed agent runs

Notes

Long agent runs fail for ordinary software reasons: bad input, flaky tools, rate limits, context drift, partial hallucinations, or one subtask going down the wrong path. The goal of decomposition is to make each unit of work small enough that you can inspect it, retry it, replace it, or skip it without throwing away the whole run. A checkpoint is the saved boundary between those units: the plan, intermediate result, tool output, decision, or state needed to resume from that point.

A useful mental model is a job queue plus a workflow engine, not a single giant prompt.

Common questions

Why do agent workflows need checkpoints?
Agent runs fail for normal engineering reasons: invalid inputs, unreliable APIs, rate limits, poor intermediate choices, and accumulated context errors. A checkpoint turns progress into durable state. Instead of rerunning the entire job, the system can retry, inspect, replace, or skip the failed step.
What should be saved at each checkpoint?
Save the state needed to continue safely: the current plan, the subtask result, tool outputs, validation status, decisions made, and any inputs required by later steps. The checkpoint should be sufficient for another process, or a later run, to resume without guessing what happened.
Are better prompts enough to avoid decomposition?
No. Better prompts can improve behaviour, but they do not remove nondeterminism, tool failures, or long-context drift. Decomposition gives software places to validate, enforce schemas, request review, retry with changed parameters, or choose another path when an intermediate result is not acceptable.