Skip to content

Interview question · Agent Harnesses

Design the harness for an internal coding agent that fixes failing tests across your company's repositories.

The model is a line in the config. The design is the sandbox it runs in, the permissions on every command, the log you replay when it breaks main, and the exit that says 'done' only when the tests do.

hardNewUpdated Nov 2026

TL;DR: Go component by component. A sandboxed workspace per task with no credentials and egress only to package mirrors; a small tool set (read, search, edit, run tests) with descriptions written for the model; permissions that allow reads and test runs, ask for anything outside the repository and deny pushes to protected branches; an append-only session log from which every model request can be rebuilt; context management that clears old test output and keeps notes; a subagent for exploration so search results do not fill the main context; and a loop whose only success exit is "the target tests pass and nothing else broke", followed by a pull request a person reviews.

How to approach it

Name the components, decide each one for this use, and walk a run end to end including a failure. Close with how you would measure and improve the harness.

A strong answer

Sandbox. One container or microVM per task, with a fresh checkout. No secrets inside; package installs go through an allowlisted mirror; network egress otherwise blocked. Destroyed after the run.

Tools. read_file, search (exact and symbol), edit_file with a diff format the model applies reliably, run_tests returning a compact summary plus the first failure's details. Each description says when to use it and what it returns.

Permissions. Allow reads and test runs. Ask (a human or a policy service) for edits outside the repository root, dependency changes and anything touching CI configuration. Deny git push, force operations and network calls outside the mirror. Decisions happen in code before each call.

Session log. Append-only events for every model request, tool call and result, compaction and permission decision, with versioned storage. Any step can be replayed to see exactly what the model saw.

Context management. Clear raw test output once summarised, keep a running notes file of hypotheses and findings, compact when the window passes a threshold, and send exploration (find every caller of this function) to a subagent that returns a short summary.

Loop and exits. Budgets on steps, tokens and wall time. Success only when the originally failing tests pass and the full suite shows no new failures; otherwise a named exit (budget, no hypothesis left, needs human). The output is a pull request with the diff, the test evidence and a link to the session log, never a direct merge.

ONE TASK
From failing test to reviewed pull request

Measuring and improving. Keep a fixed set of past failing-test tasks. Run every harness change (tool descriptions, compaction threshold, subagent use) several times per task against the current harness, paired, and report the fraction of tasks fixed every time and the cost per fix. Reviewers' rejections become new tasks.

What interviewers probe next

"What if the agent edits the test to make it pass?" The verification step checks that test files changed only when the task allows it, and reviewers see test diffs flagged. Reward hacking is a known failure for coding agents.

"Why not let it merge when everything is green?" Green tests are necessary, not sufficient; a person owns the change until the harness has a measured record on this kind of task.

How it's scored

Weak: Picks a model and gives it shell access.

Hire: Sandbox, tool set, permissions and a test-based exit.

Strong Hire: Every component decided for this use (sandbox, tools, permissions, log, context, subagents, exits), a run walked end to end with the PR as the boundary, test-tampering addressed, and a paired, repeated evaluation loop for harness changes.

Common mistakes

  • Credentials or network access in the sandbox.
  • "Done" decided by the model's message rather than the tests.
  • No log to replay when it breaks something.
  • Judging harness changes on single runs.
You just read a free answer. Every topic opens its first 5 answers to anyone. Sign in and the count per topic goes to 6, and the site remembers where you stopped in each one.Google sign-in · free · no payment details
HOW DID IT GO?
0
READING SIGNED OUT

Signing in raises your free answers from 5 to 6 per topic, adds an applied lesson in every topic and easy practice tests, and the site starts remembering you: mastery per topic, bookmarks, and a next-focus recommendation. Free, no card.

Sign in free
UP NEXT ON YOUR JOURNEY
DISCUSSION · 0

Nobody has commented. Post a correction or another way to answer.