I compiled twelve independent deep-dives on AI harness architecture — from Anthropic’s internal docs, LangChain’s engineering team, Microsoft’s agent framework, academic surveys, and practitioners shipping production agents. They converge on one uncomfortable thesis: the model is commoditized. The harness is the product.

This isn’t theoretical. LangChain optimized only their harness — zero model retraining — and jumped from 30th place to top 5 on Terminal Bench 2.0. Same model, 14-point improvement. Claude Sonnet 4.5 scores 74.6% on GAIA with one scaffold and 44.6% with a different one. Thirty points. From orchestration alone.

If you’re still thinking about AI in terms of “which model,” you’re optimizing the wrong layer.

Agent = Model + Harness

The formula that crystallized in early 2026. Mitchell Hashimoto named it in February: “anytime you find an agent makes a mistake, you take the time to engineer a solution such that the agent never makes that mistake again.” Viv Trivedy at LangChain formalized it. By April, Google, Anthropic, and Thoughtworks had all published harness architectures.

The model is a stateless next-token predictor. It can’t run code, remember yesterday, call an API, or enforce a policy. The harness is everything else — the operating system around the CPU.

Meng et al.’s academic survey defines it formally: H = (E, T, C, S, L, V) — execution loop, tool registry, context manager, state store, lifecycle hooks, evaluation interface. In practice, production harnesses expand to 8-12 load-bearing components. Here’s what actually matters.

The Components That Actually Load-Bear

I’ll skip the textbook taxonomy and focus on the parts that separate agents that work from agents that demo well and fail in production.

The Execution Loop

Every harness has a while loop. Observe → think → act → repeat. The basic ReAct pattern. What separates production loops from toy loops is what wraps around that cycle: streaming tool calls, parallel execution, exponential backoff, token budgeting, and — critically — termination conditions that don’t rely on the model saying “I’m done.” Models hallucinate completion. The harness must decide when the work is actually finished.

Anthropic’s long-running agent pattern is worth studying. An initializer agent creates a feature list. A coding agent loops: pick next unfinished task, commit, update progress file, stop. The tracking file is JSON, not Markdown — because models silently edit Markdown but treat JSON as structured data they shouldn’t rewrite. That kind of implementation detail is harness engineering.

The Tool Layer

Tools are the agent’s hands. Every tool has a JSON Schema — name, parameters, expected output, permission level. The model generates a structured call, the harness validates it, executes it, returns the result. That separation between “model decides what to call” and “harness decides whether to allow it” is the foundation of safety.

MCP (Model Context Protocol) has become the standard interface. JSON-RPC, typed data exchange, plug-in tool servers. Introduced by Anthropic in November 2024, donated to the Linux Foundation’s Agentic AI Foundation in December 2025 alongside Google’s A2A protocol. MCP defines how agents talk to tools. A2A defines how agents talk to each other. Together they’re the production interop layer.

The key design decision nobody talks about: fixed tool registry vs. general-purpose bash. A fixed registry is auditable and predictable. Bash lets the model write its own tools on the fly. For open-ended coding, bash wins. For regulated environments, fixed registries are the only defensible choice. This tradeoff has regulatory implications — worth naming explicitly in any architecture review.

Context Management

This is where most agents die.

Context rot is measurable. With 20 retrieved documents in the window, accuracy drops from 70-75% to 55-60% because of positional bias. Models with million-token windows still degrade heavily past 100K on multi-hop tasks. The fix isn’t bigger windows. It’s ruthless curation.

The techniques that work in production:

Compaction — summarize old turns instead of truncating them. Preserve decisions and open questions, discard redundant tool outputs.

Observation masking — hide old tool outputs from context but keep the tool call records. JetBrains’ Junie does this.

Just-in-time retrieval — store file pointers, fetch content on demand. Claude Code uses grep/head to pull specific file segments instead of loading entire files.

Progressive tool disclosure — injecting hundreds of tool schemas at startup degrades reasoning. Load tool descriptions only when the agent targets a relevant subtask.

Sub-agent delegation — assign deep-dive tasks to specialist agents that return 1-2K token summaries instead of dumping raw analysis into the parent context.

The data point that should make everyone uncomfortable: changing only the harness format — no model swap, no fine-tuning — improved 15 different LLMs by 5-14 points on benchmarks while cutting token usage 20%. Context engineering is the highest-leverage activity in AI system design.

Memory

LLMs are stateless. Every inference starts from scratch. The harness provides persistence at three timescales:

Working memory — current conversation, in-context, dies with the session.

Episodic memory — previous interactions, intermediate results, stored in Redis or SQLite, lives for hours to days.

Semantic memory — factual knowledge, user preferences, successful patterns, stored in vector databases, lives permanently.

The emerging architectures are interesting. MAGMA (Multi-Graph Agentic Memory Architecture) represents memory across four orthogonal graphs — semantic, temporal, causal, entity — outperforming MemGPT by 18.5% on long-horizon reasoning. Knowledge Objects use hash-addressed discrete fact tuples that achieve 100% accuracy at 252× lower cost than in-context storage.

The design rule that separates good from bad memory: agents treat memory as a hint, not ground truth. Verify recalled memory against actual system state before acting. Stale memory is worse than no memory.

Lifecycle Hooks

This is what turns prompt suggestions into enforceable guarantees. PreToolUse, PostToolUse, PreCommit, OnPermissionRequest — interception points where deterministic code runs regardless of what the model wants to do.

“Never run rm -rf /” should be encoded in code, not in a system prompt the model might ignore.

Birgitta Böckeler’s framework is the clearest: every shipping harness has an inner harness (shipped by the model builder — SDKs, Cursor) and an outer harness (you assemble — AGENTS.md, MCP servers, skills). And every component is either a guide (steers before action) or a sensor (detects after action). Most harnesses are heavy on guides, light on sensors. That’s where they fail.

Verification & Evaluation

The model will tell you it’s done. It will be wrong. External verification is the only reliable check.

Computational sensors: linters, test suites, schema validators. Fast, deterministic, no ambiguity. Inferential sensors: LLM-as-judge evaluations, relevance scoring. Powerful but biased — a 2026 study found LLM judges show 67-82% self-family bias.

The correction cycle is the key pattern: if a test fails, the harness packages the error log and injects it back into context for self-correction. The agent can’t mark a task finished until external assertions return green.

And the frontier: self-improving harnesses that mine their own failure traces, propose edits, and validate through regression testing. HarnessX demonstrated +14.5% improvement over static hand-engineered harnesses using reinforcement learning to optimize the harness itself.

The Failure Modes

Two named patterns you must know.

Context rot — working context gradually accumulates stale, contradictory, irrelevant information. By step 10, the agent works against itself. Fix: deliberate pruning, explicit state handoffs, context resets.

Doom loops — agent retries the same failing action repeatedly without changing approach. Fix: hard retry cap. One retry for transient errors, then surface the failure.

The compound math is brutal: a 10-step process at 99% reliability per step = 90.4% end-to-end. At 95% per step = 60%. At 90% = 35%. That’s why sensors matter more than guides. A system that detects and corrects errors beats one that prevents them, because prevention degrades silently while detection is verifiable.

The Maturity Model

Level 0: Chatbot (no harness)
Level 1: System prompts only
Level 2: Structured tool use
Level 3: Cross-session memory
Level 4: Task decomposition / planning
Level 5: Automated verification
Level 6: Multi-agent orchestration
Level 7: Self-improving harness

Most production systems sit at Level 3-4. Very few reach Level 6+. Almost none are at Level 7. The gap between where most teams are and where the state of the art sits is the engineering opportunity of 2026.

The Binding Constraint

OpenAI’s Codex team: 3-7 engineers, approximately 1 million lines of harness code over 5 months. Early progress was slow not because the model was incapable but because the environment was underspecified.

That’s the insight. The binding constraint is not model intelligence. It’s environment specification.

The discipline that manages this — harness engineering — is now distinct from prompt engineering and model selection. It has its own name, its own conferences, its own job descriptions. Beijing’s 2026 policy documents explicitly list “harness engineering” as a key support area for AI development.

If you’re building AI systems and you’re still spending most of your time on model selection and prompt tuning, you’re optimizing the 10% that’s converging while ignoring the 90% that’s diverging. The harness is where the work is. The harness is the product now.


Full research report with component-by-component breakdowns, architecture diagrams, and source citations available in the companion research document.