Stage 4 · Assumes you can code · Harnesses & Orchestration

What Is a Harness?

The scaffolding of code around a model that makes it useful.

A harness is all the code surrounding a raw model call: constructing the prompt, managing conversation history, deciding which tools to expose, executing tool calls, enforcing permissions, formatting output, and handling errors.

The model itself is stateless — it just predicts tokens given input. The harness is what turns that into something like Claude Code, a chatbot, or an autonomous agent.

A Harness Wraps the Model
HARNESS
Prompt construction
system + history
LLM
Tool execution
sandboxed, permissioned
Guardrails / validation
check before acting

Worked example. Send the identical request — "fix this bug: the login form crashes when the password field is empty" — to the same underlying model through two different harnesses:

A bare API call with no tools and no file access can only pattern-match on the sentence. It has never seen your codebase, so it guesses at a plausible fix and hands back a code snippet for you to find a home for, verify, and apply yourself. The model did the easy 20% — turning a bug description into plausible-looking code — and left the hard 80% (finding the actual file, checking it matches, applying it, confirming it works) to the human.

A coding-agent harness wraps the same model with file access, tool execution, and guardrails. It reads the actual file, locates the real crash (an unguarded .trim() call on an empty password), writes an exact diff, runs it past a guardrail that checks the change is scoped to one file with no destructive commands, applies it, runs the test suite in a sandbox, and reports back with a passing result. Nothing about the model changed — only the scaffolding around it did.

Same Model, Same Request, Different Harness
User: "Fix this bug: the login form crashes when the password field is empty."
No tools, no file access, no history beyond this message
Here's a likely fix — add a check before you use the password value:

```js
if (!password) {
  return showError("Password is required");
}
```

I can't see your actual code, so you'll need to find the right spot to paste this and verify it matches your codebase.
The model can only guess. It never saw the real code, can't verify its fix, and can't apply it — the human still does all the real work.

Switch between the two harnesses to see how far the same model gets on its own.

💡

Two products using the exact same underlying model can behave completely differently based purely on harness design — prompt construction, tool access, and guardrails.

Check your understanding
1. What is a "harness" in the context of LLM applications?
2. In the "fix this bug" example, why did the bare API call produce a much weaker result than the coding-agent harness, given it was the exact same model?
All lessons in Stage 4: Builders (optional)