- 01. The anatomy of all four MHTE layers. Model, Harness, Tools, Environment. With a dedicated diagram for each.
- 02. The five clusters that live inside the harness, with the Observability & Evals cluster as the engine that makes every other cluster improve.
- 03. The runtime layer underneath the harness. What you actually buy when you buy a managed agent platform, and why most enterprises never name what they bought.
- 04. Why guardrails belong in IAM and middleware, not in the system prompt. And the cost of getting that placement wrong.
- 05. Why Claude Code is called a harness. The walkthrough that maps a tool you may already use onto the five clusters, and what the June 2026 launch of Claude Fable 5 confirms about where long-running capability lives.
- 06. Why the same artifact looks different depending on which phase of the agent’s run you observe it from. And why that single idea makes failure attribution honest.
The Two-Second Illusion of a Working Agent
Quick recap. Episode 1 started at 2 AM with a failing agent and a room full of people asking the wrong question, which model do we swap in? By the end of it, we had reframed the problem. The model is one part; the real system is four layers standing side by side (Model, Harness, Tools, Environment), with the user outside the stack as the one fixed point. We named the layer where PMs have the most leverage, the harness. And we ended with a promise: if the harness is the real system, then what is actually inside it?
This episode keeps that promise.
Most teams can draw the four-box diagram from Episode 1 (Model, Harness, Tools, Environment) and then freeze. They know the geography. They do not have the street map. When an engineer says “our retry loop thrashed the model client and the state manager got out of sync,” a geographic diagram tells you nothing. A street map tells you where to look.
This episode is the street map. Each of the four layers has its own anatomy. The harness, the layer you own, gets a five-part breakdown, and one of those five parts is the feedback loop that makes every other part improve over time.
Two rules to carry through the rest of this episode. First, the same rule from Episode 1 still holds: the four layers stand side by side, with clean edges between them. Every part of your agent belongs to one layer and only one. If you can name it in two layers, one name is wrong. Second, and this is the twist Episode 1 did not have room for, during a single run, the same file can look different depending on which phase of the loop is examining it. The harness treats it as a boot instruction, the model as prompt text, and a tool as bytes to read. Same file, four different jobs. Once you can see both rules working at the same time, you can point at the layer that broke in your next incident instead of debating the whole system.
The idea in one boxA harness is not a wrapper around a prompt. It has five working parts: Identity, Memory, Orchestration, Interception, Observability & Evals. Each of the four layers owns a different job, and the same file can play a different role in each layer as a run moves through it. Keep both pictures in your head and the next incident review can point at the layer that broke, not the whole system.
What's Actually Inside When an Agent "Just Works"
Before we open any one layer, one rule. The four-way split is strict, not fuzzy. Every piece of your agent system belongs to exactly one of the four. If a layer's description names a tool, file, or capability that lives elsewhere, the layer is leaking, which is a bug in your mental model before it's a bug in the code.
- Model. A text predictor. No memory of the last call. No hands to touch anything. No sense of time.
- Harness. The manager. Decides when the agent acts and how. Owns no tools itself, it routes to them.
- Tools. The verbs the agent can perform. Search, read, write, call, send. Each tool defines its own contract; the harness only picks which one to run.
- Environment. Where the agent runs. Filesystem, sandbox, shell, git, network. Anything that survives a restart lives here.
The split matters because your ability to find a bug depends on it. Blurring a tool into the harness makes a permission bug show up as "the harness did something weird." Blurring a memory file into the model makes a stale file on disk show up as "the model forgot." MHTE is a discipline of keeping the four layers cleanly separate so the first place you look is the place the bug actually lives.
Agent = Model + Harness.
Vivek Trivedy, LangChain, The Anatomy of an Agent Harness, March 2026LangChain’s framing integrates Tools and Environment into the harness. MHTE splits them out as peer layers. LangChain’s framing is correct about what is and is not the model. MHTE is sharper about what lives where inside everything that isn’t the model.
Both framings agree on the key point: the model is one specialist. Everything else is the system that makes the specialist useful.
A third framing landed in July 2026 that every senior engineer will now hear in interviews. Anthropic's not the model's context window.The Harness is the loop calling the model and routing tool calls.model and routes toolThe Sandbox is the bounded environment where code runs and files change. code runs and files change. Think of it as an engineering view of the same picture: MHTE tells you which layer owns the failure; Session/Harness/Sandbox tells you which service holds the state, the decision, and the blast radius. Both are correct. Use whichever the room is already using.
Every turn a real agent takes runs the same seven-step loop. Print it above your monitor. Debug against it.
- Load the objective, policy, memory slice, and workspace manifest.
- Route to a model, one model today, most likely more than one tomorrow.
- Call the model with a bounded context.
- Gate every tool request against permission, identity, risk, and budget.
- Execute the tool or sandbox action.
- Record the event in the durable session log.
- Decide, continue, retry, branch, escalate, or stop.
Earlier agents ran a three-step loop: think, act, observe. A production agent runs seven: think, ask permission, act inside a sandbox, record what happened, check the work, and then decide what to do next. The extra four steps are where reliability lives. Cite: OpenAI Agents SDK and Anthropic Managed Agents, both July 2026.
Reliability comes from the loop, not just the logits.
The one line to keep on the whiteboard for this episode, distilled from Anthropic Managed Agents and OpenAI Agents SDK, July 2026.Inside the Model, The Brain That Forgets Every Sentence
A brain with no memory, no hands, and no clock.
The model is the smallest of the four layers, a surprise to most PMs. The vendor pitch treats the model as the center of the universe. The actual runtime role is narrower.
A model takes words in and predicts the next word. That is the entire job. Everything else, keeping state across sessions, calling tools, reading files, remembering anything from yesterday, is not the model's job. It is in the layers around the model.
Those are harness-level features. “Models can only take in data and output text. Models cannot out-of-the-box maintain durable state across interactions, execute code, access realtime knowledge, or setup environments. These are all harness level features” (Vivek Trivedy, LangChain, March 2026).
Unplug everything around the model, and it still talks. It just knows nothing. No yesterday, no tools, no running job, no user context it did not get on this turn. The brilliance is real. The missing memory is by design.
This is why model-swap is rarely the fix for a production failure. The model’s capability was not the bottleneck. The system around the model was. Episode 1 established that attribution. This episode shows you the system.
Inside the Harness, Five Organs That Make the Brain Useful
The harness has five organs. Each does a job the model cannot.
The harness is not a single box. It is a control plane with five distinct clusters. Each cluster owns a different class of decision. Each one is where a specific kind of failure originates or is caught.
Cluster 1. Identity
System prompts, persona, operating rules, role instructions, safety preamblThis cluster answers “who is this agent and what does it exist to do.”nt and what does it exist to do.”
Identity is the shortest cluster to describe, and the one most underestimated for its leverage. Every session inherits its answers. Every other cluster leans on it. A sharp, specific Identity section narrows the rest of the system’s failure space before the first token of user input arrives.
Cluster 2. Memory Policy
Context window management, compaction rules, boot-time file injection (AGENTS.md style), retrieval policy, what gets remembered, what gets pruneThis cluster answers “what does the model see on this turn.”does the model see on this turn.”
Memory Policy is where lives or dies. “Compaction intelligently offloads and summarizes the existing context window so the agent can continue working” (Vivek Trivedy, LangChain, March 2026).
A naive memory policy lets the window fill with low-value tokens, and then the team blames the model when it starts reasoning worse than it used to. A good memory policy keeps the window lean, compacts on a schedule, and shows the agent tools only when they are needed instead of dumping the full catalog on every turn.
PMs underestimate three things in this cluster. These include boot-time injection (what gets prepended on every session start), compaction cadence (when the harness summarizes and discards), and the retrieval policy that decides which of a thousand possible memories are worth pulling into the context for this specific turn.
The harness is a context manager on behalf of the model. Designing what gets passed over this boundary is the main determinant of agent performance.
Vivek Trivedy, LangChain, May 2026Read that as a job description. The model with no memory resides on one side. The persistent world, your files, your database, your history, sits on the other. Everything that crosses between them is trimmed, summarized, offloaded, dropped, or pulled back in on demand. Every one of those choices is a Memory Policy decision, and together they decide whether the agent still does good work on turn 200 or degrades to nonsense somewhere around turn 30.
One more pattern, because the production data on it is blunt. Memory in a long-running agent isn't one thing. It comprises three storage tiers with different rules. Session memory lives in the context window and dies on restart. Long-term memory outlives sessions and needs retention policies, access controls, encryption. Semantic memory is queried by meaning and needs an embedding pipeline and a retrieval policy.
AWS AgentCore now names and prices all three as separate services. And Datadog's 2026 production data shows what happens when teams collapse the tiers: 69% of all input tokens in production agent traces are system prompts. Organizational memory is injected raw into context on every turn because there is no durable memory architecture to hold it.
That is context rot being manufactured at industrial scale. Memory Policy is not a prompt engineering problem. It is a database architecture problem that happens to live inside the harness.
Anthropic's Managed Agents architecture, published in April 2026, adds the sharpest design idea this cluster has seen: the session is not the context window. Compaction and trimming make irreversible decisions. Once a message is summarized away, it is gone unless something stored it first.
Managed Agents keeps the full session as an append-only log outside the model's context window, and lets the harness query slices of it on demand: rewind to just before a decision, re-read the lead-up to a failure, resume exactly where a crash interrupted.
Keep the durable record outside the window. Keep the window-assembly logic in the harness. And never let a summarization step be the only copy of anything.
Anthropic's own harness added context resets because Sonnet 4.5 kept wrapping up tasks prematurely near the context limit, the team called it context anxiety. When they ran the same harness on Opus 4.5, that behavior was gone. The reset logic had become dead weight in a single model generation (Anthropic Managed Agents). The lesson every Memory Policy edit needs to inherit: tag every workaround with the model it was built for, the date it was validated, and the trigger that retires it. Episode 3 makes this a rule.
Cluster 3. Orchestration
This part of the harness decides what happens next. It determines what runs after one turn ends. It determines which specialist gets called when a job needs more than one. It determines whether a request goes to a cheap, fast model or a slow, careful one. It determines how a job picks up tomorrow where it left off if too big for a single sitting.
The Ralph Loop is the named orchestration pattern most teams first reach for. Originally attributed to ghuntley.com, popularized through LangChain’s anatomy post: “The Ralph Loop is a harness pattern that intercepts the model’s exit attempt via a hook and reinjects the original prompt in a clean context window, forcing the agent to continue its work against a completion goal” (Vivek Trivedy, LangChain, March 2026).
In practice, the Ralph Loop turns the premature-stop failure signature from Episode 1 into a controlled continuation. The harness catches the exit, checks whether the completion goal is met, and if not, restarts the agent with a clean context and a reference to its own progress file.
The second canonical pattern comes from Anthropic's own engineering team, and it answers a harder question: who decides the work is good? Their harness for long-running development uses three agents, one plans, one executes, and a third evaluates each output against a rubric before the loop is allowed to continue. The evaluator is not a quality check bolted on at the end. It is a gate the work has tThe insight behind the design negates a popular shortcut: agents are poor judges of their own work.re bad They confidently approve their own mediocre output almost every time.rompt telling it to be critical. that says be critical. It is a separate agent whosThis upgrades Orchestration from managing loops to defining loop policy.agement to loop policy. Not only how the agent loops, but under what conditions it moves forward, when it goes back, and who decides.
Orchestration is also where multi-agent patterns live. A supervisor agent that hands off to a specialist. A planner that writes a progress file a worker reads on boot. A classifier that picks which model to route a request to. None of that makes the model smarter. It is about deciding who works on what, and in what order.
Cluster 4. InterThis part of the harness stands between the model and the outside world, asking, at every step, "should this be allowed to happen?"hould this be allowed to happen? The checks live at the doors: before a model call, before a tool fires, after a file is edited, before an answer leaves the system. Hooks, guardrails, lint checks, policy gates, and middleware are different names for the same job.
A hook is a checkpoint. This is a small piece of logic that runs at a specific point in the agent’s lifecycle: before a model call, after a model response, before a tool fires, after a file edit, or when the session opens or closes. At that checkpoint, the harness can pause, inspect, modify, block, log, or redirect the agent's impendInterceptor is the same idea under a different name: it sits in the path of execution, saying, “before this continues, let me look.”ore this continues, let me look.”
The mental model that survives contact with production: Agent = Model + Harness. The model supplies intelligence. The harness supplies the machinery that lets it act, observe, and continue, and hooks are where that machinery gets its opinions. Think of an intern who is brilliant but new. You still want access controls, approval gates, checklists, and logs before you let them email a customer, run a query, or spend money. Every one of those is a hook. Every one of those is a hook.
Hooks are where product policy becomes enforceable system behavior. Not developer plumbing. Every PM question about an agentic product leads to a hook:, a before_tool hook that blocks or routes to human approval.
LangChain’s middleware post names six hook primitives that define this cluster’s vocabulary: (list not provided in prompt)
| Hook | When it fires |
|---|---|
| before_agent | Once on invocation |
| before_model | Before each model call |
| wrap_model_call | Wraps the model call end-to-end |
| wrap_tool_call | Wraps tool execution |
| after_model | After model response, before tool execution |
| after_agent | Once on completion |
These six are the concrete surface where business logic, compliance, PII redaction, content moderation, tool injection, retries, and human-in-the-loop gates get attached. “You can’t prompt your way to HIPAA compliance” (Sydney Runkle, LangChain, March 2026).
You already have the loop from earlier. Hooks aren't a second diagram to memorize. They're the checkpoints between the steps of the loop you already know. Print this once; stop redrawing it.
- Load objective, policy, memory, workspace →
before_agent, input guardrail (block unsafe requests, classify task, load tenant policy) - Route to a model → harness-internal; no user-facing hook
- Call the model →
before_model(trim history, retrieve context, mask PII, attach tools),wrap_model_call(retry, cache, switch model, enforce budget) - Gate the tool request →
after_model(inspect the plan), thenbefore_tool_call/ tool guardrail (validate args, check permissions, require approval for refunds, cancellations, writes) - Execute the action →
wrap_tThe tool itself lives in the Tools layer, and the sandbox it runs in is Environment.runs in is Environment. The hook does not own either, it decides whether the crossing happens. - Record the event →
after_tool_call(validate schema, run tests, log, auto-format, or ask the model to self-correct) - Decide continue / retry / branch / escalate / stop → output guardrail before the answer leaves the system,
after_agentonce on completion (save memory, write audit log, close the task)
Keep three things separate in your head. A hook is a checkpoint inside the harness. A tool is the thing the hook lets the agent use, a search API, a payment call, a file write. A sandbox is the room the tool runs in: the filesystem, the shell, the network. When a run goes wrong, you want to be able to say the check was missing, or the tool returned junk, or the sandbox let something through it shouldn't have. This leads to three sentences and three different fixes. Some online writing lumps all of it into “the harness.” Inherit that habit, and your next incident review takes an extra hour finding a layer you had already blurred.
Two families of hook, one distinction that decides everything. Martin Fowler's team splits every hook into one of twSome run before the model acts, narrowing what the model is allowed to consider.del is even allowed to consider. Load only the right context. Expose only the right tools. Block requests that should not be attempted at alThe others run after, catching what the first kind could not prevent.he first kind could not prevent. Check the output against a schema. Run a test. Ask a separate model to grade the work. Refuse to release a bad answer.
The after-checks come in two flavors. Some are mechanical, a regex, a schema check, a unit test. Fast, cheap, and they give the same answer every time. Others use a second model as the judge, a rubric grader, an LLM-as-judge. Slower, costlier, and less predictable, but they can weigh things the mechanical checks cannot. A production-grade harness uses both: the mechanical ones for failures with a clear right answer, and the model-as-judge for things like tone, helpfulness, or whether the plan actually addressed the question.
The product question is not “should we trust the model?” It is “which of these decisions can tolerate model judgment, and which need enforceable system controls?” A good agent does not remove autonomy. It places autonomy inside a safe operating envelope.
| Decision the agent faces | Let the model reason | Add a deterministic hook |
|---|---|---|
| How to explain a concept | Yes, style and reasoning stay flexible. | Only if output must follow a template. Then an output guardrail. |
| Delete customer data | No. Downside is high and irreversible. | before_tool_call with permission check plus human approval. |
| Draft a support email | Yes, when low-risk. | Output guardrail for tone, PII, policy compliance. |
| Format a JSON response | No need to trust the model here. | after_tool_call schema validation and auto-repair. |
| Choose which documents to read | Partly. | Retrieval / context hook curates the permitted set. |
| Send money, cancel, message externally | Usually no. | Human-in-the-loop before the side-effecting tool fires. |
| Fix a failed test | Yes, once the harness shows the failure. | Feedback sensors: test runner, linter, schema validator. |
The rule that survives every product review: if the action is low-risk, reversible, and easy to verify, let the agent act autonomously. If it is high-risk, irreversible, privacy-sensitive, costly, or customer-facing, a hook must enforce the check, deterministically for clear policy, human-in-the-loop for the rest. This is why hooks are a PM concept, not developer plumbing.
Compliance lives in Interception. Not in a longer system prompt. Not in a smarter model. In a hook that fires at the right phase and either lets the turn continue or does not.
A common boundary mistake is to let safety rules live in the system prompt. Anusha Kovi at Amazon flags it: “Safety rules, like ‘don’t query personal information columns,’ shouldn’t live in the prompt window. Guardrails belong in identity and access management” (InfoWorld, April 2026).
The prompt is a soft request the model can ignore. The IAM rule is a hard constraint enforced by the runtime. Compliance-grade guardrails belong below the prompt layer. In the middleware hooks above, and in IAM below.
The prompt layer is the worst place to put a refusal you actually need.
The same principle now ships as a concrete primitive. In June 2026, LangChain shipped rubric support in deepagents. A portable way to hand the agent an explicit, machine-checkable definition of done and force the loop to continue until the rubric is satisfied.
Verification isn't an afterthought bolted on at the end of a run. It is an interception concern, firing at the boundary, deciding whether the turn is allowed to call itself finished.
The 2026 attack data makes this placement critical. In 2024, the main way to attack an agent was through what the user typed. In 2026 there are five doors: the user's input, the web content the agent browses, the output of the code it runs, the messages it receives from other agents, and the results returned by external tools.
Each one is an injection vector. One June 2026 study found the simplest tool-description injection succeeded 93% of the time on average across frontier models. A prompt-layer guardrail does not survive that.
A runtime policy in the Interception cluster does.
The structural version of this defense is worth studying, because Anthropic published theirs. In Managed Agents, credentials are never reachable from the sandbox where the agent's generated code runs. Tokens live in a vault, tool calls route through a proxy that fetches credentials the agent never sees, and in Anthropic's words, "the harness is never made aware of any credentials." They did not write a rule telling the model not to readThey built an architecture with no tokens to read.re where no tokens are readable. That is the difference between asking for safety and engineering it.
Cluster 5. Observability & Evals
This is the part of the harness that watches the harness. It records what the agent did on every run (every decision, tool call, retry) in a form readable by both humans and dashboards. Then it turns yesterday's failure into a test the agent must pass tomorrow. It answers two questions at onceIs this working? And how do we make it work better next week than it does this week?er next week than it does this week?
Observability and evals are two distinct primitives co-located within the same cluster.ives co-located in the same cluster. Observability is the raw trace layer. Every agent run, decision, tool call, and retry is logged in a form a human and a dashboard can both read.
Evals are the judgment built on top. Trajectory evals, step evals, outcome evals, hallucination checks, cost regressions. You need both. An observable harness without evals is one you can watch but not improve.
An eval suite without observability is a judgment you cannot explain when it disagrees.
“Evals are the foundation that power the harness hill-climbing process. Evals encode the behavior we want our agent to exhibit in production. They’re the ‘training data’ for harness engineering.” (Vivek Trivedy, LangChain, Better Harness: Hill-Climbing with Evals, April 2026).
This cluster improves all others. An eval gap caught on a pull request can prevent a production incident. A production failure mined into a new eval can prevent the same failure three weeks later. “Every trace contains valuable data to produce a potential eval. And every (good) eval makes the harness better” (ibid).
Episode 8 takes this cluster apart in detail. For this episode, the point is only that the fifth cluster exists, that it belongs inside the harness, and that it is what turns the harness into a system that gets better with use.
Swap the harness, same model behaves differently. That is the harness’s entire claim.
Episode 2 // Harness EngineeringThe five clusters are not optional the way a nice-to-have feature is optional. They are optional the way a seatbelt is optional: you cMost production harnesses today have all five clusters implemented, but they are rarely named, owned, or mapped cleanly.ely named, owned, or mapped cleanly.
The value of the map is that you can see, at a glance, where your harness is complete and where it has holes.
Why Claude Code Is Called a Harness, Not a Model
If the five clusters still feel abstract, here is the concrete version. You've probably already used the most widely deployed harness in the world without thinking of it as one.
Claude Code looks like a chat with a model in your terminal. It is not. The model behind it — Opus, Sonnet, now Fable — is a stateless text predictor: words in, words out, with nothing else. Everything that makes Claude Code feel like a coworker rather than an autocomplete is a harness, and every piece of it maps onto the cluster anatomy you just read.
When it starts, it reads a CLAUDE.md file from your project and loads it into context. That is Identity plus Memory Policy. This means boot-time injection, where the harness decides what the model should know before the first word of your request arrives.
When a long session approaches the context limit, it compacts: summarizes the conversation so far and continues from the summary. That is Memory Policy. It trades detail for continuity on a schedule the harness owns.
When it breaks a task into steps, spawns subagents in parallel, and decides when the job is done, that is Orchestration. When it stops to ask your permission before running a shell command or editing a file, that is Interception. This is a hook firing between the model's intention and the action's execution.
And when every action lands in a transcript you can audit later, that is ObservabiliThe model did none of that and cannot do any of that.odel cannot do any of that. Statelessness is not a bug to be prompted away, it is the architecture. Anthropic says it themselves in the engineering post that introduced Managed Agents: "Claude Code is an excellent harness that we use widely across tasks." The HuggingFace agent glossary offers the cleanest one-line definition in circulation: the harness is "the execution layer inside the agent: it calls the model, handles its tool calls, decides when to stop."
Now read the June 2026 launch of Claude Fable 5 with that definition in hand. Anthropic's most capable generally available model ships with this exact positioning: it can work for days, planning stages, delegating to sub-agents, and checking its own work inside a harness such as Claude Code or Managed Agents.
The frontier lab's flagship release does not claim the model runs for days. It claims the model runs The brain does not arrive with hands; the harness is the hands.th hands; the harness provides them. And the labs now say so on their own launch pages.
OpenAI made the same move from the other direction. Their 2026 engineering work on Codex is a harness catalog by another name: server-side compaction shipped as an API endpoint so long sessions survive their own context limits, versioned skill bundles, a managed shell container for durable tool execution, and a published account of the Codex agent loop itself.
The famous 25-hour uninterrupted Codex run wasn't a smarter model left alone. It was a model held upright for 25 hours by exactly this machinery. When both frontier labs ship the wrapper as a product and document it as engineering, the debate about whether the harness matters is over.
The only open question is who owns yours.
Inside the Tools, The Agent's Hands on the Real World
The verbs the agent can actually do in the world.
Tools are the agent’s hands. Everything the agent actually does in the world happens through a tool. Bash. File read/write. Web search. An MCP endpoint. A skill wrapper. A custom internal API. Each tool has a name, a schema, and a permission scope.
Tools do not live inside the harness. They are a peer layer. The harness decides when and which tool to call. The tool itself is the callable capability with its own contract. This matters because it's the origin of Episode 3’s narrow-gate principle. Fewer, sharper tools produce steadier behavior not because the model is restricted, but because the tool layer has a smaller surface that the orchestration cluster has to choose from.
Two common boundary violations to watch for. First: a tool's schema, what it accepts, what it returns, sometimes gets copied into the harness's prompt template. Now the same schema lives in two places, and one day they drift out of sync and nobody notices until a tool call fails. The schema belongs to the tool; the harness references it but does not own a copy.
Second: skills. Skills Skills are a harness-level idea that wraps a tool (or tools) with context about when to use them.of tools) with context about when to use it. “Skills are a harness level primitive that solve [tool sprawl] via progressive disclosure” (Vivek Trivedy, LangChain, March 2026).
The skill reveals tools as needed; the tools themselves stay peer-layer callable.
A quick test. If you can name the tool’s schema, its permission scope, and its failure mode without referring to the harness, the tool is in the right layer. If its behavior only makes sense in the context of a specific prompt template, something has leaked upward.
Inside the Environment, The Ground the Agent Stands On
The ground the tools stand on, and the state that outlives the session.
Environment is the layer most teams under-name. They draw the four-box diagram, label the rightmost box "environment," and move on. Then they spend a quarter debugging intermittent, hard-to-reproduce bugs that live entirely inside it.
The substrate has structure. Read it bottom-up: filesystem & git is the durable surface every fs-op lands on; sandbox & namespaces defines what a wrong action cannot reach; OS & shell is what bash actually executes against; browser & network is the reach, where allow-lists and rate caps belong; memory files are how the agent offloads context the window cannot hold and resumes work after compaction.
Two boundary tests. If a behavior changes when you redeploy on a different image with the same model, harness, and tools, then the cause lives in the Environment. The cause lives in the Environment. If the agent forgets a fact between sessions that you expected it to keep, the cause is the memory-files layer, not the model.
The Environment is where reproducibility is bought or lost; the other three layers can only spend what this one provides.
The test for what belongs in Environment is the restart test. If you kill the agent and start a new session, what survives? The filesystem survives. The git repo survives. The sandbox definition survives.
A file called AGENTS.md on disk survives. The model's in-context memory does not. The current tool-call result does not. Anything that survives a restart lives in Environment. Anything that does not, does not.
"The filesystem is arguably the most foundational harness primitive because of what it unlocks" (Trivedy, March 2026). The file lives in Environment; the policy that reads and writes it lives in the Harness's Memory cluster.
Two boundary traps follow. A sandbox is Environment, but the allow-list that decides what the sandbox is permitted to do belongs to the Harness: the room is the Environment; who is allowed through the door is the Harness's call. And a browser is a Tool, but the sandbox profile that browser runs in is Environment.
The same browser can be tool or Environment depending on which property you are describing.
Who Owns Which Layer of the Agent
The harness is what you design. The runtime is what runs it.
Sydney Runkle and Vivek Trivedy at LangChain say it directly: "to build a good agent, you need a good harness. To deploy that agent, you need a good runtime" (LangChain, April 2026). The harness owns the prompts, the skills, the tools, the loop, and the hooks.
The runtime owns the plumbing that makes those decisions reliable in production: durable execution that survives a crash, checkpoints that let a long job resume where it stopped, multi-tenancy that keeps users separated, observability that captures every run, time travel that lets you replay a past state to debug it.
You either build the runtime or you buy it. Buying it does not remove it as a layer you depend on. Most enterprises buy a managed runtime (LangSmith Deployment, AWS Bedrock AgentCore, Google Vertex Agent Engine) and never name what they bought.
They think they bought a harness. They bought the layer underneath, and the harness sits on top of it. Know the visibility tax before you sign: a closed runtime or harness limits your ability to inspect exactly what context the model received and why a decision was made. Invisible until the day you need to debug a compliance incident or migrate models.
In April 2026, a third option appeared between build and buy. Anthropic's Managed Agents virtualizes the agent into three stable interfaces. The session (the append-only record of everything that happened), the harness (the loop that calls the model and routes its tool calls), and the sandbox (the isolated environment where code actually runs). And lets the implementation behind each interface be swapped without disturbing the others.
Anthropic calls the result a meta-harness: opinionated about the interfaces around the model, deliberately unopinionated about which specific harness runs inside them. A meta-harness rents you the infrastructure while leaving the judgment. Your evals, your policies, your workflows. Explicitly in your hands.
When an agent fails in production, the failure can live in any of five places now. Model. Harness. Tools. Environment. Or the runtime that holds the four together. Most teams who debug carefully discover this on the third incident, when "the agent forgot" turns out to be a checkpoint that did not save.
. The runtime describes how the agent stays running.
One File, Four Lenses, A Single Turn, End to End
Here is the idea that makes failure attribution honest. The four layers are segregated by responsibility. Every artifact belongs to exactly one of them. But during a single run, the same artifact can be perceived through all four lenses depending on which phase of the agent's loop you are in.
One file. Four layers. Four different things they see.
Take an AGENTS.md file sitting on disk.
Boot phase. The Harness reads the file. It belongs to Environment. The Harness is operating on it.
Context assembly phase. Parts of the file's contents become prompt text. The Harness's Memory Policy cluster decides how much, which sections, in what order.
Inference phase. The Model sees prompt text. It has no awareness that some of those tokens came from a file. To the Model, they are indistinguishable from tokens that came from the user's message or from the system prompt.
Tool phase. If a tool like fs-read is called on the file later in the run, Tools treats it as a readable target. The Tools layer does not know or care that the Harness already injected parts of it earlier.
Same file. Four phases. Four perceptions. This is why a symptom that looks like the model hallucinated may actually trace back to the Harness's memory policy (wrong content injected), or to the Environment (the file got stale between runs), or to Tools (a schema mismatch on a read).
MHTE only pays off if you check each lens before blaming the layer that looks guilty on the surface.
The user sees a status line. What actually happened.
A Turn, Traced End to End
Here is what a single turn actually looks like through the anatomy. The user types: continue reconciling yesterday's invoices. Start from where we left off.
Boot. The Harness reads AGENTS.md from the filesystem (Environment). The Memory Policy cluster injects the last-session progress section. The Identity cluster prepends the The Memory Policy cluster pulls the last five turns, runs a retrieval query for invoice reconciliation, and reads the state checkpoint: processed 1–847; remaining 848–2347.eads the state checkpoint: processed 1–847, remaining 848–2347.
Before-model interception. A hook fires. A PII redaction middleware scans the assembled prompt, confirming it's clean. A budget check confirms the call is within per-user cost caps.
Inference. The Model (stateless) sees prompt text. It does not know one section came from a file. It emits a tool call: reconcile_invoices(start=848, batch_size=50).
After-model interception. A second hook fires. The tool call is validated against the permitted tool schema. Passed.
Tool phase. The Tool dispatcher looks up reconcile_invoices, confirms the permission scope, and calls the function. It operates on records in the database (Environment). The result comes back: {processed: 50, failed: 0, next_start: 898}.
State write. The Memory Policy cluster writes a new checkpoint: processed 1–897, remaining 898–2347, to Environment. Next session reads it on boot.
Observability capture. The fifth cluster writes a trace: turn took 4.2 seconds, 12,400 tokens, one tool call, no retries. An eval runs: did the agent make progress? Yes. No regression flagged.
The user sees: processed invoices 848–897. Ready to continue with batch 898–947. One turn. Four layers. Five clusters active inside the Harness. Eight distinct phase transitions. The user sees a status line.
Now imagine the state write silently failed. Next session, the Memory Policy cluster reads a stale checkpoint, context assembly injects yesterday's state, and inference emits a tool call that reprocesses records 848–897. The model isn't wrong.
The tool isn't wrong. The Environment isn't wrong. The Memory Policy cluster had a bug; the failure looks like the agent forgot what it did yesterday. The autopsy says Model; the actual cause is Cluster 2. That is what the anatomy gets you: a way to find the moving part.
Enterprise Lens, Which Team Owns Which Layer
The MHTE layers map naturally onto enterprise functions that already exist. Startups manage all four layers with two engineers. Enterprises have a named owner for three of them and a hole where the fourth should be.
Model maps to Applied AI or vendor management. The team that negotiates the model contract and owns the benchmark relationship already exists. Tools maps to platform engineering. APIs, schemas, permission scopes.
This team already exists. Environment maps to security, infrastructure, and compliance. IAM, VPC, audit logs, sandboxes, secrets. Morgan Stanley's AI @ Morgan Stanley Assistant shipped on top of a document store and IAM that already existed; the Environment work had been done a decade earlier for other reasons.
Harness is the one without a named owner at most enterprises. ML owns the model. Platform owns the tools. Security owns the environment. The harness, the manager that decides when and how, falls in the gap between all three. Klarna's public arc shows the pattern: a 2024 win framed as model success, followed by a 2025 reversal admitting lower-quality service.
Tone drift, edge-case failure, and de-escalation gaps only surfaced at production scale. Nobody tuned them because nobody owned them.
The rebuild is organizational, not technical. One named PM whose sole job is the harness layer. The three other layers already have owners. The fourth needs one. Everything else in this series is what that person spends their quarter doing.
Next Actions for Your Team
Four moves. Each one fits in a sprint.
First, draw your four-layer map. Draw the four peer columns. Model, Harness, Tools, Environment. For each, write the team or vendor that owns it in your org today. The column with a vague answer is the column without an owner. That is the gap. Start there.
Second, open your harness into its five clusters. Draw Identity, Memory Policy, Orchestration, Interception, Observability and Evals. For each, name one file, one service, or one vendor that implements it today.
The cluster with no entry is the cluster your harness is missing. Most teams are strong on Identity and Orchestration and weak on Memory Policy and Evals.
Third, walk one artifact through the four lenses. Pick a real file your agent uses. Trace it through Boot, Context Assembly, Inference, and Tool Phase. If the same file has the same layer in every phase, you have a boundary violation worth a conversation with engineering.
Fourth, audit the fifth cluster. Can you export a trace of your agent's last hundred runs? Can you name the evals that run against those traces? Can you name the last five failures your eval suite caught before a user did?
If you can answer all three, your fifth cluster is alive. If not, that is your Q3.
You will not rewrite the harness this quarter. But you will stop treating the system around the model as someone else's problem. The map is the unlock.
One last recap before you turn the page. You arrived at this episode with a 2 AM story and four labels on a diagram. You are leaving with an anatomy, four layers with clean edges, five parts inside the harness, and a name for what your team owns versus what your vendor rents you. Every remaining episode of this series sits inside one part of this anatomy and does specific work on it. Episode 3 is the first payoff: three small changes, each pinned to a specific part of the map you just built, that move reliability more than a model upgrade will. When you close that episode, you will have concrete moves for your next sprint, not just language.
Key Takeaways
- Give every piece one clear home. A prompt, a tool, a memory rule, a safety check. Each belongs to exactly one layer of the system. When lines blur, every future bug gets blamed on the wrong thing and fixed in the wrong place.
- The harness comprises many small jobs, not one big one. Who the agent is, what it remembers, how it plans, what it's allowed to do, and how you watch it, these are separate jobs with separate failure modes. Treat them as one blob, and you'll debug it as one blob, always in the wrong spot.
- "Memory" means three different things. What the agent remembers within one task, about you across tasks, and what it can look up from your documents are three separate problems. Mix them up, and answers quietly worsen over time.
- Rules the model can talk itself out of are not rules. Writing "never do X" in the prompt is a suggestion, not a hard guardrail. Real guardrails live in the code around the model and the permissions on its tools. Places the model literally cannot reach.
- Watching without judging is just surveillance. Logs by themselves show what happened; evals by themselves are untraceable opinions. Only when the two are wired together does the agent improve week after week.
- Know what you actually bought. A tool that runs your agent isn't the same as one that governs it. Many teams buy the first and assume they got the second, the gap between them is where the next incident lives.
- Every good agent you've used is already a harness. Coding copilots, research agents, "autonomous" workers. None of them are just a model. The question isn't whether to build one; it's whether you build it on purpose or by accident.
Sources
Vivek Trivedy, LangChain. The Anatomy of an Agent Harness (March 2026). Ralph Loop, revealing tools as needed, filesystem as foundational primitive
Vivek Trivedy, LangChain: "The Harness is a Context Manager on Behalf of the Model" (May 2026)
Sydney Runkle, LangChain. How Middleware Lets You Customize Your Agent Harness (March 2026). Six hook primitives
Sydney Runkle, LangChain. Rubric support shipped in deepagents (June 2026)
Vivek Trivedy, LangChain. Better Harness: Hill-Climbing with Evals (April 2026)
Runkle & Trivedy, LangChain. The Runtime Behind Production Deep Agents (April 2026). Harness vs. runtime
"Agent Harness Engineering: A Survey" (170+ project review) (May 2026)
Datadog, State of AI Engineering 2026: 69% of input tokens are system prompts
MSTI injection study, arXiv 2606.06387 (June 2026): 93% attack success via description-only injection
Anthropic. Scaling Managed Agents: Decoupling the Brain from the Hands (April 2026)
Anthropic. Effective Harnesses for Long-Running Agents (November 2025)
AWS. Claude Fable 5 on Amazon Bedrock (June 2026)
OpenAI. Unrolling the Codex Agent Loop (2026)
HuggingFace. Agent Glossary (May 2026)
How this episode connects to the rest of the stack
Each link points to the same problem, told from a different seat.
- Agentic · T11. What Is a Harness?Same system, written from the architecture seat.
- Agentic · T12. Context AssemblyThe pipeline behind every inference call.
- Agentic · T07. Memory ArchitectureWhy "memory" is plural, not singular.
- Agentic · T16. Context ObservabilityThe observation plane in practical detail.