Claude Certification Program · Five exams · Guides updated December 7, 2026

Home › Study guides › CCDV-P › Domain 1 › Lesson 1.2

CCDV-P · Domain 1 · 17% of the exam · Lesson 1.2 · 22 min read New in the December 7, 2026 guide release (v1.0)

Durable execution: checkpoints, idempotent steps and resumable sessions

How a long agent run survives deploys and crashes: checkpoints before side effects, idempotent tools, Agent SDK resume, Managed Agents sessions, model pinning.

Written against skill 1.2 of the official CCDV-P exam guide (Version 1.0, effective November 2026). An independent resource, not affiliated with Anthropic; the practice questions are written from scratch.

1.2.1 Why a six-hour run rarely finishes in one piece

Every Sunday at 22:00 the Calder County Records Office starts a job nobody watches. An agent works through the week's property-transfer filings from the county and its town offices, about 40,000 of them, and checks each against the land registry. Does the parcel exist, does the seller on the deed match the registered owner, do the date and price agree with the transfer-tax record? Roughly 3% do not. For each mismatch the agent opens a case in the clerks' queue and, where the filer must correct something, sends a notice by email. The run takes about six hours, costs about $680 in tokens, and must be finished before the clerks arrive at 07:30.

Last month a platform deploy restarted the agent's worker at 01:40, at filing 23,118. The process, its conversation and its idea of "where was I" vanished with the container. The on-call engineer did the only thing the design allowed: started again from filing 1. The run ended at 09:10, the clerks found half a queue, and 694 filers received the same notice twice.

A smarter prompt would not have helped. Claude decides the next step from the context it is sent; it has no memory of a process that no longer exists and no way to know whether an email left the building. Surviving interruption is a property of the system around the model, called durable execution: a run can stop at any point and continue from saved state, repeating no finished work and no real-world action.

1.2.2 What interrupts a long run, and what each failure destroys

Here is the belief to drop: that a restart is an incident. Over six hours it is the weather. Calder's worker shares a cluster with forty services that deploy on their own schedules, the registry rate-limits bursts, and long sessions grow in memory. The question is not whether the run stops partway, but what each kind of stop takes with it.

Interruption How it shows up What is lost by default
Deploy or autoscaler replaces the worker A stop signal, then the container is gone Process memory and the container's local disk, Agent SDK session files included
Timeout (job runtime cap, hung tool call) The platform kills the job, or a step never returns Same as a deploy; the hung step may be half done
Rate limits that outlast the retries Calls keep failing with 429 until the step or run gives up The step in flight; the host usually survives
Crash (out of memory, a bug) A session crash ends with a final error_during_execution result; a worker killed outright emits no result at all Process memory; local disk survives only if the same host restarts
Limits you set A result with subtype error_max_turns or error_max_budget_usd Nothing: the session can be resumed with a higher limit
Model retired under a hosted session Each new turn fails with model_request_failed_error The session cannot continue; a new one must start

Memorise the pattern: the further a failure reaches (process, container, platform), the less local state survives. Recognise the result subtypes and the error name; you need not learn the rest by heart.

Read the last column again and a rule falls out. Anything held only in the process (the open query() call, the counter that says "filing 23,118") dies in the first four rows. Anything on the container's disk dies in the first two. Only state written to a store outside the worker survives them all. Calder's original design kept its progress in exactly the wrong places: a counter in memory and a transcript on local disk.

1.2.3 Checkpoints at step boundaries, before side effects

Where exactly should progress be saved? It is tempting to snapshot "every five minutes" or "every 1,000 filings". Resist it. A timer fires in the middle of a step, so the snapshot describes a state that never cleanly existed: case opened, notice not yet sent. A checkpoint belongs at a step boundary, a point where one unit of work is either fully done or not started. Calder's unit is one filing.

The job runner (your code, not Claude) feeds the agent 25 filings per turn with their registry records. Claude compares and decides, and calls open_case or send_notice where it finds a mismatch. Those tools run in Calder's code, and every one of them moves a row in a ledger, a table in the county's Postgres database with one row per filing. The order that matters is around a side effect, an action that changes the world outside the agent: write the intent, act, then record the outcome.

One filing, checkpointed

CHECKEDcomparison stored, no action yet
INTENTkey F-23118:notice written
ACTthe mail gateway sends
CONFIRMEDreceipt id stored
DONEcursor advances
The ledger row moves forward at every boundary and the intent is written before each action, so a restart always knows which step was in flight.

Replay the 01:40 restart against this ledger. Filings 1 to 23,117 are DONE. Filing 23,118 shows INTENT for its notice with no receipt: the worker died between writing the intent and storing the receipt. That is the only ambiguous row in the whole run, and the ledger names it. Without the intent row, the new worker could not tell "never attempted" from "sent, receipt lost", so it would either skip a notice or send a second one.

Think of the sponge count in an operating theatre. Every sponge is written on the whiteboard as it goes in, so a shift change mid-operation never depends on anyone's memory. The ledger is the whiteboard, and the intent row is the line written before the sponge goes in. Checkpoint cost decides granularity: a ledger write takes milliseconds while a turn takes about 13 seconds, so Calder checkpoints every filing. A job with cheaper steps may group them, but never across a side effect.

1.2.4 Make every step safe to run twice

Here is the question that trips people up, and the exam likes it. The new worker finds filing 23,118 at INTENT. Should the notice go out? Claude cannot know. A resumed transcript shows that Claude requested send_notice; it is not proof the email left, because the worker may have died after the gateway accepted it and before any result was written. Ask the model "did you already send this?" and you get a confident guess.

The fix is an idempotent step: one with the same effect whether it runs once or five times. Each side-effecting tool takes an idempotency key derived from the work, never from the attempt (F-23118:notice, not a fresh random id per call), and your handler enforces it. In the handler below, look at the lookup that turns a replay into a no-op, the intent row written before the send, and the key handed to the gateway so a crash between send and receipt is absorbed downstream too.

def send_notice(filing_id: str, template: str) -> dict:
    key = f"{filing_id}:notice"                      # one key per real-world effect
    with db.transaction():
        row = db.one("SELECT status, receipt FROM effects WHERE key=%s FOR UPDATE", key)
        if row and row.status == "done":
            return {"status": "already_sent", "receipt": row.receipt}   # REPLAY is a no-op
        if row is None:
            db.run("INSERT INTO effects (key, status) VALUES (%s, 'intent')", key)  # INTENT first
    receipt = mail_gateway.send(filing_id, template,
                                idempotency_key=key)  # gateway drops a repeat of the same key
    db.run("UPDATE effects SET status='done', receipt=%s WHERE key=%s", receipt, key)
    return {"status": "sent", "receipt": receipt}

If a downstream system accepts no idempotency key, an intent row without a receipt goes to a person to check rather than being retried; that is the honest limit of what your code can prove. Notice also who enforces the rule. A system-prompt line saying "never send a notice twice" asks a model that, after a restart, does not know what was sent. The handler sees the ledger, and Claude sees only what the handler returns, here already_sent with a receipt it can report. Idempotency covers a second risk as well: after resuming, Claude may re-plan and request an action it already took, and the same key absorbs that.

1.2.5 Where state lives, and what survives what

A long-running agent holds four kinds of state, and each belongs somewhere different. The conversation (prompts, tool calls, results) is what the Agent SDK calls a session. The progress of the job lives in the ledger. Files the agent writes sit in its working directory. Knowledge worth carrying into future runs, such as "parcels registered before 2019 use the old eleven-digit format", can go into memory files through the memory tool, which your code stores wherever you choose.

Where it lives What belongs there What it survives
Process memory The open query() call, loop counters Nothing beyond the process
Session file on local disk (~/.claude/projects/) The conversation A process crash on the same host; not a replaced container
Session mirrored by a SessionStore The conversation, in your object store or database Losing the host; mirror writes are best-effort, so alert on mirror_error
Job ledger in a database Progress, intents, receipts, the run's model id Everything above, which makes it the source of truth
Memory files (memory tool) What the agent learned, in its own words Whatever your storage survives; notes, not records

Memorise the split in the last two rows: the ledger says what was DONE, memory says what was LEARNED. A memory file is the model's own note, so it never decides whether a notice went out.

The Agent SDK mechanics are few. Read session_id from the result message, which every result carries, success or error. Pass it as resume to continue that session with its full history. continue: true (TypeScript) or continue_conversation=True (Python) picks the most recent session in the working directory, fine for one conversation at a time and wrong for a fleet. Add fork_session=True (forkSession: true) to a resume and you get a new session id with a copy of the history, leaving the original untouched. Session files are local to the machine that wrote them, so a run that must resume elsewhere needs its transcript off that machine. The documented way is a SessionStore adapter (session_store / sessionStore) that mirrors transcripts to your backend, resumed from a matching working directory.

Worker 2 takes over at 01:41

LOADledger: batch 47, cursor 23,117
SETTLEre-run 23,118's notice; the key absorbs it
RESTOREbatch transcript from the store
RESUMEsame session id, same model
CONTINUEfiling 23,119 onward
The new worker rebuilds its position from the ledger and settles the one step in flight before it hands the conversation back to Claude.

Calder runs one session per batch of 500 filings, so worker 2 resumes batch 47's session, whose context includes the agent's notes on two ambiguous parcels. The docs offer a third route: skip resume and seed a fresh session from saved application state. Calder takes it whenever the transcript is missing, a mirror_error dropped part of it, or the model must change. A fork has its own use: when the records manager wants a stricter name-matching rule tried on batch 47, a fork tries it without disturbing the main thread. Forking branches the conversation only, so the fork runs with send_notice disallowed.

1.2.6 Hosted sessions, and the model under a resumed run

Two decisions remain: whether to run the loop yourself at all, and which model continues a run that resumes.

Claude Managed Agents, in beta, moves the loop off your workers. You define an agent (model, system prompt, tools), an environment where its sandbox runs, and a session for each task; your code sends events and streams results. The service keeps the session's event history, which you can fetch in full, along with its sandbox state. A deploy on Calder's side no longer takes the conversation with it: a new worker opens a stream, lists the event history to catch up, and answers any custom tool call the paused session is still waiting on. Session statuses tell you where things stand: idle, running, rescheduling (a transient error, retried automatically) and terminated.

Option When it wins What it costs
Agent SDK on your workers, with a ledger and a SessionStore You need your own runtime, network or data controls You build and operate the store, the ledger and the recovery path
Managed Agents session Long asynchronous work where losing runs to your own deploys is the main pain Beta; custom tools still run in your code; not eligible for Zero Data Retention or HIPAA BAA coverage; transcripts persist until you delete them
Fresh session per step, seeded from the ledger Steps are independent and need little shared context Reasoning is not carried over unless you write it down

The hosted option removes one failure class, not the need for idempotency. Calder's open_case and send_notice still run in its own code, so a worker that dies mid-call leaves the same question: did the notice go out? The retention line also needs the records manager's sign-off before filing data enters a hosted session.

Now the model. Two weeks after the ledger went live, a deploy at 02:10 shipped a config change meant for the next week's run: a newer model. The restarted worker passed model=config.MODEL to every batch session it resumed or started after batch 52, so batches 53 to 80 ran on the new model and that night's filings were judged by two models. The new one flagged initials as name mismatches, and the clerks' queue doubled.

A resume does not settle the model either. Claude Code's docs say a resumed session normally keeps the model it was saved on, but an explicit --model or ANTHROPIC_MODEL on the resuming run wins, as do alias variables and a retired saved model. The Agent SDK docs do not spell out how the model option combines with resume, so never leave it to a default: pass the model you mean. Aliases such as sonnet move to newer versions over time; full model ids, which are pinned snapshots, do not.

Two ways a model change meets a running job

Hot swap mid-run

Batch 52 starts on model A
Deploy ships a new model id
Later batch sessions run on model B
One night, two judges, no record

Pin, then cut over

Model id stored in the job row at start
Every resume passes that stored id
New model re-checked on 300 labelled filings
Switch at a run boundary, logged per filing
Pinning keeps one night on one model, and a planned switch happens at a run boundary after re-validation, with the model recorded per filing.

The rules follow. Record the full model id in the job row when the run starts and pass that value, never the live config, to every session the run starts or resumes; refuse to continue when they differ. Write it on each ledger row so an audit can tell which model decided which filing, and change models at a run boundary after the new one passes the same labelled set. Managed Agents enforces some of this for you: a session can pin an agent version ({"type": "agent", "id": ..., "version": 3}), and its model cannot change mid-session. When a model is retired, existing sessions fail on their next turn and you start a new session from the updated agent, which is exactly a cut-over at a checkpoint boundary.

1.2.7 The exam traps

Every trap here either trusts something that does not survive, or trusts the model with what code must enforce.

  • ✗ Restarting an interrupted run from the beginning. ✓ Resume from the last checkpoint in a durable ledger. Starting over repeats every completed side effect and wastes the hours already spent.
  • ✗ Asking the model, by prompt or transcript, whether an action already happened. ✓ Enforce an idempotency key in the tool handler, checked against the ledger. The transcript records requests, not outcomes.
  • ✗ Checkpointing on a timer or after the side effect. ✓ Checkpoint at step boundaries and write the intent before acting. A timer snapshot can describe a half-finished step, and a post-action write is lost if the crash lands in between.
  • ✗ Relying on session files on a container's local disk to resume after a deploy. ✓ Mirror transcripts with a SessionStore, or use a hosted session, and keep progress in the ledger. Local files leave with the container.
  • ✗ Letting a resumed run take whatever model the current config or an alias resolves to. ✓ Pin the full model id (and agent version) per run and change it only at a boundary after re-validation.
  • ✗ Treating file checkpointing or a hosted session as exactly-once execution. ✓ Keep idempotent side effects in both cases. File rewind covers files edited by the agent's file tools, and hosted sessions still call your code for custom tools.

1.2.8 Put it together: survive a kill mid-run

You now have every piece: the failures to expect, checkpoints at boundaries, idempotent side effects, state placed where it survives, and a pinned model. The quickest way to own them is to kill a small run in the worst possible place and watch what comes back.

The rest of the domain builds on this. Multi-agent orchestration (1.1) adds subagents whose own sessions and side effects need the same treatment. Architecture selection (1.3) decides when a run should be a long agent session at all, and context and memory architecture (1.4) keeps one long session inside its context window. Reliability engineering (2.1) covers retrying a single failed call, the step below the checkpoints you built here.

Key takeaways

  • ✓ Long runs are interrupted by deploys, timeouts, rate limits, crashes, your own caps and model retirement, and each destroys a different layer of state.
  • ✓ Checkpoint at step boundaries in a store outside the worker, writing the intent before every side effect and the outcome after it.
  • ✓ Make every side-effecting tool idempotent with a key derived from the unit of work and enforced in your handler, because the transcript is not proof of what happened.
  • ✓ Keep progress in a durable ledger, the conversation in a SessionStore when another host may resume it, and learned knowledge in memory files.
  • ✓ In the Agent SDK, capture session_id from the result and use resume to continue, fork_session to branch the conversation, and a fresh session seeded from the ledger when the transcript cannot be trusted.
  • ✓ Managed Agents keeps the loop, event history and sandbox server-side, but custom tools still run in your code and still need idempotency.
  • ✓ Pin the full model id (and agent version) for the life of a run, record it per step, and switch models only at a boundary after re-validation.

Check your understanding

4 questions written for this lesson. Every answer option is explained, including the ones you did not pick. Nothing is stored.

CCDV-P practice questions are being written

There is no CCDV-P question bank on this site yet. The practice questions are being written now. Until they are ready, work through the free study guide: every lesson ends with questions that check your understanding, and every answer option is explained.

Back to Domain 1 → The CCDV-P exam guide →

The CCDV-P course will hold the same study guide as a book, for reading in the app.

Sources