Series 2 of 4 · Harness Engineering · Episode 2 of 8 · The Machine

Inside a Production Agent Harness. And the Runtime Underneath It

Four layers, five clusters inside the harness, one runtime that holds it all together.

In This Episode You Will Learn
  • 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 box

A 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.


MHTE — four peer panels and one runtime foundation Four equal-width slabs stand side by side — Model, Harness, Tools, Environment — each labelled with a Roman numeral, a serif name, and a single line of what it owns. Below them, a wider foundation slab marked Runtime spans all four. The composition reads as an architectural elevation: peer layers on a shared runtime. FOUR PARTS · ONE MACHINE I Model The brain.It thinks in words. — Reads words. — Writes words. — Forgets everything after. ITS JOB: THINKING II Harness The manager.It decides. — Chooses when to act. — Chooses how to act. — Never does the work itself. ITS JOB: DECIDING III Tools The hands.They act on the world. — Search the web. — Read and write files. — Call your systems. ITS JOB: DOING IV Environment The box.It stays put. — Files on disk. — Programs and network. — This defines what survives a restart. ITS JOB: HOLDING RUNTIME The floor under all four. Keeps them running when things go wrong — restarts, saves progress, catches mistakes. Every piece of your agent belongs to one layer. When two parts blur, bugs are blamed on the wrong thing.
Figure 2.1 · The MHTE bifurcation Four peer panels, one runtime foundation. Model, Harness, Tools, Environment are peers. Only Harness carries the primary accent. It is the layer this series is about. Runtime is the foundation that keeps the other four alive in production.

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.

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 2026

LangChain’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.

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

Figure 2.2 · The Stateless Brain

A brain with no memory, no hands, and no clock.

Inside the Model — the stateless apparatus A three-panel scientific apparatus on cream plate. Left: TOKENS IN, a queue of small circles. Center: THE MODEL specimen, three internal compartments — Parameters, Tokenizer, Attention — above a HAS / LACKS ledger. Right: LOGITS OUT, a small probability histogram. A rose thesis strip runs beneath. Inside the Model FIGURE 2.2 · A BRAIN WITH NO MEMORY I. WORDS IN Your words, chopped into pieces and turned to numbers. t₁t₂t₃ t₄t₅t₆ WHAT IT SEES One turn only. Nothing from before. Whatever fits, fits. II. THE MODEL · A THINKER WITHOUT MEMORY WEIGHTS Set at training. Never change while running. SPLITTER Turns text into numbers and back. ATTENTION Decides which words matter to which others. HAS Can think. Can spot patterns. Knows what it read. LACKS No memory. No hands. No clock. It only knows what it was trained on. Nothing more. III. WORDS OUT A ranked list of every possible next word. Pick one. Say it. Forget it. THE POINT Unplug everything else, and the model still talks — beautifully, from its training. It just can't remember, act, or learn from right now. That's not a bug. That's the shape of it. Words in, guess out. Everything else is the harness. HARNESS ENGINEERING · EP. 2 · R. PALANKI
Inside the Model. Tokens in, a probability distribution out, and nothing kept between.

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

Figure 2.3 · The Anatomy

The harness has five organs. Each does a job the model cannot.

Inside the Harness — Anatomical Cutaway A medical-illustration cutaway of the harness as a body. Five organs are labeled: Identity as the skin and perimeter, Memory Policy as the spine, Orchestration as the heart, Interception as a chain of six valves, and Observability as the nervous system. Skills sit outside the body as a loaded specimen bundle threaded into three organs. What's inside a harness FIGURE 2.3 · FIVE PARTS OF THE HARNESS iiiiii ivvvi Skills pack loaded from files I. IDENTITY · the skin Who the agent is, and what it will refuse to do. System prompt · voice and tone · rules and refusals II. MEMORY · the spine What the agent sees each turn. What it keeps. What it lets go. Context window · summarizing · what to load at start III. ORCHESTRATION · the heart The loop that keeps the agent going, call after call. Main loop · picking a model · resuming after a stop IV. GUARDRAILS · six gates The checkpoints. Every request gets inspected before it moves on. before_agent · before_model · wrap_model_call · wrap_tool_call · after_model · after_agent V. OBSERVABILITY · the nervous system How the harness notices it was wrong before you do. Traces · scores · feedback loop · replay a bad turn Swap the harness — and the same model behaves differently. That is the whole idea. HARNESS ENGINEERING · EP. 2 · R. PALANKI

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 2026

Read 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.

Case: context anxiety, one model cycle later

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.

  • What context should it always have?How do we know what it did? This requires hooks that log model calls, tool calls, outputs, errors, and decisions.lls, outputs, errors, decisions.
  • Where should a human step in?Hooks vs guardrails. Hooks are the general-purpose lifecycle callback, observe, log, enrich context, rewrite requests, route tools, cache, pause. Guardrails are the specialized subset that enforces a policy decision: block, rewrite, approve. Every guardrail is implemented as a hook, butA logging hook records, a context hook enriches, and a guardrail hook says no or waits for a human.ecords. A context hook enriches. A guardrail hook says no, or wait for a human.

    LangChain’s middleware post names six hook primitives that define this cluster’s vocabulary: (list not provided in prompt)

    HookWhen it fires
    before_agentOnce on invocation
    before_modelBefore each model call
    wrap_model_callWraps the model call end-to-end
    wrap_tool_callWraps tool execution
    after_modelAfter model response, before tool execution
    after_agentOnce 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).

    Where hooks fire, the seven-step loop, annotated

    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.

    1. Load objective, policy, memory, workspace  →  before_agent, input guardrail (block unsafe requests, classify task, load tenant policy)
    2. Route to a model  →  harness-internal; no user-facing hook
    3. Call the model  →  before_model (trim history, retrieve context, mask PII, attach tools), wrap_model_call (retry, cache, switch model, enforce budget)
    4. Gate the tool request  →  after_model (inspect the plan), then before_tool_call / tool guardrail (validate args, check permissions, require approval for refunds, cancellations, writes)
    5. 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.
    6. Record the event  →  after_tool_call (validate schema, run tests, log, auto-format, or ask the model to self-correct)
    7. Decide continue / retry / branch / escalate / stop  →  output guardrail before the answer leaves the system, after_agent once 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.

    Model reasons vs. hook enforces, a working PM's decision matrix

    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 facesLet the model reasonAdd a deterministic hook
    How to explain a conceptYes, style and reasoning stay flexible.Only if output must follow a template. Then an output guardrail.
    Delete customer dataNo. Downside is high and irreversible.before_tool_call with permission check plus human approval.
    Draft a support emailYes, when low-risk.Output guardrail for tone, PII, policy compliance.
    Format a JSON responseNo need to trust the model here.after_tool_call schema validation and auto-repair.
    Choose which documents to readPartly.Retrieval / context hook curates the permitted set.
    Send money, cancel, message externallyUsually no.Human-in-the-loop before the side-effecting tool fires.
    Fix a failed testYes, 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).

    The May 20Teams that turned production traces into regression tests and automated harness fixes saw the largest reliability gains. gains of any intervention measured. Larger than model upgrades.

    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 Engineering

    The 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

    Figure 2.4 · The Tool Chest

    The verbs the agent can actually do in the world.

    Inside the Tools — the apothecary cabinet A hairline apothecary cabinet on cream plate. Eight labelled drawers in a four-by-two grid — bash, fs-ops, web search, MCP servers, skill wrappers, custom APIs, schema registry, tool schemas. A rose dispatch bar from the Harness runs above the cabinet; a rose thesis strip runs below. Inside the Tools FIGURE 2.4 · THE TOOLBOX · EIGHT DRAWERS HARNESS CALLS → the harness decides which drawer to open, and when. The tools live here — not in the harness. I. >_ bash the shell Anything a developer could type on a computer, the agent can run. II. fs-ops read & write files How the agent saves work, shares it, and remembers what it did. III. web search fresh facts Look things up online. The easiest way to learn what happened yesterday. IV. MCP servers one plug for many tools A common plug. Connect any tool your team already uses. V. skills a saved recipe A named set of steps. Run it again without rebuilding it. VI. your APIs behind your login Your own systems. Anything the agent is allowed to call. VII. the menu list of every tool The catalog. Show tools when needed, not all at once. VIII. { } tool contracts the shape of each tool What each tool takes in and what it gives back. Spelled out clearly. THE POINT Without tools, the model can only talk about doing work. Tools are how talk becomes action. HARNESS ENGINEERING · EP. 2 · R. PALANKI
    Inside the Tools. Eight drawers of callable capability, the harness decides which opens.

    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

    Figure 2.5 · The Environment Substrate

    The ground the tools stand on, and the state that outlives the session.

    SWIPE TO EXPLORE →
    Inside the Environment — the ground beneath the tools An architectural elevation. A narrow rose band at the top marks the Tools layer calling down. Beneath it, five stone-cut strata are stacked from top to bottom: memory files, browser and network, operating system and shell, sandbox, filesystem and git. Each stratum carries a Roman numeral, a plain-English name, a one-line role, and three short body lines. A closing italic states what survives a restart. FIVE STRATA · ONE GROUND TOOLS · CALLING DOWN Tools reach through this stack. They do not own it. V Memory files Notes the agent leaves for its next self. AGENTS.md, scratchpads, notes. — Read on resume. — Survives the session. HOLDS WHAT THE WINDOW CANNOT IV Browser & network How far the agent can reach. — The open web and DNS. — Allow-lists and rate caps. — A headless browser. SETS THE REACH III Operating system & shell What the bash tool actually runs against. — Paths and environment variables. — Package managers and versions. — Live processes. WHERE COMMANDS LAND II Sandbox The walls a wrong move cannot cross. — A container around the work. — Limits on files and calls. — A private network. SETS THE BLAST RADIUS I Filesystem & git The floor. Everything else stands on this. — Files, folders, and diffs. — Branches and commits. — How work survives a restart. FOUNDATION · DURABLE What survives a restart lives here. What does not, does not.
    Five strata of ground the tools stand on, read bottom to top.

    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.

    Figure 2.6 · Phase-Relative Perception

    One file. Four layers. Four different things they see.

    SWIPE TO EXPLORE →
    One file, four lenses — the same AGENTS.md seen four different ways A single ink slab in the centre names one file on disk: AGENTS.md. Four lens panels sit around it — two above (Boot, Context Assembly, both owned by the Harness), two below (Inference by the Model, Tool phase by the Tools) — connected by hairline leaders. Each lens states what its layer sees when it looks at the same file. A closing italic states the rule. ONE FILE · FOUR LENSES AGENTS.md one file on disk I · BOOT OWNED BY HARNESS The Harness reads the file. — The file lives in the world. — The Harness picks it up. II · CONTEXT ASSEMBLY OWNED BY HARNESS Parts of it become prompt. — The Harness chooses which parts. — And in what order. III · INFERENCE OWNED BY MODEL The Model sees only words. — It doesn't know a file exists. — It looks the same as user text. IV · TOOL PHASE OWNED BY TOOLS A tool treats it as a target. fs-read opens it again. — It has no idea the Harness already used it. Same file. Four phases. Four different views. Blame the phase, not the file.
    One file seen through four lenses, each layer sees something different.

    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.

    Figure 2.7 · The Agent Lifecycle

    The user sees a status line. What actually happened.

    SWIPE TO EXPLORE →
    One turn, in time — five stations along a single timeline A hairline horizontal timeline. Five station cards sit on it in order — Boot, Context Assembly, Inference, Tool phase, Observability — each with a Roman numeral, plain-English name, italic subtitle, and one line of what it does. The three Harness-owned stations carry a rose accent bar; Inference and Tool phase carry an ink bar. Between context-assembly and inference, and between inference and tool phase, two diamond markers name the interception hooks: before_model and after_model. A closing italic states the rule. FIVE STATIONS · ONE TURN t=0 t=END I Boot The wake-up. Reads the memory file. Loads identity. HARNESS II Context assembly Stitching the prompt. Picks what to show the Model. In order. HARNESS HOOK before_model last check before it thinks III Inference The Model thinks. Reads words. Writes words. Asks for a tool. MODEL HOOK after_model check its answer before acting IV Tool phase The hands move. A tool runs. It acts on the real world. TOOLS V Observability The receipt. Writes the trace. Saves the state. HARNESS WHO IS ACTIVE Harness — decides. Model — thinks. Tools — do the work. Hook — a checkpoint the Harness fires. The user sees one status line. Under it, five phases and two checkpoints run in order.
    One turn along a single timeline, five stations, two interception hooks.

    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 // Episode Recap

    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.
    Cross-Series // Read Next

    How this episode connects to the rest of the stack

    Each link points to the same problem, told from a different seat.