Skip to content
Guides/Concept

Agent Harness vs Loop Engineering

Short answer

An agent harness is the system that validates, authorizes, executes, records, and returns observations for the actions a model proposes. Loop engineering decides how that harness iterates: the goal, validation, stop rule, budget, and feedback.

Site evidence · maintained by TianMingAI · reviewed 2026-07-21

Which controls belong to the execution harness, and which decide whether another iteration or external action is justified?

What we tested

We mapped worktree isolation, write scope, network access, and protected credentials to the harness, then mapped evidence requirements, retry caps, fallback, persistence, and human merge approval to the loop specification.

Observed result

The harness could contain an unsafe proposal, but containment alone did not make the proposal correct. The loop's checker still had to reject unrelated edits and missing evidence. Conversely, a good stop rule could not protect files if the runtime ignored its sandbox boundary.

What this does not prove

This is a responsibility map, not a claim that every product exposes the same layers. Some runtimes combine permissions, hooks, scheduling, memory, and review. The practical test is whether each control is technically enforced and independently reviewable.

Why it matters

The model proposes; the harness acts. A strong harness without a loop runs one safe step at a time; a loop without a harness iterates fast but unsafely. Production agents need both — the harness for safety per action, the loop for direction across many actions.

Practical checklist

  • Decide what the harness validates and authorizes before any action runs
  • Record every action and its observation so failures can be audited
  • Wrap the harness with the loop's stop rule and budget cap
  • Require human approval for irreversible actions
  • Keep the model proposing actions, not executing them directly

Example

A code agent: the harness runs only allow-listed commands, records each result, and refuses writes outside the repo. The loop wraps that with goal = make CI green, stop after 5 failures, and escalate to a human before merge.

Common failure modes

Letting the model execute directly instead of proposing to a harness
A harness with no loop — safe but directionless
A loop with no harness — fast but unsafe
No record of actions, so failures cannot be audited

Related templates

Sources & further reading