Harness engineering: define what owns the run
A runtime contract for tools, state, budgets, permissions, and verification around an agent model.
An agent harness is the software surrounding the model call: it prepares context, exposes tools, executes permitted actions, records results, and controls continuation. A skill provides task instructions inside that system. It cannot implement the system’s execution guarantees on its own.
Anthropic’s Managed Agents architecture separates sessions, the harness, and execution sandboxes. That separation is useful when reviewing your own implementation: identify which component owns each decision and which state survives a restart.
Write the runtime contract first
For a repository repair agent, this is a proposed contract to adapt to your environment:
Input issue, repository revision, acceptance checks
Allowed work read files, patch workspace, run scoped tests
External work explicit policy decision before publication
Run limits model turns, wall time, spend, tool attempts
State task ledger, tool outcomes, artifact references
Completion acceptance checks + an inspectable patch
Recovery checkpoint + a recorded reason for interruption
Give each line an owner in code. For example, the model can request a tool; a policy handler decides whether execution is permitted. Keep credentials and authorization checks outside model-written arguments.
Make completion observable
A final message saying “fixed” is insufficient evidence for a repair task. Save the patch, the revision tested, the test command, and its result. A failed test should become new input to the loop or an explicit blocker, depending on the remaining budget.
Anthropic’s long-running harness example uses initialization, incremental work, and handoff artifacts to continue across sessions. Use it as a design example; evaluate the approach on your own tasks.
Review exercise
Take one failed run and answer:
- Did the harness expose the information needed for the next decision?
- Did a tool result describe an observation or merely report that a command started?
- Could the runtime distinguish completion, interruption, and budget exhaustion?
- Was the final artifact checked against the user’s acceptance criteria?
- Can another run reconstruct the current state without the full conversation?
Change one component and replay a small task set. Adding a planner, evaluator, or another agent also adds calls, handoffs, and failure modes. Anthropic’s harness design study examines these tradeoffs and the need to reassess scaffolding as models change.
Try it: inspect the verified-success trace, then compare it with the budget-limited run. Both stop; only one satisfies its acceptance checks.