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

Home › Study guides › CCAR-P › Domain 2 › Lesson 2.6

CCAR-P · Domain 2 · 13% of the exam · Lesson 2.6 · 19 min read Updated for the December 7, 2026 exam guide (v1.1)

Reasoning effort and context lifecycle for long-running agents

Allocate effort per step, then choose context editing, the memory tool or compaction so a long-running agent stays accurate and fast across its whole session.

Written against skill 2.6 of the official CCAR-P exam guide (Version 1.1, effective December 7, 2026). An independent resource, not affiliated with Anthropic; the practice questions are written from scratch.

2.6.1 Why the close agent was slow by noon and lost by Tuesday

Brightwater Building Society is a mutual lender with savings accounts and mortgages. Every month its finance team closes the books over five working days, and the slowest part is reconciliation: matching the general ledger against bank statements and the mortgage sub-ledger, then explaining every item that does not match, which accountants call a break. Leonie, the financial controller, wanted an agent to do the matching and draft an explanation for each break. Dmitri Varga, the solution architect, inherited a pilot that worked beautifully for the first hour of each day and badly after that.

The pilot team had made two choices "to be safe". The agent ran every step at the deepest reasoning setting, from ticking off ten thousand exact matches to investigating a tangled break. And it kept everything it saw in the conversation: every ledger extract, every bank file, every block of reasoning. By late morning a controller's quick question took over a minute to answer. By mid-afternoon the agent was classifying breaks less reliably than in the morning. When requests began to fail for size, the team restarted the session, and on Tuesday the agent spent three hours re-investigating 140 breaks it had resolved on Monday.

No single prompt call was at fault. An agent that runs for days poses two decisions a single call never does: how hard to think at each step, and what to carry forward as the work outgrows the context window. Dmitri wrote the requirements down before changing anything: classify breaks with at least 97% agreement with controllers, answer controller questions within 15 seconds at the 95th percentile (p95), and keep going through 8-hour days for the whole five-day close.

The pilot and the redesign

The pilot

Deepest effort on every stepquick questions wait a minute
Every tool result and thought keptaccuracy falls by afternoon
Session restarted when fullMonday's work forgotten

The redesign

Effort set per step from evalsfast where speed is required
Stale tool output clearedthe window stays focused
Findings in memory, history compactedTuesday resumes Monday's work
The pilot spent the same maximum effort everywhere and kept everything; the redesign allocates effort per step and gives each kind of growth its own lifecycle strategy.

2.6.2 Effort: one dial for how much work each response gets

Here is the belief that sank the pilot: more thinking is always safer. It is not. Deeper reasoning costs tokens, and tokens cost money and time, so a setting that is right for a hard investigation is wasteful, and slow, for a routine one. The control is the effort parameter, set as output_config.effort on a Messages API request (Claude Managed Agents sets it on the agent's model object).

Effort shapes every token of the response, not just the reasoning. It governs the text, the tool calls and their arguments, and thinking (the reasoning Claude writes before or between actions). Lower effort means fewer and terser tool calls; higher effort means more calls and fuller explanations. Think of it as briefing a senior analyst: "give this a quick look" and "dig into this properly" get the same expert, with different amounts of work.

Level When it wins What it costs
low Simple, high-volume steps where speed and cost matter most, such as subagent work Some capability; may cut corners on hard problems
medium Agentic steps that balance speed, cost and quality; the default on Claude Opus 5.5 and Claude Haiku 5.5 Moderate savings against high
high Complex reasoning and hard agentic tasks; the default on most other models More tokens and latency
xhigh Long-running agentic and coding work, often over 30 minutes Token budgets in the millions; not on every model
max The deepest possible reasoning and most thorough analysis No constraint on token spending; the slowest, dearest level

Memorise the order and the two defaults; recognise the rest. Three facts make effort an architect's lever rather than a magic word. First, it is a behavioural signal, not a token budget: Claude still thinks on a hard problem at low effort, just less. Second, the hard ceiling is max_tokens, which caps thinking plus reply, so at xhigh or max you set it large. Third, on Claude Opus 5.5 thinking is adaptive and always on, and a request that tries to disable it fails, so effort is the main control for depth, latency and cost there.

2.6.3 Allocating effort across a workload

If effort is a dial, the architect's question is not "what level?" but "what level for WHICH step?" A long-running agent is rarely one kind of work. Brightwater's close agent does three: a matching pass over thousands of near-identical lines, investigations of the few hundred breaks that remain, and replies to controllers who interrupt with questions. Each has a different binding requirement, so each gets its own level.

Dmitri ran an effort sweep: the same labelled set of 300 past breaks at each level, scored against the controllers' classifications, with tokens and time logged. Medium scored 94%, high 97.5% and xhigh 97.8% at about half as many tokens again. High was the lowest level that met the 97% target, so investigations run at high. Matching scored the same at low as at high, so matching runs at low. Controller questions are latency-bound and mostly short lookups, so they run at medium, which met the 15-second p95 in replay.

Effort allocated per step of the close

MATCHthousands of lines; low, accuracy unchanged
INVESTIGATEeach break; high, the lowest level at 97%
ANSWERcontroller questions; medium, inside 15 s p95
REVIEWevidence for raising a level: a fresh sweep
Each kind of step gets the lowest effort that meets its own requirement, measured in a sweep, not the highest effort available.

Changing levels inside one long conversation has a cost the pilot never saw. Effort is part of the rendered prompt, so changing the top-level value between requests can invalidate the cached prefix of a long session. On models that support it, a per-message effort change (a beta feature) avoids that: your code adds a role: "system" message with empty content and a new output_config.effort, and the cache before it still matches. The new level holds until a later message changes it.

Two neighbouring controls are often confused with effort. Task budgets (also beta) give Claude an advisory token target for a whole agentic loop, so it paces itself and finishes gracefully; effort tunes depth per step, a task budget tunes total breadth. And a bigger model is a different decision altogether, made before effort is tuned.

2.6.4 Three strategies for a context that keeps growing

Now the second decision. Every turn of a long agent adds tool results, reasoning and replies, and every token stays in the request until something removes it. On current models even earlier thinking is kept by default and counts as input, so higher effort fills the window faster. As the token count grows, accuracy and recall degrade, which Anthropic's documentation calls context rot. A bigger window postpones the limit; it does not stop the rot. The exam guide names three context lifecycle strategies, and each removes a different kind of weight.

Context editing (in beta) clears content by rule, on the server, before the prompt reaches Claude. Tool result clearing removes the oldest tool results once input passes a trigger (by default 100,000 input tokens), keeps the newest few (by default three) and leaves a placeholder so Claude knows the call happened. exclude_tools protects results that must stay. Thinking block clearing does the same for earlier reasoning. Your application keeps the full history, and the response reports what was cleared in context_management.applied_edits.

The memory tool lets Claude keep notes in files under /memories. Claude requests the file operations; your application runs them against storage you control, so retention and security are yours (validate every path so none escapes /memories). With memory enabled, Claude checks its memory directory before starting work, which is what makes notes survive a cleared window or a brand-new session.

Compaction (in beta) replaces older turns with a summary Claude writes, and the conversation continues from it. Either your application requests it on demand, choosing the moment, or the API runs it at a token threshold inside an ordinary request (default 150,000 input tokens, minimum 50,000). Your own instructions replace the default summary prompt entirely.

Strategy When it wins What it costs
Context editing Tool-heavy loops where old results and old reasoning are dead weight A cleared result must be fetched again; each clearing breaks the cached prefix
Memory tool Facts and progress that must outlive clearing, compaction or the session Storage, path validation and retention you build; extra tool turns
Compaction Long back-and-forth whose thread must continue past what one window holds well An extra model call; whatever the summary omits is gone

2.6.5 Selecting the strategy for the stated session length

The question that separates a guess from a design is: how long must the agent keep working, and what must survive each boundary? Anthropic's context engineering guidance gives the pattern. Compaction suits tasks with extensive back-and-forth, structured note-taking suits iterative work with clear milestones, and subagents suit exploration that can run in parallel. Brightwater's close has three horizons, and Dmitri gave each its own strategy.

One strategy per horizon of the close

Within a work block

Tool result clearingold ledger extracts go
Keepsthe newest results

minutes to an hour

Across one 8-hour day

Compaction on demandbetween work blocks
Keepsopen breaks, decisions, figures

longer than one window holds well

Across the five-day close

Memory toolthe break register
Keepsevery resolved break and finding

survives a new session

What has to survive grows with the horizon, so each horizon gets the strategy that keeps exactly that.

Within a work block, the weight is tool output: ledger extracts of 10,000 to 20,000 tokens each, useless once a break is explained. Clearing removes them. Across a day, the thread of conversation with controllers must continue, so the application compacts between work blocks with instructions that name what must survive. Across days, only memory persists: the agent writes each resolved break to a register in /memories as it works, so Tuesday's session starts by reading Monday's register instead of re-investigating.

The latency requirement decides one more detail. Threshold compaction runs inside whichever request crosses the trigger, adding a summarisation step to that request; if that request is a controller's question, it blows the 15-second target. Dmitri therefore requests compaction himself, on demand, at the end of a work block, or in the background while work continues. That compaction request is a separate call that carries no context_management, because the API rejects the two together. The investigation request below shows the in-session configuration; look at effort, the clearing trigger and clear_at_least, and the memory tool.

response = client.beta.messages.create(
    model="claude-opus-5-5",
    max_tokens=64000,                                  # hard ceiling: thinking plus reply
    betas=["context-management-2025-06-27",            # tool result clearing
           "compact-2026-09-04"],                      # history may open with a compaction block
    output_config={"effort": "high"},                  # investigation step, from the sweep
    system=CLOSE_AGENT_PROMPT,
    tools=[GET_LEDGER_EXTRACT, GET_BANK_LINES, GET_BREAK_HISTORY,
           {"type": "memory_20250818", "name": "memory"}],   # the break register
    messages=history,
    context_management={"edits": [{
        "type": "clear_tool_uses_20250919",
        "trigger": {"type": "input_tokens", "value": 120000},     # start clearing here
        "keep": {"type": "tool_uses", "value": 4},                # newest four stay
        "clear_at_least": {"type": "input_tokens", "value": 30000},  # worth a cache miss
    }]},
)

With memory and clearing both enabled, Claude is warned as the context nears the clearing threshold, so it can save findings first. The two layers support each other: clearing keeps the window lean, memory keeps what clearing would otherwise take.

2.6.6 Proving the choice holds at hour eight

A design for a long-running agent is only proven at the length it must run. The pilot had passed every test because every test was short. Dmitri replayed a full recorded close day against the redesign and scored it by hour, not on average, because context problems hide in the afternoon. Break classification held at 97 to 98% from the first hour to the eighth; controller replies stayed inside 15 seconds at p95, including the hours with a compaction; and a fresh Tuesday session listed Monday's resolved breaks before touching a single extract.

Two numbers made the cost visible. The applied_edits field showed how many tokens clearing removed each hour, and usage.iterations showed each compaction's summarisation call, which the top-level usage fields leave out. He then wrote the decision down, because Leonie's audit team needed to know why the agent could be trusted on day five as much as on day one.

Decision: effort and context lifecycle, month-end close agent (Claude Opus 5.5).
Requirements: break classification at least 97% agreement; controller replies 15 s at p95; 8-hour days for a 5-day close.
Effort: matching low; break investigation high (lowest level at 97% in the sweep); controller questions medium. max_tokens 64,000. Re-sweep on any model change.
Within a block: tool result clearing above 120,000 input tokens, newest four kept, at least 30,000 cleared each time.
Across a day: on-demand compaction between work blocks, never inside a controller reply. Instructions: keep every open break with amount, account and hypothesis, every decision with its approver, and the current task.
Across the close: memory tool; the break register in /memories is updated after each break; storage restricted to /memories, retained until the close is signed off.
Evidence: hourly accuracy on replayed days; applied_edits and usage.iterations logged per request.

2.6.7 The exam traps

Every trap below either spends effort where it is not needed or throws away context the task still needs.

  • ✗ Running every step at the highest effort "to be safe". ✓ Allocate from an eval sweep: the lowest level that meets each step's target. Raise a level only where your evals show a gain, because every step up spends more tokens and time.
  • ✗ Treating effort as a spending cap. ✓ Effort is a behavioural signal; max_tokens is the hard ceiling per request, and a task budget is advisory pacing for a whole loop.
  • ✗ Fixing slow replies by switching thinking off or moving every step to a smaller model. ✓ Lower the effort on the latency-bound steps only, and keep the reasoning-heavy steps at the level their accuracy requires.
  • ✗ Restarting the session or truncating the oldest turns when the context fills. ✓ Select a lifecycle strategy, and write state that must survive into memory before anything is removed.
  • ✗ Expecting compaction or clearing to carry work into tomorrow's session. ✓ Both act within one conversation; only the memory tool persists across sessions.
  • ✗ Letting threshold compaction fire inside a latency-bound request, with the default summary prompt. ✓ Compact on demand at a natural pause, with instructions that name what the summary must keep.

2.6.8 Put it together: allocate effort and a lifecycle for a long agent run

You now have every piece: effort as a per-step allocation, three lifecycle strategies with different losses, and a way to choose among them by horizon and latency. The fastest way to make them stick is to watch an agent forget a day's work and then remember it.

Lifecycle strategies sit on top of the rest of this domain. Model tier selection (2.1) picks the model before effort tunes it, and prompting technique selection (2.3) weighs prompted reasoning against native thinking. Context composition and token economics decides what enters each request, and cache breakpoints (2.5) decide how much of it stays cached when clearing or compaction rewrites the history.

Key takeaways

  • ✓ Effort (output_config.effort) sets how much work Claude puts into the whole response, thinking and tool calls included; it is a signal, while max_tokens is the hard ceiling.
  • ✓ Allocate effort per kind of step from an eval sweep, choosing the lowest level that meets each step's accuracy target and lower still where latency binds.
  • ✓ Change effort mid-session with per-message effort where supported, because a top-level change can invalidate the prompt cache.
  • ✓ Context editing clears stale tool results and thinking, the memory tool keeps durable state outside the window, and compaction summarises older turns so the thread continues.
  • ✓ Match the strategy to the horizon: clearing within a work block, compaction across a long session, memory across sessions.
  • ✓ Schedule compaction where latency allows and tell it what to keep, then validate the whole design at the stated session length, scored by hour.

Check your understanding

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

CCAR-P practice questions are being rewritten

The 189 CCAR-P practice questions here were written for the previous exam guide and are tagged to its domains. New questions for the December 7, 2026 guide (v1.1) are being written. Until they are ready, the practice for the new guide is the questions at the end of every lesson, with every answer option explained. The old bank stays open for general practice.

Back to Domain 2 → The previous-guide bank →

Sources