CertPrep
Domain 2 · Lesson 2.6 · 7 min read

Reasoning Effort and the Context Lifecycle

Exam skillReasoning Effort and Context Lifecycle

Allocating reasoning effort and selecting a context lifecycle strategy (context editing, memory tool, compaction) that sustains task performance across the stated session length for a long-running agent workload with stated latency and accuracy requirements.

Spend reasoning where it changes the answer, and keep a long-running agent's context useful for hours with context editing, the memory tool and compaction, chosen by what the session must remember.

What you need to know

A long-running agent faces two budgets. Reasoning costs time and tokens on every step. Context fills up as tool results and turns accumulate, and an agent with a cluttered context forgets what it decided and repeats work. This skill asks you to allocate the first and manage the second so the agent stays accurate for the whole session, within its latency limits.

Allocate reasoning effort

Thinking helps where a step needs planning, comparison or multi-step reasoning, and wastes time where the step is routine. Current models let you steer how much they think with an effort setting, and can decide adaptively how much a request needs.

StepEffortWhy
Planning a migration, choosing between designs, diagnosing a complex failureHighErrors here propagate to every later step
Routine tool calls, copying data, formatting outputLowMore thinking does not change the result
A latency-critical reply to a userLow or moderateThe latency limit binds

Three context lifecycle tools

ToolWhat it doesFits
Context editingClears old tool results (and optionally old thinking) from the context as it grows, keeping the most recentAgents whose context fills with large tool outputs they no longer need
Memory toolLets the agent write notes to files outside the context and read them back later, including in a new sessionProgress, decisions and facts that must survive beyond the current context window or session
CompactionSummarizes the conversation so far and continues from the summaryLong conversations where the gist matters more than the detail

They combine. A typical long-running agent clears stale tool results with context editing, records its progress and decisions in memory, and compacts the conversation when it nears the limit.

Choose by what the session must remember

  • Exact state that later steps depend on (which batches are done, which files were changed, the decision on a design question): write it to memory. A summary can lose it; clearing tool results certainly will.
  • Bulky outputs that served their purpose (file listings, logs, search results): clear them with context editing.
  • The thread of a conversation (what the user asked, what was agreed): compact it, and check that the summary keeps the decisions.

In the exam

Items describe a long-running agent with stated latency and accuracy requirements and a symptom: it slows down, costs climb, it forgets decisions or repeats work late in the session. Pick the lifecycle tool that matches what must be kept (memory for exact progress and decisions, context editing for stale tool output, compaction for the conversation thread), and the effort allocation that spends reasoning on planning and hard steps rather than everywhere. Distractors raise effort on every step, enlarge the window, raise max_tokens, or restart without notes.

Check your understanding

Question 1

A coding agent works for hours on a large repository. Its context fills with file listings and test logs from many turns ago, and quality drops late in the session. Which change fits best?

Show answer

Answer: A. The clutter is stale tool output, which context editing removes. A bigger window or more output room does not remove it, and more reasoning does not restore focus.

Question 2

An assistant must remember a user's preferences and past decisions across separate sessions over several months. Which tool fits?

Show answer

Answer: B. Only memory persists outside the context, across sessions. Compaction and context editing manage a single session's context, and pasting history into the prompt grows without limit.

Question 3

An agent plans a database migration, then runs about 400 routine copy commands. Latency per step matters. How should reasoning effort be allocated?

Show answer

Answer: C. Errors in the plan propagate to every command, so planning earns more reasoning. Routine commands gain nothing from it, and their latency adds up.

Apply it: Keep Northgate's audit agent on track

Exercise · about 20 minCase: Northgate Software

Northgate wants one long-running agent to audit services for the deprecated logging library, working through the 160-service catalogue over a day-long session. In a pilot over 20 services, the agent slowed down after about 30 services' worth of output, re-audited two services, and once forgot a decision to treat configuration-only use as low risk.

  1. Allocate reasoning effort across the agent's steps.
  2. Design the context lifecycle: what is cleared, what goes to memory, and when compaction runs.
    Done when: a restart could resume without re-auditing anything.
  3. Say how you would test that the design fixed all three pilot problems.
Check your work
Show model answer

1. Effort. Higher effort when the agent classifies a service's usage pattern and assigns risk, because a wrong classification flows into the migration plan. Lower effort for listing files, running searches and writing the result record.

2. Lifecycle.

WhatTreatment
Search results, file listings, file contents from finished servicesCleared with context editing once the service's result is written
Progress: services audited, results written, services skipped and whyWritten to a progress file in memory after each service; read before choosing the next
Decisions and rules learned during the run, such as "configuration-only use is low risk"Written to a decisions file in memory when made; read at the start of each service
The conversation with the platform engineerCompacted when the context nears its limit, then checked against the decisions file

3. Test. Rerun the 20-service pilot, then a 60-service run with a forced restart halfway. Pass when no service is audited twice, every service in the catalogue has exactly one result, the configuration-only rule is applied after the restart, and time per service stays flat through the run.

Key termsEffortMemory tool

Sources