Engineering note
LangChain Dissects Agent Harness: From Model Capabilities to Deliverable Work Engines
AI Agent Practice Bloss0m Note 015 Agent = Model + Harness. If you are not a model, you are the Harness—Vivek Trivedy of LangChain opens with this statement, but the focus is not on the slogan, but on the deductive method: working backward from “what we want the Agent to do,” where each capability corresponds to a piece of engineering within the Harness.
This article compares with Martin Fowler’s control loops (guides/sensors) and OpenAI repo governance (scale and architecture), adding a component map from a framework and product perspective. It is recommended to first read Reading Map 13.
The Boundaries of Harness: What Counts and What Doesn’t
Harness = everything outside the model: code, configuration, execution logic. A bare model is not an Agent; it only becomes a work engine when augmented with state, tool execution, feedback loops, and enforceable constraints.
Specifically, it can include (as listed in the original text):
- System prompts
- Tools, Skills, MCP, and their descriptions
- Built-in infrastructure (file systems, sandboxes, browsers)
- Orchestration logic (sub-agents, handoffs, model routing)
- Hooks/Middleware (compaction, continuation, lint)
The boundaries can be debated, but Trivedy’s reason for choosing this division is very practical: it forces us to design the system around the model’s intelligence, rather than treating the Agent as a “chatty API.”
The Starting Point: What Models Natively Cannot Do
Models (in most cases) take text/multimodal input and output text. Out of the box, they cannot:
| Gap | Why Harness is Needed |
|---|---|
| Persistent state across interactions | Otherwise, amnesia happens in every conversation |
| Execute code | Otherwise, unable to change the world |
| Real-time knowledge | Otherwise, stuck at the training cutoff date |
| Prepare execution environments | Otherwise, unable to install dependencies or run tests |
Chat UI was the earliest Harness: a while loop that appends historical messages into the context—you have already used it, just didn’t call it a Harness.
LangChain’s deduction template:
Desired behavior (or bad behavior to fix) → Harness designed for it
This aligns with Fowler’s steering loop: see the problem → change the guide or sensor (in LangChain’s context, this often means adding a tool, hook, Skill, or script).
File System: The Most Fundamental Primitive
Desired Behavior: The Agent can touch real data, offload content that doesn’t fit into the context, and continue working across sessions.
Harness Design: Provide file system abstractions and fs operation tools. The world naturally works with files, and the model has been trained on a massive number of tokens on “how to use files,” making this an almost natural solution.
Unlocked Capabilities:
- Workspace: Read code, documents, and specifications.
- Increment and Offload: Write intermediate results to files, avoiding stuffing everything into the context.
- Collaboration Surface: Humans and multiple Agents coordinate through shared files (Agent Teams architectures rely on this).
Git adds versioning on top of the file system: tracking, rollbacks, and branching. The later mentioned plan files, Ralph Loop, and long-running tasks all assume that “the source of truth is in the repo.”
Bash + Code: General-Purpose Tools, Not Infinite Pre-built Tools
Desired Behavior: Autonomous problem solving, without humans needing to pre-write tools for every action.
Harness Design: ReAct loop + Bash/Code Execution. The model can write scripts and call CLIs on the fly—this is much closer to “giving it a computer” than a fixed set of tools.
The Harness can still provide specialized tools (browsers, DBs), but the default problem-solving path is now code execution: the model can dynamically invent tools, rather than being locked down by a tool list.
Comparing with Fowler 14: Bash outputs + test runners are the carriers of computational sensors.
Sandboxes and Environments: Where to Run and What to See
Desired Behavior: Safe execution, observable results, and the ability to install dependencies.
Harness Design:
- Sandbox: Isolated execution, on-demand creation/destruction, allow-listed commands, and network isolation (often required by enterprises).
- Default Toolchain: Language runtimes, packages, git, test CLIs, browsers—the model will not install Node or Playwright by itself; this is entirely the Harness’s responsibility.
Self-Verification Loop: Browser, logs, screenshots, test runners → Agent writes app → runs tests → checks logs → fixes. “Where to run, what can be used, how to verify” are all Harness-level design decisions, not something a prompt can replace.
This is on the same “observable behavior” track as Anthropic’s long task article 10 which emphasizes Puppeteer MCP and running the dev server successfully before E2E.
Memory and Search: Knowledge Beyond Weights
Desired Behavior: Remember what has been seen, and access new knowledge post-training.
Harness Design:
| Mechanism | Approach |
|---|---|
| Cross-session memory | Standards like AGENTS.md; Agent edits → injected into context on next startup (simplified continual learning) |
| Knowledge cutoff | Web Search, MCP (e.g., Context7) to check new version APIs and real-time data |
When weights cannot be changed at runtime, context injection is the only standard channel—this is also why OpenAI 11 makes knowledge into repo artifacts.
Context Rot: Harness as a Context Delivery System
Desired Behavior: Reasoning quality should not collapse during prolonged tasks.
Context Rot: The fuller the context, the worse the reasoning and task completion. The Harness must manage this scarce resource.
| Primitive | What it Solves |
|---|---|
| Compaction | Summarize/offload when the window is almost full; otherwise, the API simply errors out—the Harness must have a strategy and cannot leave it to the user |
| Tool output offloading | Massive tool outputs: keep the head and tail tokens in the context, write the full text to a file, and read it when needed |
| Skills (Progressive Disclosure) | Avoid stuffing all MCPs/tool descriptions at startup; the model doesn’t choose to “load everything at the beginning”—it’s the Harness protecting the model |
This complements the compaction discussion in blog 10: Anthropic says compaction alone isn’t enough; LangChain says compaction is a Harness necessity, which also needs to be paired with files, plans, and git.
Long-Running Autonomy: How Primitives Stack Up
Desired Behavior: Complex tasks, long durations, correctness, and autonomy.
Pain points of current models (original text):
- Early stopping
- Poor decomposition capabilities
- Incoherence across multiple context windows
Composite Solution (all are indispensable):
-
Files + Git Long tasks can generate intermediate products on the scale of millions of tokens; files persist progress; git allows new Agents to quickly read history; multiple Agents share a “work ledger.”
-
Ralph Loop (Harness Pattern)
- Hooks intercept the model’s attempts to “finish.”
- Re-inject the original goal into a clean context.
- Read the previous round’s state from files, forcing it to continue until the completion goal is met. Without a file system, it’s impossible to “read old states in a new round.”
-
Planning + Self-Verification
- Goal decomposition is written into a plan file (filesystem).
- Prompts remind how to use the plan.
- After each step is completed: run a test suite (hooks feed errors) or use prompts for self-evaluation. Verification anchors the solution to tests, forming a self-improvement signal.
Here we can see the conceptual alignment between blog 10’s initializer/coding agent, feature list, and LangChain’s product primitives: both externalize “handoffs and completion definitions.”
Model Training and Harness Co-Evolution
Claude Code, Codex, etc., often incorporate the Harness during post-training:
Useful primitive → Enters Harness → Next generation model becomes better at acting within that Harness
Side Effect (Overfitting): Switching tool implementations might degrade performance. The Codex 5.3 prompting guide mentions the apply_patch format—theoretically, a smart model should be able to switch patching methods, but co-training binds it to a specific Harness.
Insights from Terminal Bench 2.0 (emphasized in original text):
- The exact same Opus 4.6 scores much lower on the Claude Code harness than on other harnesses.
- LangChain’s previous article: By only changing the harness, the coding Agent went from Top 30 → Top 5.
Practical Conclusion: Choosing a model requires looking at its performance “on your tasks, on your harness,” not just looking at the leaderboard. The ROI of investing in a harness might be greater than switching models.
Will Harnesses Decrease? Why You Still Need to Learn Harness Engineering
Models might build in more planning, self-verification, and long-term consistency → some context injection will decrease. But LangChain believes that Harness Engineering will persist in the long term, just like Prompt Engineering:
- Environments, tools, states, and verification loops make any model more efficient.
- Today’s Harness often “compensates for model deficiencies,” but it is also about doing system design around model intelligence.
Research Directions for deepagents (original text):
- Orchestrating hundreds of Agents concurrently on the same codebase
- Agents analyzing their own traces to fix harness-level failure modes
- Just-in-time assembly of tools and context, rather than full pre-configuration
Comparison Table with Fowler, OpenAI, and Anthropic
| Theme | LangChain 15 | Fowler 14 | OpenAI 11 | Anthropic 10 |
|---|---|---|---|---|
| Define Harness | Everything outside the model | outer harness | Knowledge map + boundaries + observation | initializer + coding |
| State | Files, git, AGENTS.md | — | docs/, AGENTS.md | progress, feature list |
| Verification | In-sandbox tests, browser | sensors | E2E, UI, metrics | Puppeteer E2E |
| Long-Running | Ralph, compaction | Sensors throughout lifecycle | GC drift | Progressive features |
Insights and Recommendations: From Component List to Implementation Order
If you are going to build or evaluate a Coding Agent product, you can check the order of dependency:
- Are Files + git first-class citizens?
- Is Bash/code exec enabled by default and safe (sandboxed)?
- Are Compaction + tool offload enabled by default for long tasks?
- Do AGENTS.md / memory files have a clear lifecycle?
- Do Plan + test hooks define “done”?
- Do you mistakenly believe that a longer system prompt can replace any of the above?
During team discussions, mapping LangChain’s vocabulary (filesystem, Ralph, Skills) to Fowler’s vocabulary (guide, sensor) can help avoid the pitfall of thinking “we already have a linter,” when it actually only covers a tiny corner of sensors.
Conclusion
The value of this LangChain article lies in making the Harness components and deduction chain clear: every capability answers “what does the model natively lack → what does the Harness supplement.” When implementing, one still needs to go back to Fowler: which ones are computational, which ones are inferential, and whether the behaviour harness is merely supported by AI testing.
Original Source: Vivek Trivedy. The Anatomy of an Agent Harness. URL: https://blog.langchain.com/the-anatomy-of-an-agent-harness/