Agent Harness

Agent harness is the infrastructure layer that wraps around an AI model to manage long-running tasks reliably. The model generates responses; the harness handles everything else — tool orchestration, filesystem access, human approvals, sub-agent coordination, state management, and failure recovery. In the formulation that has become standard: Agent = Model + Harness.

2025 proved that AI agents could work. 2026 has been about making them work reliably. The insight driving this shift is that even the most capable model cannot overcome a lack of scaffolding. LangChain's coding agent improved from 52.8% to 66.5% on Terminal Bench 2.0 by changing nothing about the model — only the harness. Meta's ~$2B acquisition of Manus in late 2025 was not for its model (which used foundation models from Anthropic, OpenAI, and others) but for its harness infrastructure. The competitive advantage has moved from intelligence to infrastructure.

Six Components

Production harnesses share a common anatomy. Human-in-the-loop controls insert strategic intervention points for irreversible actions — database deletions, payments, customer communications. The goal is not to supervise every step but to gate the high-consequence ones. Filesystem access management defines which directories an agent can read and write, what operations are permitted, and how conflicts are resolved; Claude Code's implementation prevents system file modification entirely.

Tool call orchestration manages sequencing, prevents infinite loops, and handles cascading failures. Vercel found that reducing tool availability by 80% actually improved agent performance — more tools means more confusion, not more capability. Sub-agent coordination enables specialized agents for different functions (research, writing, review), managing inter-agent communication and output merging. LangChain's Deep Research agent exemplifies this pattern.

Prompt preset management maintains instruction libraries for different task types, so the same agent can behave differently for code review versus code generation. And lifecycle hooks implement the full operational cycle: initialization, execution, state preservation, failure handling, retry logic, and logging. Anthropic's Claude Code exposes hooks as user-defined scripts triggered at lifecycle events like PreToolUse, PostToolUse, and Stop.

Design Principles

Three principles distinguish well-designed harnesses from brittle ones. Minimal necessary intervention: only intercede when models cannot self-correct. Progressive disclosure: begin with limited capabilities and expand based on actual requirements rather than anticipated ones. Fail-fast with recovery: detect failures quickly and route to alternative recovery paths rather than letting errors propagate silently through downstream agents.

Context Management

A critical harness function is compaction — what to do when the context window approaches its limit during a long-running task. Compaction intelligently summarizes and offloads existing context so the agent can continue working without losing critical state. This is distinct from agentic memory, which persists information across sessions; compaction manages information within a single extended execution.

The Three-Agent Harness

Anthropic's approach to harness architecture separates concerns into three distinct agents: a planner that decomposes goals into subtasks, a generator that executes implementation, and an evaluator that verifies output quality. This separation prevents the common failure mode where a single agent both writes and reviews its own work. The pattern has become influential in agent orchestration design, and reflects a broader shift from monolithic agents toward composable, role-specialized architectures.

Building production-ready harnesses requires months to years of engineering investment, creating competitive moats that commodity models cannot overcome. This has given rise to harness engineering as a distinct discipline — the third generation of AI interaction design, following prompt engineering and context engineering.