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

Home › Study guides › CCDV-P › Domain 8 › Lesson 8.3

CCDV-P · Domain 8 · 10% of the exam · Lesson 8.3 · 21 min read New in the December 7, 2026 guide release (v1.0)

Unattended and event-driven agents: triggers, checkpoints, budgets and escalation

Run coding agents with nobody watching: goal, schedule and event triggers, headless runners, CI first response, checkpoints, budgets and escalation.

Written against skill 8.3 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.

8.3.1 Why an agent with nobody watching needs a different design

At 02:40 one Tuesday, the pipeline for BerthLine, the Tidewater Ports Authority's cargo-scheduling software, goes red. BerthLine assigns ships to berths, plans crane shifts and books truck slots at the terminal gates, so a broken main branch blocks the morning release. The pager wakes Maren, Tidewater's on-call platform engineer. Forty minutes later she knows what she suspected at 02:41: a flaky test in the crane-shift module, the fourth this week. Meanwhile 140 outdated packages, nine of them with security advisories, wait for someone to find a quiet afternoon.

BerthLine's CI runs about 420 pipelines a day and roughly 30 of them fail. Last quarter, 62% of those failures were flaky tests or infrastructure, 23% genuine code faults and 15% dependency breakage. Tidewater wants two agents: one that updates dependencies every night, and one that answers a failed pipeline before a human does.

When you use Claude Code interactively, three safeguards come free: a person answers permission prompts, notices when the work drifts, and reads the result. Run the same agent at 02:40 with nobody there and all three disappear. Unattended operation means rebuilding them as configuration and code before the run starts: permissions decided in advance, stop conditions the run cannot argue with, progress saved outside the model, and a notification path that tells the right person what happened.

8.3.2 Three ways an agent starts without you

Here is the question that separates designs that work from designs that drift: what starts the next unit of work, and what ends it? Unattended agents come in three shapes, and each answers that question differently.

A goal-driven agent keeps working until a condition holds. In Claude Code, /goal sets that condition: after each turn a separate small, fast model reads the conversation and judges the condition met, not yet met or impossible. The evaluator runs no commands, so the condition must be something Claude's own output can demonstrate ("npm test exits 0"), and the docs suggest adding a clause such as "or stop after 20 turns" to bound the run. A goal runs in non-interactive mode too: claude -p "/goal ..." loops to completion in one invocation.

A scheduled agent starts on the clock. Tidewater's nightly dependency run is a GitHub Actions schedule trigger that runs Claude Code on the authority's own runner at 01:00. Claude Code's cloud scheduled tasks (formerly routines, in research preview) and Managed Agents' scheduled deployments, a cron expression plus an IANA timezone, are hosted equivalents; Desktop scheduled tasks run on your own machine, which must stay on. Session-scoped /loop also repeats a prompt, but only while that session stays open, so it is not an unattended runner.

An event-driven agent starts when something happens: a failed pipeline, a new pull request, an alert. The CI first responder starts when a BerthLine pipeline finishes in failure. The Claude Code GitHub Action runs in automation mode on any GitHub event when the workflow gives it a prompt, and cloud scheduled tasks can also fire from GitHub events or an HTTP POST to their own endpoint.

Three triggers, three questions answered in advance

Goal-driven

Startswhen you set the condition
Next turnan evaluator judges "not yet met"
Endsmet, impossible, or a turn clause

Scheduled

Startscron: nightly at 01:00
ExampleTidewater dependency updates
Endswork list done, or a cap

Event-driven

Startsa pipeline fails
ExampleTidewater CI first responder
Endstriage posted, fix proposed
Every unattended agent needs a start condition and an end condition fixed before it runs; only the source of the start differs.

8.3.3 Choosing the runner and locking down headless Claude Code

The trigger says WHEN the agent runs; the runner says WHERE its loop executes and who enforces its limits. There are three Anthropic runners, and the requirement that decides between them is how much code you want around the loop and who operates the infrastructure.

Runner When it wins What it costs
Headless Claude Code (claude -p, or the Claude Code GitHub Action, which takes the same flags in claude_args) The job already lives in CI or cron, with the repository checked out on a runner you control You own the runner, its credentials and its timeout; every limit is a flag you must remember
Agent SDK (Python or TypeScript) You need code around the loop: an approval callback, hooks, your own result routing or session storage You write and operate that service
Claude Managed Agents (beta) Long-running, asynchronous work in a hosted sandbox, with server-side sessions, cron deployments and webhooks Sessions and transcripts persist on Anthropic's side until you delete them; check data-handling eligibility first

Tidewater keeps both agents on its own GitHub runners with headless Claude Code. The flag -p (--print) runs one non-interactive session and exits with a non-zero code on failure. In the wrapper below, look at three things: --permission-mode dontAsk, which denies anything not pre-approved instead of waiting for an answer; the two caps; and the check on the final result message.

args=(
  --bare                                    # load only what this command names
  --allowedTools "Read,Edit,Bash(npm outdated *),Bash(npm install *),Bash(npm test *),Bash(git add *),Bash(git commit *)"
  --permission-mode dontAsk                 # not pre-approved = denied, never a prompt
  --max-turns 60
  --max-budget-usd 4                        # checked after each response: keep headroom
  --output-format stream-json --verbose     # one JSON event per line
)
claude -p "$(cat .ci/nightly-deps-prompt.md)" "${args[@]}" > run.jsonl
status=$?
jq -c 'select(.type == "result")' run.jsonl | tail -n 1 > result.json   # the last result message
subtype=$(jq -r '.subtype' result.json)     # success, error_max_turns, error_max_budget_usd ...
jq -r '[.session_id, .total_cost_usd, (.permission_denials | length)] | @tsv' result.json >> .ci/run-ledger.tsv
[ "$status" -eq 0 ] && [ "$subtype" = "success" ] || notify_platform_owner result.json   # a cap hit is a failure

Why stream-json? Plain --output-format json gives you the result text, session_id, total_cost_usd and, with --json-schema, structured_output. The documented home of subtype and permission_denials is the stream's result message, the same result message the Agent SDK returns, so the wrapper reads the last one.

The tool list names exact command patterns, not a bare Bash, and no rule allows git push. Sometimes a permission host would otherwise wait for an answer: an Agent SDK callback, or a --permission-prompt-tool. Then --permission-prompts none (or the permissions.denyInsteadOfPrompting setting) makes the run deny instead of hanging.

The documented alternative to dontAsk for unattended runs is --permission-mode auto --permission-prompts none. A classifier approves or blocks each action, and anything that would still prompt is denied. bypassPermissions, which --dangerously-skip-permissions equals, skips the prompts and safety checks, and the docs recommend it only for isolated containers and VMs.

8.3.4 CI first response: triage, propose, never merge

Here is the design question the exam returns to: when a pipeline fails at 02:40, how much should the agent be allowed to do about it? The tempting answer is "fix it", which in practice means pushing to main, re-running the deploy or skipping the failing test until the light turns green. Resist it completely. A first responder does what a good junior on-call engineer does before waking anyone: it gathers evidence, classifies the failure and PROPOSES a remedy that a person accepts.

Tidewater's first responder starts on the failed run, reads the job logs and the diff of the commit that broke, and reruns the failing test in isolation to tell flaky from broken. It then writes a structured triage record (the --json-schema flag returns it in the result's structured_output field) with a class, a confidence, the evidence lines and the proposed action. For a code or dependency fault it pushes a candidate fix to a claude/ branch and opens a draft pull request against main. It never merges, deploys, re-runs a production job or edits the pipeline itself.

Tidewater's CI first responder

TRIGGERpipeline on main fails
GATHERlogs, failing diff, rerun the test
CLASSIFYflaky, infra, code or dependency
PROPOSEtriage record; fix on a claude/ branch
HAND OFFroute to a human with evidence
The agent's job ends at a proposal with evidence; a branch rule and a token scope, not the prompt, keep the merge with a person.

What keeps the agent inside that box is enforcement outside the model. The workflow's token can write branches and pull requests but not to main, because branch protection requires a human approval, and the runner holds no deploy credentials. The prompt explains the policy so Claude does not waste turns trying; GitHub makes breaking it impossible. Claude decides what to propose, and GitHub decides whether anything merges.

8.3.5 Checkpoints, stop conditions and budgets

The first nightly run taught Tidewater why progress must live outside the model. The agent updated six packages, ran the suite after each, and was killed when the job hit its 50-minute timeout. Its work was in the context window and an uncommitted working tree, so it vanished. The next night it chose the same six packages and was killed at the same point.

A checkpoint is durable evidence of progress that a fresh run can pick up. Anthropic's guidance for agents that span many context windows uses three: a git commit after every verified change, a progress notes file the next session reads first, and a feature or work list whose status only changes after testing. Tidewater's version is one commit per package on a dated claude/deps- branch, plus a deps-progress.json file listing each package as done, failed or pending. The session id in the run ledger lets an engineer --resume the exact conversation to see why the agent judged a package unsafe.

The nightly run with checkpoints

READdeps-progress.json, branch log
UPDATEone package, run the suite
COMMITon claude/deps- branch, mark done
STOPlist done, cap hit or unexpected
COMMIT → READ · next package on the work list
Each verified update is committed and recorded before the next begins, so a killed run loses at most the package it was working on.

Claude Code's own /rewind checkpoints do not do this job. They are session-level recovery for edits made with Claude's file tools: a file that only Bash commands changed, such as the lockfile npm install rewrites, is not tracked, and the docs say plainly that checkpoints do not replace version control.

Checkpoints make stopping cheap, which is why every unattended run needs several independent stop conditions. Tidewater's nightly agent stops when its work list is done, at 60 turns, at an estimated $4 of spend or at the runner's 50-minute timeout. It also stops when an update looks bigger than planned: a major version, or a change outside the dependency manifests and the code that calls them. The budget cap is checked after each model response, so spend can pass it by one response plus any subagents still running; set the cap below the figure you must not exceed.

A run that hits a cap ends with error_max_turns or error_max_budget_usd, and the wrapper treats both as failures to report, never as a quiet exit. Managed Agents has its own form of the cap: a session budget, which a scheduled deployment applies to every session it starts; at the budget the session pauses idle and the session.budget_reached webhook fires.

8.3.6 Notification and escalation: who hears, when, with what evidence

In its first week the first responder posted a full analysis of every failure to the team channel: thirty a day, most of them flaky tests. By Friday the channel was muted, and a genuine dependency regression sat unread for two days. Notification has two failure modes, silence and noise, and noise becomes silence within a week.

Escalation design routes each outcome to the smallest audience that must act, at the urgency the action needs, with the evidence to act without re-investigating. The evidence bundle is the same everywhere: the run or session id, the triage class and confidence, the log lines that support it, the diff or draft pull request link, the cost, and what the agent did NOT do.

Outcome Who hears, and how fast Evidence attached
Flaky test or infra blip, retried green Daily digest to platform engineering Test name, failure count this week, rerun result
Code or dependency fault, fix proposed Owning team's review queue, same day Triage record, failing log lines, draft pull request
Low confidence, or a cap or denial hit Platform owner, same day Result subtype, denials, last checkpoint, session id
Release blocked before the 06:00 window Page the on-call engineer All of the above, plus what is blocked

Escalation also has a hard floor. An unattended agent never does these without a human, however confident it is and however routine the night, and Tidewater wrote each one down with the control that enforces it before either agent ran:

  • Merge or push to a protected branch. Branch protection requires a human approval; the agent's token writes only claude/ branches and pull requests.
  • Deploy, release or re-run a production job. The runner holds no deploy or production credentials.
  • Change CI configuration, secrets or permissions, including its own. Deny rules on the pipeline and settings files, and a token that cannot edit them.
  • Delete branches, data or history, or force-push. No allow rule covers them, so dontAsk denies them.
  • Disable, skip or delete a test to turn a run green. A test change arrives only inside a draft pull request a person reviews.
  • Contact anyone outside the team, such as a vendor, a regulator or the public. The agent has no tool or connector that can.

Enforce each one where the model cannot reach it. In Managed Agents the equivalent is an always_ask permission policy on the risky tools; the session then waits indefinitely for an answer, so wire its session.status_idled webhook to the queue that answers it. A pre-written prompt is not consent either: the cloud scheduled tasks docs state that a fired prompt is not live user input and cannot approve actions during the run.

8.3.7 The exam traps

Nearly every wrong answer in this skill trusts the run instead of bounding it: no caps, no checkpoints, broad permissions, or a prompt doing the job of a control.

  • ✗ Running the nightly job with --dangerously-skip-permissions so it never stalls. ✓ Pre-approve the exact commands and run in dontAsk (or with --permission-prompts none), so everything else is denied and reported; bypass mode belongs only in an isolated container or VM.
  • ✗ Letting the agent run "until it's done". ✓ A verifiable success criterion plus turn, budget and wall-clock caps, with headroom on the budget and every cap hit reported as a failure.
  • ✗ Keeping progress in the context window and restarting from scratch after a timeout. ✓ Commit each verified unit, keep a progress file and save the session id, so the next run resumes where the last one stopped.
  • ✗ A first responder that pushes a fix to main, skips the flaky test or re-runs the deploy. ✓ Triage and propose on a branch; humans merge, enforced by branch protection and token scope.
  • ✗ Posting every run to a shared channel, or posting nothing. ✓ Route by outcome and urgency, with evidence, and page only when a person must act now.

Four ways to stop the first responder merging, one that works

"Never merge" in the prompta request, not a control
Log every push for reviewdetects after the damage
A more capable modelstill a probability
Turn the agent offback to 30 pages a day
Token scope and branch protectionthe merge needs a human approval
A prompt rule, a logged push and a stronger model all leave the merge reachable, and removing the agent loses the triage; only platform enforcement makes the merge impossible.

8.3.8 Put it together: run a bounded headless agent and break it

You now have every piece. A trigger comes with an end condition, the runner's permissions are decided before it starts, and the first responder proposes instead of acting. Checkpoints survive a kill, and notifications reach the right person. The quickest way to make them stick is to run a small version on a scratch repository and break it.

This lesson sits on top of the rest of the domain. Parallel fan-out (8.1) uses the same caps and checkpoints across many agents at once. The draft pull requests your first responder opens flow into the verification and AI review pipeline (8.2). The deny rules and settings these runners read are what organisation-wide configuration (8.4) enforces centrally, and durable execution (1.2) generalises checkpointing to agents beyond software delivery.

Key takeaways

  • ✓ An unattended agent replaces the watching human with configuration: permissions, stop conditions, checkpoints and notification are all decided before the run starts.
  • ✓ Goal-driven, scheduled and event-driven agents differ in what starts them, and each needs an end condition that can be checked from evidence.
  • ✓ Headless Claude Code (claude -p), the Agent SDK and Managed Agents are runners; choose by how much code you need around the loop and who operates the infrastructure, and pre-approve exact tools in a mode that denies instead of prompting.
  • ✓ A CI first responder gathers evidence, classifies the failure and proposes a fix on a branch; merging and deploying stay with people.
  • ✓ Commit each verified unit and keep a progress file and session id, and bound every run with turn, budget and time caps whose hits are reported as failures.
  • ✓ Route each outcome to the smallest audience that must act, with evidence, and enforce human gates on irreversible actions outside the model.

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 8 → The CCDV-P exam guide →

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

Sources