CClaude Cert Prep
D515% of exam

CCA-F Domain 5 Study Guide: Context Management & Reliability

Sustaining coherent agents across context limits, stateless APIs, escalation calls, and risk-based human review.

10 min read 4 objectives Reviewed July 25, 2026
On this page

Domain 5 is the smallest slice of the CCA-F blueprint at 15%, but it is where architects prove they understand what actually keeps a Claude-based system trustworthy over long, real workloads. The four objectives here are less about a single API call and more about the invariants that hold across many of them: how you keep an agent coherent when a task outgrows the context window, how you maintain conversation state on a server that remembers nothing, when an agent should stop trying and hand control to a human, and how you aim scarce human attention at the outputs most likely to be wrong.

The exam tests these as judgment calls in scenarios — a multi-agent research system that runs out of room, a data-extraction pipeline feeding a review queue — not as trivia. The trap in almost every D5 question is the plausible-but-wrong shortcut: 'the API remembers the last message,' 'read the whole repo into context,' 'keep retrying autonomously,' 'spot-check 10% at random.' Each is comfortable and each is incorrect.

Ground yourself in one fact that anchors the whole domain: the Messages API is stateless and context windows are finite. Everything else — isolation, scratchpads, targeted reads, escalation, routing — is a discipline for working within those two hard constraints. Master why they exist and the objectives fall into place.

OBJ 26

Sustaining coherence beyond the context window

A context window is finite. Every token — the system prompt, all prior turns, tool definitions, tool results, and files you read — competes for the same fixed budget. Large codebase exploration blows past that budget quickly: read a dozen whole files and you have crowded out the very reasoning space you need. The failure mode is context rot — as the window fills with low-value material, the model's attention degrades, it loses track of earlier goals, and answers get vague or contradictory. Objective 26 is about three complementary strategies that keep an agent coherent across work that exceeds what fits at once.

  • Subagent isolation — delegate a focused subtask (run the test suite, grep a sprawling module, summarize a log) to a subagent that runs in its own fresh, isolated context window. Its verbose intermediate tool calls and results stay inside that subagent; only a distilled final message returns to the parent. The main thread stays clean and on-mission.
  • Scratchpad files — persist findings to disk instead of holding them all in the window. Write notes, a partial map of the code, or a running checklist to a file, then read back only what you need later. Disk is durable and effectively unbounded; the context window is neither.
  • Targeted file reading — use Grep/Glob to locate the exact functions, symbols, or line ranges that matter and read only those slices, rather than loading entire files 'just in case.' You pull in signal, not bulk.

Concrete scenario: a multi-agent research system maps an unfamiliar 400-file service. An orchestrator dispatches one subagent per subsystem (auth, billing, ingestion). Each subagent greps for its entry points, reads only the relevant handlers, and writes a short findings/auth.md summary to the scratchpad. Each returns two paragraphs — not its 50k tokens of file reads — to the orchestrator, which composes the architecture overview from the summaries plus the notes on disk. No single context ever held the whole codebase, yet the final answer is coherent and grounded.

text
Orchestrator (main context)
  ├─ dispatch subagent: "Map the auth subsystem"
  │     grep 'login|session|token' src/  -> 6 files
  │     read only the matched handlers (targeted, not whole files)
  │     write findings/auth.md   (scratchpad — persisted to disk)
  │     RETURN: 2-paragraph summary   (isolation — verbose reads stay behind)
  ├─ dispatch subagent: "Map billing"  -> same pattern
  └─ compose overview from returned summaries + findings/*.md
        (main window never held all 400 files)
Isolation + scratchpad + targeted reads working together
OBJ 27

State in a stateless API

The Claude Messages API is stateless: the server keeps no memory between calls. It does not store your conversation, associate requests by a session ID, or 'remember' the last thing it said. Each request is evaluated entirely on the payload you send. That is why multi-turn state exists only if you create it — by resending the entire conversation on every request.

The mechanism is the messages array. To continue a conversation you append the model's previous reply and the new user turn to the full history and send all of it again. Roles alternate user / assistant, and every prior turn must be included — including any tool_use blocks the model emitted and the corresponding tool_result blocks — or the model loses the thread. The client (your application) is the sole keeper of conversation state; the API is a pure function from messages to the next message.

python
# Turn 1
messages = [{"role": "user", "content": "List the users table columns."}]
resp = client.messages.create(model=MODEL, max_tokens=1024, messages=messages)

# Persist BOTH sides before the next turn.
messages.append({"role": "assistant", "content": resp.content})

# Turn 2 -- resend everything so the model 'remembers' turn 1.
messages.append({"role": "user", "content": "Now write a migration to add an index."})
resp = client.messages.create(model=MODEL, max_tokens=1024, messages=messages)

# If a turn used tools, the assistant's tool_use block AND the
# user-role tool_result block must both stay in `messages`, or the
# model can't see what the tool returned.
State is maintained by resending the full history each turn
BeliefReality
The API remembers my last messageIt remembers nothing; each call is independent.
A session/conversation ID maintains stateThere is no server-side session; you resend history.
I can send only the newest user turnThe model then has zero context from prior turns.
Tool results are stored server-side after the tool runsYou must echo each tool_result back in the next request.
OBJ 28

Escalate on request versus resolve autonomously

A reliable agent knows when to stop acting on its own. Objective 28 is a decision boundary: when should the agent immediately honor a human escalation and when should it attempt autonomous resolution with its tools? The default for routine, in-policy, reversible work is to resolve autonomously — that is the point of an agent. But certain signals override that default and demand an immediate handoff.

The single most important rule: when a human explicitly asks to take over — 'stop, let me handle this,' 'escalate to a manager,' 'I want to speak to a person' — the agent honors it immediately. It does not relitigate the request, run one more tool call, or try to satisfy the underlying need itself first. An explicit escalation request is a stop condition, not an input to weigh against continuing.

Honor escalation immediatelyAttempt autonomous resolution
A human explicitly asks to take over / escalateRoutine request within documented policy
Action is irreversible or high-stakes (refunds beyond a limit, deletions, legal/medical/financial commitments)Action is reversible and low-risk
Policy or guardrails require human sign-offThe agent has the tools and authority to complete it
The agent is stuck, looping, or repeatedly failingA clear, tool-supported path to resolution exists
Signals of distress, safety risk, or strong dissatisfactionConfidence is high and the situation is understood

Scenario: in a support agent, a customer writes 'this is the third time — just escalate me to a human.' The correct behavior is to stop attempting fixes and route to a person now, acknowledging the request. Continuing to troubleshoot autonomously 'because the agent might still solve it' is the classic wrong move: it ignores an explicit human instruction and erodes trust. Contrast that with a customer asking to resend a receipt — reversible, in-policy, fully within the agent's tools — which the agent should simply do.

OBJ 29

Risk-based human review routing

In a human-in-the-loop extraction pipeline, reviewer time is the scarce resource. Objective 29 is about spending it where errors are most likely and most costly. The strong design routes work by risk — confidence scores, document characteristics, and field-level ambiguity — so scrutiny concentrates on the outputs most likely to be wrong. The weak design is random sampling, which spreads attention uniformly and, by construction, misses the systematically hard cases as often as it catches them.

  • Confidence scores — route low-confidence extractions to review and auto-accept high-confidence ones above a calibrated threshold. This is the primary signal.
  • Document characteristics — flag whole documents that are structurally risky: scanned/handwritten, poor OCR quality, unusual template, a vendor never seen before, or a total above a value threshold.
  • Field-level ambiguity — route at the field granularity, not just the document. A single ambiguous tax_id or a date that parsed two ways should trigger review of that field even when the rest of the document is clean and high-confidence.

Scenario: an invoice pipeline extracts vendor, date, line items, and total. Documents where every field clears the confidence threshold and the vendor is known auto-post. Anything with a low-confidence field, a first-time vendor, an amount over the approval limit, or a total that fails to reconcile against the line items is routed to a reviewer — and the queue surfaces exactly the suspect fields, pre-highlighted, so the human corrects them in seconds rather than re-keying the page.

python
def route(doc):
    reasons = []
    if doc.min_field_confidence < 0.85:
        reasons.append("low-confidence field")
    if doc.total > APPROVAL_LIMIT:
        reasons.append("amount over limit")
    if doc.vendor_is_new or doc.ocr_quality == "poor":
        reasons.append("risky document characteristics")
    if not doc.total_reconciles_with_line_items():
        reasons.append("field-level inconsistency")

    if reasons:
        return review_queue(doc, highlight=reasons)   # human sees WHY
    return auto_accept(doc)

# A random 10% sample would review confident, correct docs while
# waving through the genuinely ambiguous ones -- the opposite of the goal.
Route by risk signals, not by coin flip

Key takeaways

  • 01The Messages API is stateless — the server stores nothing between calls, so multi-turn state exists only because the client resends the full messages history (including tool_use/tool_result) every request.
  • 02Context windows are finite and prone to context rot; control what enters context rather than bulk-loading, and a bigger window is not a substitute for discipline.
  • 03Subagent isolation, scratchpad files, and targeted (Grep/Glob) reading are the three levers that sustain coherent exploration across tasks larger than one window.
  • 04An explicit human request to take over is a stop condition: honor escalation immediately rather than making one more autonomous attempt.
  • 05Resolve autonomously only for routine, reversible, in-policy work; hand off for irreversible, high-stakes, out-of-policy, or human-requested cases.
  • 06Route human review by risk — confidence scores, document characteristics, and field-level ambiguity — so scarce reviewer attention lands on the likeliest errors.
  • 07Random sampling is a calibration/audit tool, not a review-routing strategy; use it to monitor drift, not to decide what gets reviewed.

Common mistakes

Assuming the API remembers the conversation or that a session ID maintains state.

Treat every call as independent; maintain state client-side by resending the complete, ordered messages array each turn, including prior tool turns.

Solving large-codebase tasks by reading whole files into the main context.

Grep/Glob to the relevant slices, delegate noisy subtasks to isolated subagents, and persist findings to scratchpad files so the main window stays dense with signal.

Continuing autonomous troubleshooting after a user explicitly asks for a human.

Honor an explicit escalation request immediately; also escalate on irreversible, out-of-policy, or safety-critical actions.

Using random spot-checks to allocate human review of extractions.

Route by confidence, document characteristics, and field-level ambiguity; reserve random sampling for auditing calibration and drift.

Dropping tool_use/tool_result blocks from history to save tokens.

Keep the tool turns in messages (or summarize them deliberately) so the model still sees what its tools returned; compact old context intentionally, not by silent omission.

Frequently asked

If the Messages API is stateless, how do multi-turn chats work at all?

Your application accumulates the conversation locally and resends the entire messages array — every prior user and assistant turn, plus any tool_use and tool_result blocks — on each new request. The model reconstructs context from that payload alone; there is no server-side memory to rely on.

When does subagent isolation help versus just using a larger context window?

A larger window raises the ceiling but does not stop context rot or make bulk-loading wise. Isolation keeps a subtask's verbose tool output out of the main thread and returns only a distilled result, so the main reasoning stays coherent regardless of window size. Use isolation to control what enters context; use a bigger window only to raise the limit, not to avoid discipline.

Should an agent always try its tools before escalating to a human?

No. For routine, reversible, in-policy work, attempt autonomous resolution. But when a human explicitly asks to take over, or the action is irreversible, out-of-policy, or safety-critical, escalate immediately — an explicit request is a stop condition, not a factor to weigh against trying once more.

Why is confidence-based routing better than random sampling for human review?

Reviewer time is scarce. Risk-based routing sends the low-confidence, structurally unusual, and ambiguous-field cases to humans — exactly where errors concentrate — while auto-accepting calibrated high-confidence outputs. Random sampling spends equal effort on easy and hard cases and, by design, lets the hardest ones through. Keep random sampling only as an audit to verify your confidence scores stay calibrated.

Do scratchpad files replace conversation history?

They complement it. History (the messages array) is what the model sees each turn and is bounded by the window; scratchpad files persist findings to durable disk so they survive resets and new sessions and can be read back selectively. Use scratchpads to offload memory you don't need in the window every turn, then pull specific pieces back with targeted reads.

Independent, unofficial study material. Not affiliated with, endorsed by, or authorized by Anthropic. Every example is original and written to teach the public exam objectives — no real exam questions are reproduced. Technical details reflect Claude, the Anthropic API, Claude Code, and MCP as of July 25, 2026; always confirm specifics against current official documentation.

Test yourself

Turn what you just read into answers you can check.

Take the mock exam

Keep studying

All guides

These guides are free and never paywalled. Keep Claude Cert Prep free ♥