Slides · Harness engineering

Harness engineering: interview drills

Harness engineering: interview drills

Turning the module into spoken answers: ninety-second explanations, whiteboard arithmetic, a forty-minute design structure and failure diagnosis by layer.

By the end you can explain the core ideas briefly, work the standard derivations, structure a design answer in eight parts and diagnose a failure by layer.

Concept

How to use these drills

  • Answer aloud first, under a clock, then compare with the key. Reading a drill teaches little.
  • Provenance: the lesson’s questions are labelled Common industry pattern or Generated practice. None is verified as asked by a named company, and this deck makes no such claim.
  • The lesson says interviewers for agent-platform and AI-infrastructure roles often probe definitions, derivations, design structure and diagnosis. That is the lesson’s own observation, not a measured fact.
  • A sample answer is one good answer, not the only one.

Process

A ninety-second recipe

  1. Claim in one sentence: what it is.
  2. Why it exists: the failure it prevents.
  3. Example: one concrete case.
  4. Trade-off: what it costs or when it does not apply.
  5. Link to the next idea if time remains.

First check which meaning the interviewer intends. “Harness” can mean the agent’s scaffolding, an evaluation harness that runs a benchmark, a test harness, or an environment wrapper for reinforcement learning. Say which one you will answer.

Compare

The five ideas in one table

IdeaOne lineSource says
HarnessEverything around the model that is not the modelOsmani: all the code, settings and runtime logic outside the model itself
Guides and sensorsSteer before the action, observe after itBöckeler: guides are feedforward, sensors are feedback; computational ones are deterministic, inferential ones use judgment
State across sessionsProgress lives in files and version control, not in memoryYoung: a progress file, git commits, and a feature list initially marked failing
SubagentsIsolate context and return short resultsAnthropic: clean windows, summaries often 1,000 to 2,000 tokens
Proving a changeOne change, same held-out tasks, several trials, state-based gradingAnthropic: grade what the agent produced; run multiple trials

Each one pairs with a trade-off to say aloud: harness rules go stale, sensors cost time, files need a schema, subagents cost tokens, experiments cost runs.

Sources1 Agent Harness Engineering2 Harness engineering for coding agent users3 Effective harnesses for long-running agents4 Effective context engineering for AI agents5 Demystifying evals for AI agents

Worked example

Sample ninety-second answer: guides and sensors

“A guide steers the agent before it acts: conventions, instructions, code mods. A sensor observes after the action and lets the agent correct itself: tests, linters, an AI review. You need both, because feedback alone gives an agent that repeats mistakes and feedforward alone gives rules nobody checks. I prefer computational sensors first, since they are deterministic and fast, and add inferential ones, such as a model judge, for what code cannot see, accepting that they are slower and less deterministic. For example, a type checker runs after every edit and states the rule and the fix. The trade-off is that sensors that never fire are ambiguous: quality or blindness? I would seed a known fault to find out.”

Note the order: claim, why, example, trade-off. The summary of guides, sensors and the open question is from Böckeler (2 April 2026).

Source2 Harness engineering for coding agent users

Worked example

Sample ninety-second answer: surviving many sessions

“A long task outlives one context window, so the agent cannot rely on memory. Anthropic’s long-running harness has an initializer create a feature list with every feature marked failing, a progress file and an init script, and has each session commit to git with descriptive messages. A new session reads those files and the git log, then continues. They chose a JSON feature list because, they report, the model is less likely to overwrite JSON than Markdown. The trade-off is that someone has to design the files and the startup routine, and the agent still needs end-to-end checks: it tended to mark features complete without proper end-to-end testing.”

Source: Justin Young, Anthropic, 26 November 2025. Rehearse your own version with a different example.

Source3 Effective harnesses for long-running agents

Math

The standard formulas

whole-task success=pn\text{whole-task success} = p^npass@k=1−(1−p)k\text{pass@}k = 1 - (1 - p)^kpassk=pk\text{pass}^k = p^kcost per resolved task=cost per attemptsuccess rate\text{cost per resolved task} = \frac{\text{cost per attempt}}{\text{success rate}}steps before compaction=⌊c (W−R)−Fs⌋\text{steps before compaction} = \left\lfloor \frac{c\,(W - R) - F}{s} \right\rfloor
SymbolMeaning
ppPer-step (or per-trial) success probability, assumed independent
nnNumber of steps in the task
kkNumber of trials
WWContext window size in tokens
RRTokens reserved for output
FFFixed tokens (system prompt, tools)
ccCompaction threshold as a fraction of the window left after the reserve
ssTokens added per step

Independence is a simplification: real errors are often correlated, so say “roughly”. Anthropic defines pass@k\text{pass@}k as at least one success in kk attempts and passk\text{pass}^k as all kk succeeding.

Source5 Demystifying evals for AI agents

Worked example

Worked: long tasks and repeated trials

A 30-step task, each step 0.97. 0.9730≈0.4010.97^{30} \approx 0.401. A step success of 97 percent sounds safe, yet the whole task succeeds about 40 percent of the time.

One task, p=0.6p = 0.6 per trial, k=4k = 4.

AspectArithmeticResult
pass@4\text{pass@}41−0.44=1−0.02561 - 0.4^4 = 1 - 0.02560.9744
pass4\text{pass}^40.640.6^40.1296

At least one success in four tries is almost certain, but all four succeeding is rare. Which you quote depends on whether a user can retry (pass@k\text{pass@}k) or relies on it every time (passk\text{pass}^k).

Worked example

Worked: cost and steps before compaction

Cost per resolved task (illustrative): 0.75 dollars per attempt at 25 percent success: 0.750.25=3.00\dfrac{0.75}{0.25} = 3.00 dollars. 1.50 dollars at 60 percent: 1.500.60=2.50\dfrac{1.50}{0.60} = 2.50 dollars. The pricier attempt is cheaper per result.

Steps before compaction (illustrative): W=100,000W = 100{,}000, R=6,000R = 6{,}000, F=9,000F = 9{,}000, c=0.60c = 0.60, s=1,800s = 1{,}800.

StepArithmeticResult
Window after the reserve100,000−6,000100{,}000 - 6{,}00094,000
Compaction threshold0.60×94,0000.60 \times 94{,}00056,400
Room after fixed tokens56,400−9,00056{,}400 - 9{,}00047,400
Steps47,4001,800=26.3\dfrac{47{,}400}{1{,}800} = 26.326 whole steps

Round down: a partial step does not fit. If each step added 9,000 tokens, the same room would hold only 5 steps (47,4009,000=5.3\dfrac{47{,}400}{9{,}000} = 5.3), which is why capping tool output matters.

Worked example

Worked: subagent token overhead

Illustrative: N=4N = 4 subagents each read W=30,000W = 30{,}000 tokens, receive a 500-token brief and return S=1,200S = 1{,}200 tokens.

AspectParent does itFour subagents
Parent context growth4×30,000=120,0004 \times 30{,}000 = 120{,}0004×(500+1,200)=6,8004 \times (500 + 1{,}200) = 6{,}800
Total work tokens120,000120,000+4×500+4×1,200=126,800120{,}000 + 4 \times 500 + 4 \times 1{,}200 = 126{,}800
Overheadnone6,800, about 5.7%

You trade a little extra total work for a parent window that grows by 6,800 instead of 120,000, plus parallelism. Anthropic’s measured whole-system multipliers were far higher: about 4 times chat for agents and 15 times for multi-agent systems, so treat this simple count as a floor, not the real bill.

Sources4 Effective context engineering for AI agents6 How we built our multi-agent research system

Check yourself

Check: a task you need three times in a row

A task has 12 steps and each succeeds with probability 0.97 (independent). A user needs it to work three times in a row. What is the chance, and what does it tell you about step reliability?

Answer

One run succeeds with 0.9712≈0.6940.97^{12} \approx 0.694. Three in a row is 0.6943≈0.3340.694^3 \approx 0.334, which equals 0.97360.97^{36}. Even strong step reliability gives a one-in-three chance of a perfect streak. The remedy is to shorten the chain, verify steps, or improve step reliability, and to state that independence is an assumption.

Diagram

The order of a strong answer

Diagram: A strong answer goes in a fixed order, top to bottom: say what you are optimising, then context and tools, then the loop and state, then...

1 What you optimise

2 Context and tools

3 Loop and state

4 Enforcement and checks

5 Where people stand

6 How you will know

Diagram summary: A strong answer goes in a fixed order, top to bottom: say what you are optimising, then context and tools, then the loop and state, then enforcement and verification, then where people stand, and finally how you will measure success. A fixed order keeps you calm and lets the listener follow.

Process

The eight parts of a forty-minute design

The six-step order on the previous slide is the spoken spine; the eight parts spread it out. Step 1 (what you optimise) is part 1. Step 2 (context and tools) is parts 2 and 3. Step 3 (loop and state) is part 4, and orchestration (part 7) fits beside it. Step 4 (enforcement and checks) is parts 5 and 6. Step 5 (people) shows up as approvals and review inside parts 5, 6 and 8. Step 6 (how you will know) is part 8.

  1. Clarify: what success means, risk, languages, CI time, who reviews, budget per task.
  2. Context: a short instruction file that maps to docs, search tools, skills loaded on demand.
  3. Tools and environment: a sandbox per task, scoped tools, no secrets given to the agent, outbound network denied by default (this matters most for pushes and exfiltration).
  4. Loop and state: reproduce first, plan and progress files, limits, repeated-call detection.
  5. Enforcement: hooks, structural tests with fix-it messages, protected paths, approval to push.
  6. Verification: independent of the author, targeted then full tests, then a person.
  7. Orchestration: one agent by default, subagents for isolation, models routed by step.
  8. Evaluation and operations: held-out replay set, passk\text{pass}^k, cost per merged fix, traces, rollout, kill switch.

Diagram

Drill 1 at a glance: a coding agent for a monorepo

The prompt: about 300 issues a week, mixed difficulty, strict review, no production access.

Diagram: An issue comes off the queue into its own sandbox, and the agent loop runs there with hooks for lint, types and structural tests.

Issue queue

Sandbox per task

Agent loop with hooks

Independent reviewer

PR, CI, human review

Diagram summary: An issue comes off the queue into its own sandbox, and the agent loop runs there with hooks for lint, types and structural tests. An independent reviewer checks the result before a pull request goes through CI to a person. Not drawn here: traces and cost records from every run feed evaluation and failure triage, which produce new guides and sensors.

Concept

What a strong answer shows

  • It reproduces the problem before fixing it.
  • Someone or something other than the author checks the result.
  • It puts figures on the design: cost per task, how often reviewers should accept, step and spend ceilings.
  • Each task runs in its own space, and every loop has a clear stopping rule.
  • It names the kinds of failure expected and raises the improvement loop unprompted.
  • It is candid about what stays with people, such as judgment calls and security-sensitive code.
  • The usual weakness: a list of components with no reason or cost attached to each.

Worked example

Worked: re-costing when volume jumps tenfold

Illustrative numbers for the monorepo agent. The team spends 4.00 dollars per issue on 300 issues a week.

AspectArithmeticResult
Current weekly spend300×4.00300 \times 4.001,200 dollars
Volume now 3,000 issues, same per-issue budget3,000×4.003{,}000 \times 4.0012,000 dollars
Per-issue budget to hold 1,200 dollars1,2003,000\dfrac{1{,}200}{3{,}000}0.40 dollars
Issues that can get a full attempt at 4.001,2004.00\dfrac{1{,}200}{4.00}300 (10% of 3,000)

Say the choice aloud. Triage keeps the full budget where it pays: give a full attempt only to issues likely to succeed (reproducible, small, well-tested areas) and route the rest to people. The alternative, spreading 0.40 dollars over every issue, would leave each attempt far too thin for hard issues. Name the risk either way: measure acceptance on the triaged set before promising the numbers.

Diagram

Drill 2: a support agent that issues refunds

Diagram: Ticket text is untrusted input.

under limit

over limit

Ticket text: untrusted

Read tools

Propose refund

Policy engine

Commit with idempotency key

Human approval

Diagram summary: Ticket text is untrusted input. Read tools gather facts and the agent proposes a refund, which a policy engine checks. Under the limit the refund commits with an idempotency key so a retry cannot refund twice. Over the limit it goes to a person for approval first.

Sources7 The lethal trifecta for AI agents: private data, untrusted content, and external communication8 Idempotent requests

Concept

Drill 2 key points

  • Split tools into read, propose and commit; gate the commit with a policy (amount limits, customer history, fraud signals).
  • An idempotency key lets the server recognise a retried request; Stripe’s API documents this for safe retries.
  • Willison’s lethal trifecta: private data, untrusted content and external communication in one agent make data theft easy. Do not let the agent that reads ticket text also hold private data and an outbound channel.
  • Redact personal data, keep an audit log, evaluate on historical tickets with state-based graders, use proxy measures while outcomes arrive days later, keep a kill switch, and roll out by customer segment.

Sources7 The lethal trifecta for AI agents: private data, untrusted content, and external communication8 Idempotent requests

Diagram

Diagnose by layer first

Diagram: For any scenario, ask which layer broke.

lacked information

acted out of scope

wrong output unchecked

bad approach or loop

A failure to diagnose

Which layer broke?

Context

Constraint

Verification

Planning

Diagram summary: For any scenario, ask which layer broke. If the agent lacked information, it is context. If it acted out of scope, constraint. If wrong output went unchecked, verification. If it chose a bad approach or looped, planning. deepset names the same four failure types, each with its own kind of fix. Then change that layer and add a regression check.

Source9 Harness Engineering: How to Build Reliable AI Agents by Engineering the System, Not the Model

Worked example

Worked: four new scenarios

ScenarioLayerStructural fix
The agent deletes a branch it did not createConstraintScope the git tool to the task’s own branches; approval for deletes
After three hours it ignores the project’s naming ruleContextRe-load the rule from the instruction file after compaction; keep state in files
It reports “all tests pass” but the test runner never ranVerificationA stop hook that requires a passing run of the targeted tests
It retries the same failing command 30 timesPlanningRepeated-call detection, a step limit and an escalate-after-N-failures rule

Each fix changes the harness so the failure cannot recur quietly, and each gets a regression check: a task that reproduces the symptom.

Check yourself

Check: an API key in a commit

A coding agent commits a file that contains an API key it read from the environment. Which layer broke, and what is the structural fix?

Answer

Constraint: the agent acted outside what it should be allowed to do. Fixes: do not give the agent long-lived secrets in its environment, add a pre-commit hook that scans for secrets and blocks the commit with a clear message. Denying outbound network by default does not stop a local commit; it stops the push or upload that would send the secret out. Add a regression task that tempts the agent to commit a secret and expect the hook to stop it.

Check yourself

Check: a reviewer that approves everything

A second agent reviews every change, but it always approves. The team runs it with the same prompt and the same context as the author. Which layer is weak, and what would you change?

Answer

Verification: the check is not independent of the author. Change the reviewer’s instructions and context, and prefer deterministic checks (tests, type checks, structural tests) wherever one exists. Define what done means before the work starts. Anthropic also advises reading transcripts to see whether a grader accepts or rejects valid work, so sample the reviewer’s decisions against a human judgment.

Process

How to rehearse

  1. Time yourself on one explanation and one derivation. If either takes more than twice its budget, reread the lesson it comes from.
  2. Run a mock with a friend who may only ask, not teach. A 35-minute version: three explanations, one derivation, one scenario.
  3. For a 45-minute version, do one design drill and have the interviewer change a constraint twice.
  4. Afterwards, note the two places you lost the thread and repeat those on a nearby variant a few days later.
  5. Lead with what you are optimising and the order you will cover things.

Summary

Recap

  • Explain each core idea in ninety seconds with one example and one trade-off, after checking which meaning of “harness” is meant.
  • Know the derivations: pnp^n, pass@k\text{pass@}k, passk\text{pass}^k, cost per resolved task and steps before compaction.
  • Design in eight parts and re-cost aloud when a constraint changes.
  • Diagnose by layer, then fix structurally and add a regression check.
  • Every component should trace to a behaviour or a failure.

References

References & Sources (1 of 2)

  1. Agent Harness Engineering (opens in a new tab)

    Addy Osmani2026Article

    Used for Defines a harness as everything that is not the model, and lists its component families (15 May 2026).

  2. Harness engineering for coding agent users (opens in a new tab)

    Birgitta Böckeler2026Article

    Used for Guides as feedforward and sensors as feedback, computational versus inferential controls, and the open question about sensors that never fire (2 April 2026).

  3. Effective harnesses for long-running agents (opens in a new tab)

    Justin Young2025Article

    Used for Feature list marked failing, progress file, git commits, JSON over Markdown, and the end-to-end testing observation (26 November 2025).

  4. Effective context engineering for AI agents (opens in a new tab)

    Prithvi Rajasekaran, Ethan Dixon, Carly Ryan, Jeremy Hadfield2025Article

    Used for Subagents with clean windows returning summaries, often 1,000 to 2,000 tokens (29 September 2025).

  5. Demystifying evals for AI agents (opens in a new tab)

    Mikaela Grace, Jeremy Hadfield, Rodrigo Olivares, Jiri De Jonghe2026Article

    Used for Definitions of pass@k and pass^k, grading outcomes, multiple trials and reading grader transcripts (9 January 2026).

References

References & Sources (2 of 2)

  1. How we built our multi-agent research system (opens in a new tab)

    Jeremy Hadfield, Barry Zhang, Kenneth Lien, Florian Scholz, et al.2025Article

    Used for Measured token multipliers of about 4x for agents and 15x for multi-agent systems (13 June 2025).

  2. The lethal trifecta for AI agents: private data, untrusted content, and external communication (opens in a new tab)

    Simon Willison2025Article

    Used for Private data, untrusted content and external communication together let an attacker steal data through an agent.

  3. Idempotent requests (opens in a new tab)

    Stripe2026Documentation

    Used for Idempotency keys make a retried request safe against performing the same operation twice.

  4. Harness Engineering: How to Build Reliable AI Agents by Engineering the System, Not the Model (opens in a new tab)

    deepset2026Article

    Used for Classifying failures by the layer that broke, which depends on structured tracing (21 May 2026).