AITraining2U

Programs

Resources

Case Studies

Quick Links

Enquire Now
Core Domain 1 · Agentic Architecture & Orchestration ~40 min

Checkpoint an agent so a crash does not restart it

Persist enough external state to resume mid-run.

Session resume replays a conversation; a checkpoint records completed work. They solve different problems. Build a long-running agent that survives being killed halfway, and be precise about what you persist and when.

What to build

  1. Build an agent that processes a queue of twenty items with a tool call per item.
  2. After each item, write a checkpoint: item id, status, output reference, timestamp.
  3. Make the checkpoint write atomic — write to a temp file and rename, or use a transaction.
  4. Kill the process at item nine.
  5. Restart. Resume from the checkpoint, not from the conversation history.
  6. Verify no item is processed twice and none is skipped.

Done when

  • Restart reprocesses exactly zero completed items.
  • The checkpoint survives a kill between the tool call and the response write.
  • Resumption does not require replaying the original conversation.
  • You can articulate when conversation resume is sufficient and when a checkpoint is required.

If you want to go further

  • Make each tool call idempotent with a key, so an interrupted call is safe to retry.

The trap this exercise teaches

Relying on conversation replay for durability. Replay re-costs every token and, for tools with side effects, re-executes work that already happened.

Before you start

The theory behind this build is covered in Session state, resume and crash recovery. If any step below is unfamiliar, read that first — the exercise assumes it. Primary source: Claude Docs — Agent SDK.

Check yourself against the exam

This exercise sits in Domain 1, which is 27% of the CCAR‑F exam. Once you have built it, run a domain drill in the study app and see whether the questions read differently.