Agent Harness
An agent harness is the software layer wrapped around a language model that turns the model into a working AI agent: the execution loop that calls the model iteratively, the registered tools and their sandboxes, context and memory management, and the rules and hooks that decide which information reaches the context window and which actions may run. The common formula: agent = model + harness. LangChain defines it bluntly as every piece of code, configuration, and execution logic that isn't the model itself. A concrete example: a coding agent should fix a bug. The model proposes a code change; the harness applies it in an isolated sandbox, runs the tests, catches the errors, and feeds the result back to the model on the next pass—along with the context of the failed attempt. Without a harness, the model remains a text generator; only the loop of action, feedback, and correction makes it capable of real work. Claude Code, OpenAI Codex, OpenCode, and Goose are examples of such harnesses. The harness is a decisive performance lever: the same model core delivers markedly different results depending on context strategy, tool design, retry logic, and verification. Rule and convention files like CLAUDE.md or AGENTS.md are part of the harness, not the model. Vendors ship an inner harness with their agents; teams build an outer harness on top from project rules, approval workflows, and review gates. "Harness engineering" is the emerging discipline of shaping this layer deliberately instead of leaving it to chance. Related concepts to distinguish: scaffolding (the build structure around an agent), the agent runtime (production execution environment), and the control plane (the governance layer).
Deep Dive: Agent Harness
An agent harness is the software layer wrapped around a language model that turns the model into a working AI agent: the execution loop that calls the model iteratively, the registered tools and their sandboxes, context and memory management, and the rules and hooks that decide which information reaches the context window and which actions may run. The common formula: agent = model + harness. LangChain defines it bluntly as every piece of code, configuration, and execution logic that isn't the model itself. A concrete example: a coding agent should fix a bug. The model proposes a code change; the harness applies it in an isolated sandbox, runs the tests, catches the errors, and feeds the result back to the model on the next pass—along with the context of the failed attempt. Without a harness, the model remains a text generator; only the loop of action, feedback, and correction makes it capable of real work. Claude Code, OpenAI Codex, OpenCode, and Goose are examples of such harnesses. The harness is a decisive performance lever: the same model core delivers markedly different results depending on context strategy, tool design, retry logic, and verification. Rule and convention files like CLAUDE.md or AGENTS.md are part of the harness, not the model. Vendors ship an inner harness with their agents; teams build an outer harness on top from project rules, approval workflows, and review gates. "Harness engineering" is the emerging discipline of shaping this layer deliberately instead of leaving it to chance. Related concepts to distinguish: scaffolding (the build structure around an agent), the agent runtime (production execution environment), and the control plane (the governance layer).
Implementation Details
- Tech Stack
- Production-Ready Guardrails