# AI Coding Agent vs Harness: What's the Difference?

> Source: <https://zyvop.com/ai-coding-agent-vs-harness-what-s-the-difference-x0od0>
> Published: 2026-11-23 05:36:32+00:00

**Recommendation:** Before swapping models to improve a coding agent, tune the harness — loop, tools, context compaction and permissions — since LangChain gained 13.7 Terminal Bench 2.0 points that way alone.
More in the playbook "Working with AI coding agents": <https://wpnews.pro/playbooks/coding-agents>

In February 2026, LangChain [raised its coding agent](https://blog.langchain.com/improving-deep-agents-with-harness-engineering) from 52.8% to 66.5% on Terminal Bench 2.0, a gain of nearly 14 points, without touching the model. It changed only the code around it. That code has a name: the **harness**.

"Agent" and "harness" are often used interchangeably, but one contains the other.

## TL;DR

**Coding agent = Model + Harness**

The **model** is the LLM. The **harness** is everything else: the loop, tools, context management, permissions, and extension points that let the model act on a real codebase. LangChain's Vivek Trivedy [popularized the formula](https://www.langchain.com/blog/the-anatomy-of-an-agent-harness) in early 2026. Anthropic's [Claude Code docs](https://code.claude.com/docs/en/how-claude-code-works) and OpenAI's [Codex writing](https://openai.com/index/unlocking-the-codex-harness/) describe their products the same way.

``` php
flowchart TB
    Dev["Developer task"] --> Agent
    subgraph Agent["Coding agent"]
        direction LR
        Model["Model<br/>decides what to do next"]
        Harness["Harness<br/>executes, constrains, feeds back results"]
        Model <--> Harness
    end
    Agent --> Env["Repo, shell, tests, web"]
```

## What each part does

A model takes text in and returns text out, including requests to call tools. Without tools it can only reply with text. The harness turns those requests into actions.

A [source-code study of eleven coding harnesses](https://arxiv.org/pdf/2609.00006) found that each makes a choice on the same seven subsystems:

| Subsystem | Role | Examples | 
|---|---|---|
| **Agent loop** | Alternates model calls with actions; owns stop conditions and recovery | Reason, act, observe, repeat (the "ReAct" pattern) | 
| **LLM integration** | Builds prompts; handles caching and model routing | Static-first prompt layout for [cache hits](https://claude.com/resources/articles/harnessing-claudes-intelligence) | 
| **Tools & actions** | What the agent can do | File edit, search, shell, MCP (an open standard for plugging in external tools) | 
| **Memory & context** | What the model sees | System prompt, `AGENTS.md` /`CLAUDE.md` (project instruction files), compaction (summarizing old context to free space) | 
| **Safety & permissions** | What runs, what asks, what is blocked | Approval prompts, sandboxes (isolated execution) | 
| **Orchestration** | Spawns and coordinates subagents | Parallel workers | 
| **Extensibility** | Lets users add capability | Hooks (scripts triggered at set points), skills (reusable instruction packs), MCP servers | 

The core loop, generalized. Only one step is the model; the rest is harness:

``` php
flowchart LR
    A["Prompt + context"] --> B["Model call"]
    B --> C{"Tool call?"}
    C -- "yes" --> D["Permission check"]
    D --> E["Execute tool"]
    E --> F["Observe result"]
    F --> A
    C -- "no" --> G["Final answer"]
```

Claude Code's docs describe the same cycle as three blended phases: gather context, take action, verify results.

## Real harnesses

- **Claude Code** : the[docs call it the harness](https://code.claude.com/docs/en/glossary) and Claude the model inside it. It supplies file access, shell execution, permission gating, memory loading, and the loop. Anthropic describes the Claude Agent SDK as a[general-purpose harness](https://www.anthropic.com/research/effective-harnesses-for-long-running-agents) .
- **Codex** : the CLI, IDE extension, web app, and macOS app all run on one Codex harness, exposed through a JSON-RPC "App Server".
- **Cursor** :[tunes its harness for each model](https://cursor.com/blog/continually-improving-agent-harness) and switches to that model's prompts and tools when you change models mid-chat.
- **mini-SWE-agent** : a research baseline that implements all seven subsystems in roughly 100 lines.

## Terminology traps

Don't confuse the harness with a **framework** (a library you import to build agents, like LangChain), a **runtime** (production infrastructure such as durable execution, like LangGraph) [per LangChain's docs](https://docs.langchain.com/oss/javascript/concepts/products), or an **eval harness** (software that runs an agent against benchmark tasks; it wraps the agent, not the model). "Scaffold" is a near-synonym. Two more caveats:

- **Definitions differ.** Cursor's[docs](https://cursor.com/blog/agent-best-practices) list the model as one of three harness components (instructions, tools, model); the LangChain formula excludes it.
- **"Harness engineering" has two senses.** One is tuning the agent's own scaffolding (Anthropic, LangChain, Cursor). The other is shaping your repo, tests, and feedback loops around an agent, as in[OpenAI's Codex team write-up](https://openai.com/index/harness-engineering/) .

## Why the split matters

**1. The harness can move results.** Besides LangChain's gain, Cursor says per-model tuning makes the same model noticeably faster and smarter. Both are vendor self-reports.

**2. But the model still sets the band.** [The Terminal-Bench authors found](https://arxiv.org/pdf/2601.11868) that swapping the model usually changed scores more than swapping the scaffold, while warning that the two are hard to decouple. Later public results add nuance:

- In a February snapshot of the leaderboard, [analyzed by Simon Willison](https://gist.github.com/simonw/3bff274abcbbbf8766e9437a542db248) , the same model scored 11 to 12 points apart across agents (Opus 4.6: 63.5% to 74.9%; GPT-5.3-Codex: 65.5% to 77.3%). The lowest was the deliberately minimal Terminus 2 scaffold both times. Yet the best entry for each frontier model landed within about 2.5 points of the others.
- By November, the top ten on [Snorkel's archived copy](https://snorkel.ai/leaderboard/terminal-bench-2-0/) spanned 77.3% to 84.7%. Three of the top four ran the same model (GPT-5.5) under different harnesses, and the confidence intervals (about ±2 to 3 points) overlap heavily.

A simpler or less tuned harness can cost a frontier model about a dozen points, but among well-built harnesses the gaps shrink toward the noise. These are self-submitted entries with different providers, settings, and run counts, so read them as indicative, not exact.

**3. The two are co-designed.** Cursor gives each model the tool format it saw in training. Treat benchmark numbers as scores for a model-and-harness pair, not for either alone.

**4. Harness assumptions expire.** Anthropic notes that harnesses encode assumptions about what the model can't do alone, and these go stale as models improve. Context resets added for Sonnet 4.5's habit of wrapping up near its context limit became dead weight with Opus 4.5. Cursor likewise says it has removed guardrails as models got more capable.

## Improving your own harness

[Böckeler's model](https://martinfowler.com/articles/harness-engineering.html) puts your controls in an outer layer around the tool maker's harness: *guides* that steer the agent before it acts and *sensors* that check after. Each can be computational (tests, linters, type checkers) or inferential (LLM review):

```
flowchart TB
    subgraph User["User harness: your repo and workflow"]
        Guides["Guides: AGENTS.md, skills, rules"]
        Sensors["Sensors: tests, linters, review steps"]
        subgraph Builder["Builder harness: the tool maker's code"]
            Loop["Loop, tools, prompts,<br/>context management, permissions"]
            Model["Model"]
            Loop <--> Model
        end
    end
    Guides -->|"steer before"| Loop
    Loop -->|"output"| Sensors
    Sensors -->|"feedback after"| Loop
```

- **Turn repeated mistakes into controls.** If an issue recurs, add a guide or sensor instead of re-prompting.
- **Keep instructions a short map, not a manual.** Context is scarce, and a giant instruction file crowds out the task and the code.
- **Let the agent verify end to end.** Anthropic found Claude marked features done without real testing until it was prompted to use browser automation.
- **Leave artifacts for the next session.** For long tasks, a progress file, git history, and a feature list let a fresh context window pick up the work.
- **Prefer deterministic checks.** Use tests, linters, and type checkers first; save LLM review for semantic judgment.
- **Re-test assumptions on model upgrades.** Ask what scaffolding you can now remove.

When an agent fails, a rule of thumb (mine, not a rigorous test): missing context, the wrong tool, or no way to check its own work points to the harness; everything in place and still reasoning badly points to the model.

## Limits of a harness

- Sensors don't reliably catch misdiagnosis, over-engineering, or misunderstood requirements, and Böckeler says relying on AI-generated tests to confirm behavior isn't good enough yet.
- Harness tuning fixes failures caused by scaffolding; it [can't add capability](https://www.langchain.com/blog/tuning-the-harness-not-the-model-a-nemotron-3-ultra-playbook) the model's weights lack.

## Takeaway

Don't ask "agent or harness?" Ask "which model, in which harness, with what guardrails?" The model supplies the reasoning. The harness decides what that reasoning can reach, how it is checked, and whether the work gets finished. Both matter, and neither is a free fix for the other.

## Source notes

- The harness study (arXiv 2609.00006) is a preprint and not peer reviewed.
- OpenAI's harness-engineering post was read via excerpts and Böckeler's summary, not in full.
- The LangChain, Cursor, and SWE-bench figures are self-reported by the vendors or projects.
- Terminal-Bench numbers: February figures come from a third-party analysis of the public leaderboard (27 submissions); November figures come from Snorkel's archived leaderboard page. The maintainers [paused new submissions](https://huggingface.co/datasets/harborframework/terminal-bench-2-leaderboard) to tighten integrity rules.
- Sources checked November 2026.
