What is a harness? (And why it matters)
The harness is everything around the model: prompts, tools, memory, safety. Same model + different harness = different product.
By the end of this page โ you can define a harness in one sentence, name the five jobs it does, and explain why two apps using the *same model* can feel like different products.
The model is the engine. The harness is the car.
An LLM is a raw text-in/text-out function with no memory, no tools and no sense of what’s safe. The harness is the software around it that turns that function into a working product.
The five jobs of a harness
| # | Job | What it does | What you feel |
|---|---|---|---|
| 1 | Prompt assembly | Builds the full context every call: system prompt + history + retrieved docs + tool results | The agent “remembers” the task and follows your rules |
| 2 | Tool wiring | Defines which tools exist, their schemas, and executes the calls the model proposes | “It actually ran the test” instead of “I would run the test” |
| 3 | Context management | Trims, summarizes and re-injects old conversation so it fits the context window | Long sessions that don’t drift or run out of space |
| 4 | Safety & policy | Blocks or gates dangerous actions (commands, file writes, network) | A confirmation prompt before rm -rf |
| 5 | State & memory | Persists files, todos, logs between sessions | “It remembered where we left off” |
Same model, different car โ Two apps can call the exact same model API and feel completely different โ one is fussy and safe, the other is fast and sloppy. That difference *is* the harness: its prompts, its tool definitions, its context trimming, its guardrails. When someone says "this model is great in that tool", the model is only half the sentence.
Why a beginner should care
- Blame goes in the right place. When an agent fails, the cause is often the harness (bad tool description, aggressive trimming, weak guardrail) โ not a “dumb” model.
- Switching tools = switching harnesses. Moving from one coding agent to another changes the loop, the tools and the rules โ even if the model behind them is the same.
- You can build one. A harness is a few hundred lines of Python/JS around any model API. That’s how most “AI apps” you’ve used were made.
A harness can only *constrain* the model, never *improve* its basic intelligence. A great harness with a weak model tops out at weak; a great model with a sloppy harness fumbles the easy stuff.
Where the harness operates is called the AI environment โ context, tools, sandbox, memory. Let’s open that box.