Skip to main content
CONTACT SALESSTART BUILDING
BACK TO BLOG

What Is an Agent Harness? Claude Code, Codex, Pi and T3 Code Explained

AI Agents
Matt Abrams & Alice Moore· April 6, 2026
16 min read
What Is an Agent Harness? Claude Code, Codex, Pi and T3 Code Explained

Originally published April 6, 2026 by Matt Abrams. Updated December 2026 by Alice Moore.

On November 30, Theo Browne gave up. After most of a year insisting that T3 Code, the open-source app he built for running coding agents, wasn't an agent harness, he told his users they could call it one.

It sounds like hair-splitting, except that the code around a model has turned out to matter a lot. In February, LangChain kept its model the same and changed only that code, and its coding agent climbed from outside the top 30 on the Terminal Bench leaderboard to the top 5.

Both sides of Theo's argument had a point, and working out why is the quickest way to understand what a harness is. It also answers the practical question: if you already use Claude Code or Codex, you probably don't need a different harness, just a better setup for the one you have.

What is an agent harness?

An agent harness is the code that turns a model into an agent: the loop that sends it context, runs the tools it asks for and feeds the results back. Claude Code, Codex and Pi are harnesses. Apps like T3 Code run those harnesses rather than replace them, which is why people argue over whether they count.

A raw model is a stateless text predictor. It takes text in, sends text back and forgets everything. The harness (also called an AI harness or LLM harness) is every piece of code, configuration and execution logic wrapped around it. The model supplies the intelligence. The harness supplies state, tool execution, memory, orchestration and constraints it can enforce.

For a long time most of the attention went to picking the model: which one led the benchmarks, what it cost, how fast it answered. Model choice was always the easier problem. The harder one is what wraps the model, and this year it got a name. Anthropic, LangChain and OpenAI all say "harness" now, and in February Mitchell Hashimoto and OpenAI's Codex team both started calling the work of shaping one harness engineering.

Vivek Trivedy at LangChain puts it as a formula: Agent = Model + Harness. If you're not the model, you're the harness. System prompts, tool schemas, filesystem access and the loop that keeps the conversation going all count.

That loop is the heart of a harness, and it's small. Every coding agent runs some version of these four steps:

  1. Send the model the conversation so far, with its instructions and the tools it may call.
  2. The model either answers, or asks for a tool call and stops.
  3. Run the tool and add its result to the conversation.
  4. Call the model again, and repeat until it answers without asking for a tool or something stops it.

A working version fits in a few dozen lines. What separates a good harness from a weekend project is everything around the loop: what goes into the context each turn, which tools exist, where they run, and when to stop.

Concretely, a harness includes:

  • System prompts: the standing instructions that shape behavior before any user message arrives.
  • Tools, MCP servers and skills: the schemas, descriptions and code the model uses to act, plus instructions it loads only when a task needs them.
  • Bundled infrastructure: filesystem, browser, bash, sandboxes.
  • Orchestration logic: subagents, model routing, handoffs between agents.
  • Hooks and middleware: compaction triggers, approval gates, rules the model can't talk its way past.
  • Memory and search: files like AGENTS.md that load when the agent starts, and web or docs search for what the model doesn't know.
Harness components (system prompts, tools and MCPs, filesystem and git, orchestration logic, hooks and middleware, memory and search) all feeding into the model, which drives autonomous action

Which tools are harnesses? Claude Code, Codex, Pi and T3 Code

To sort them, ask who runs the loop. If a piece of software decides what the model sees each turn and runs the tools the model calls, it's a harness. If it starts harnesses, picks between them, hands them extra tools, keeps their sessions and shows people their work, it's working a layer up.

  • Claude Code is a harness with a terminal interface on top. The Claude Agent SDK is the same harness without the terminal, for building into your own product.
  • Codex is OpenAI's harness. Its app server lets other software start and drive it.
  • Pi, from Mario Zechner, is a deliberately small open-source harness: four tools (read, write, edit and bash), a short system prompt, and everything else added through extensions. His write-up explains why.
  • T3 Code runs all three, along with Cursor, OpenCode and others. By this test it's a layer up, which is where the argument comes from.

T3 Code calls itself "the open-source control plane for coding agents." It runs coding agents on your machine, through each one's own SDK or app server and on the subscriptions you already pay for, and lets you follow and steer them from another computer or your phone.

Its creator, Theo Browne, has argued since his April video What even is an agent harness? that it isn't one. To him, the harness is what the model is interfaced through, and T3 Code brings none of its own. "We require you to bring your own harness," he wrote in October. Users kept pointing at the harness-like things T3 Code adds: threads that hand work to other agents, tools of its own for those agents, worktrees and approval modes. Theo's answer was that there's a difference between "the thing the llm connects through" and "things you add to it." Then, on November 30, he gave up.

Both sides were describing real layers. LangChain's broad definition, where everything that isn't the model is harness, counts T3 Code. Theo's narrower one, where the harness is the loop and what it runs, doesn't. The split matters when you're choosing tools, because the two layers answer different questions. The harness decides how well one agent works. The layer above decides where agents run, what they can touch, who sees their work and who can stop them. Builder, which publishes this blog, makes two tools for that layer, Builder Code and Agent-Native's harness agents. They come up near the end.

Framework vs. runtime vs. harness: what's the difference?

A framework (like LangChain) provides abstractions for building agents. A runtime (like LangGraph) manages execution state and durable task flows. A harness is the opinionated, batteries-included layer that combines both with configuration, constraints and infrastructure for one kind of work. The Node.js analogy still maps cleanly: Node is the runtime, Express is the framework, Next.js is the harness.

Harrison Chase, LangChain's CEO, laid out this taxonomy when describing DeepAgents, the harness LangChain built on its own framework. Not every harness has a framework underneath: Claude Code, Codex and Pi run their own loop. Since Chase wrote that, a fourth layer has filled in above the harness:

LayerWhat it providesOpinion levelExamples

Runtime

Execution state, durable task flows, retries and resuming after a crash

None

LangGraph, Temporal, Durable Objects

Framework

Agent abstractions, tool interfaces, memory patterns

Low

LangChain, CrewAI, OpenAI Agents SDK

Harness

The agent loop, tools, context management, sandboxing

High

Claude Code, Codex, Pi, Claude Agent SDK, Cursor, DeepAgents

Layer above (control plane)

Starts and switches harnesses, keeps sessions, adds tools, shows people the work, controls who can do what

High, about people and process

T3 Code, Builder Code, Agent-Native's harness agents

If you use Claude Code or Codex daily, you're working inside someone else's harness design. The models underneath might be Claude, GPT or Gemini, but the harness decides what the agent can do, what it knows about your project and how it behaves over a multi-hour task.

What does an agent harness actually do?

A harness gives a raw model six things it lacks: durable storage, code execution, a safe place to run that code, memory, context management, and orchestration with hooks. Claude Code and Codex now ship most of what follows by default. If you're building your own, this is the list to cover.

The six foundational capabilities of an agent harness, arranged around a central hub of reliable autonomous action

Filesystem and git for durable storage

A model can only work with what's in its context window. A filesystem gives the agent a workspace to read code and docs from and write work to, so it doesn't have to hold everything in context, and that work survives the session.

Git turns the filesystem into a coordination surface. When one agent hands off to another, it does it through files and commits, not a shared context window. See how Claude Agent Teams work for an example.

Bash and code execution

Prebuilt tools cover what the harness designer anticipated. Bash covers everything else: when the agent hits a missing capability, it writes a script, runs it and carries on. That's what agentic workflows look like at the harness level. The harness decides whether the script runs locally, in a container or in a cloud sandbox.

Sandboxes for safe execution

Code an agent writes and runs on your laptop is a security risk, and one laptop doesn't scale to many agents at once. Sandboxes fix both: isolated environments with allow-listed commands, preinstalled tools, a browser to check output and test runners. The harness sets the sandbox's defaults. The model doesn't get to configure its own.

Memory and search for continuity

Files like AGENTS.md and CLAUDE.md load into context when the agent starts, and when the agent updates them, the next session gets the new version. That's memory that outlasts any one context window. Web search and MCP servers cover what the model's training missed: the model asks, and the harness fetches.

Context management to fight context rot

Context rot is how a model's performance degrades as its context window fills. Compaction is the harness's answer: it summarizes older context before the window runs out, instead of erroring or silently dropping messages. The harness can also trim or summarize large tool outputs before the model sees them, and load skills only when the current task needs them.

Orchestration and hooks

Here the harness enforces behavior instead of hoping for it: stop conditions tied to what the agent has actually done, loop detection, confirmation gates before risky tools, reminders attached to particular tools or messages, subagents for side tasks, and hooks that run your own code at each step. Frameworks leave all of this to you. In a harness, it's already decided.

What is harness engineering, and does the harness still matter?

Harness engineering is the work of shaping everything around the model so the agent does the job reliably: its tools, instructions, environment, checks and limits. Mitchell Hashimoto described it in February, in My AI Adoption Journey: "anytime you find an agent makes a mistake, you take the time to engineer a solution such that the agent never makes that mistake again." Six days later OpenAI's Codex team published Harness engineering, about a small team that built a product of around a million lines with none of it written by hand. Their job, they wrote, became to "design environments, specify intent, and build feedback loops that allow Codex agents to do reliable work."

The case that it matters a lot. In February, LangChain kept its model fixed at gpt-5.2-codex and changed only the harness around its coding agent. Its Terminal Bench 2.0 score went from 52.8 to 66.5. The changes were ordinary harness work: a build-and-verify loop with a checklist before the agent can finish, a map of the working directory at startup, loop detection that tells the agent to rethink after too many edits to one file, and more reasoning at the start and end of a task than in the middle. A May position paper, Stop Comparing LLM Agents Without Disclosing the Harness, collects more cases: Claude Opus 4.5 scores 45.9% on SWE-bench Pro in a standard test harness and 55.4% in Claude Code. In the authors' own runs, swapping the harness moved scores by 8.5 to 13 points, while swapping the model moved them by 2.5 to 5.

The case that it matters less every month. In his October video, "My last video about ai harnesses," Theo argues that the leading harnesses now score within about 3 to 5 percentage points of each other, and that the gap is shrinking as labs train their models on their own harnesses.

Both can be true. The big jumps come from going from a basic harness to a tuned one. Among the tuned ones, the gap is small and closing. So for most teams, writing your own loop isn't where the gains are. They come from the environment around a good harness: the tests it can run, the instructions it reads, the tools it gets and the rules about what it can touch. That's harness engineering in Hashimoto's and OpenAI's sense, and you can do it on top of Claude Code or Codex as easily as on a harness you wrote.

How to choose or build an agent harness

Start with which layer you're building. Most teams shouldn't write the loop: Claude Code, Codex and Pi are good harnesses, and the Claude Agent SDK, Codex's app server and Pi's SDK let you build on them. The work that's yours is usually the environment the harness runs in, or the layer above it.

A quick pick list:

  • Working alone in a terminal: Claude Code or Codex.
  • An engineering team already using Claude Code or Codex: keep it, and put the effort into harness engineering: tests the agent can run, instructions in AGENTS.md, and rules about what it can touch.
  • Many agents side by side, from your desk or your phone: T3 Code, running whichever of those you already pay for.
  • An agent inside your own product: build on the Claude Agent SDK, Codex or Pi, or run one of them inside your app as it is (see "Run an existing harness inside your app" below).
  • A team where designers, PMs and marketers work on the same code as engineers, with access managed centrally: Builder Code.

If you do build or configure a harness, there are six decisions to make:

1. Execution environment. Local is fast and cheap. Containers isolate without cloud overhead. Cloud sandboxes scale to many agents, each isolated. The choice sets your security posture and how far you can scale.

2. Tool surface. Start with a small, well-tested set of tools, then add bash for the long tail. Every tool you add is one you maintain.

3. State and memory. Make the filesystem the source of truth: AGENTS.md for memory, git for history and rollback. Agents that need to coordinate do it through files.

4. Long tasks. A multi-hour task will outlast its context window. In the Ralph Loop, Geoffrey Huntley's pattern, the agent writes a planning file, does one task, fixes what broke and updates the file before the context resets. Anthropic's harness for long-running agents works the same way at a larger scale: a first session sets up the environment and a list of features, and every later session takes one feature, commits it and leaves notes for the next.

The Ralph Loop: a cyclic flow of write planning file, execute task, and update planning file across context resets

5. Verification. Agents that run their own tests, read logs and check the browser catch more of their own mistakes before a person has to. The harness decides when to stop for human review.

6. Team access. A harness built for one developer is a solo tool. A team has to decide who can start agents, who can see their work and who can step in, and that decision lives in the layer above.

Run an existing harness inside your app

You don't have to build a harness to ship one. Agent-Native, Builder's open-source framework for apps where agents and people share the same actions and data, can run Claude Code, Codex or Pi as the agent inside your app. Agent-Native doesn't add a loop of its own. The harness it runs is, in its docs' words, "a full agent runtime" that "owns its own loop, workspace, native file tools, session state, compaction, approval model, and sandbox behavior." Agent-Native works in the layer above it.

The harness keeps its own loop and file tools, and your app hands it a small set of its own actions, chosen on purpose. Agent-Native saves the harness's session in your database, so a long task survives a restart or a deploy and picks up where it left off. It streams the work into your app's chat as it happens: text, tool calls, file changes, and approval requests that wait for a person to answer. Your users get a real interface instead of a terminal. That's the difference from calling the Claude Agent SDK yourself: saved sessions, the chat interface, approvals and the choice of which app actions an agent may use come built in, instead of being yours to build.

Two limits to know: the built-in Codex adapter has no approval step (it only runs in allow-all mode), and Pi runs without a sandbox. The docs cover registering a harness, choosing the actions it gets and setting its permissions. How harness agents work →

Where Builder Code fits

Builder Code works in the layer above, for teams. You start from a prompt, a Figma design or a branch pushed from Claude Code, Cursor or Codex. Then designers refine the UI, marketers edit copy and PMs leave feedback, all on the same code your engineers ship. SSO, roles, permissions and approvals control who can create, edit and ship changes, so one or two engineers can manage a whole team's AI coding, and approved changes go out as pull requests through your usual pipeline. See Builder Code →

FAQ: agent harnesses

Is an agent harness the same as an agent framework?

No. A framework gives you building blocks: tool interfaces, memory patterns and chain primitives. A harness is the opinionated layer that puts them together into an agent that runs. LangChain is a framework, and DeepAgents is the harness LangChain built on it.

Is Claude Code a harness?

Yes. Claude Code is a harness (its loop, tools, compaction and permissions) with a terminal interface on top. The Claude Agent SDK gives you the same harness without the terminal. Codex and Pi are harnesses too.

Is T3 Code a harness?

It depends which layer you mean. T3 Code doesn't run its own agent loop. It runs harnesses like Claude Code, Codex and Pi, and adds threads, worktrees, extra tools and a way to steer them from anywhere, which it calls a control plane. By LangChain's broad definition that's a harness; by Theo Browne's narrow one, it runs harnesses. Theo stopped arguing the point on November 30.

What is harness engineering?

Shaping everything around the model so the agent works reliably: tools, instructions, environment, checks and limits. Mitchell Hashimoto described it in February as fixing each mistake an agent makes so it never makes it again, and OpenAI's Codex team used the name for building a product with no hand-written code.

What's the difference between a harness and an orchestrator?

A harness runs one agent's loop. An orchestrator coordinates several agents, each running in its own harness: it starts them, splits up the work and collects the results. Harnesses can orchestrate too, when they start subagents. T3 Code and Builder Code orchestrate from the layer above.

Do I need an agent harness for a simple chatbot?

If your chatbot keeps conversation history, the loop that does it is already a small harness. Once you add tools, memory or multi-step work, design it on purpose, or start from one that exists.

Which agentic AI frameworks work with a harness?

LangChain, LangGraph, CrewAI and the OpenAI Agents SDK work at the framework or runtime layer, and harnesses like DeepAgents are built on them. Claude Code, Codex and Pi run their own loops.

The short version

The model supplies the intelligence. The harness makes it reliable over a long task, and the layer above decides who gets to use it, where it runs and what it can touch. When you can't tell which one a tool is, ask who runs the loop.

Design interactive prototypes for free
Explore ideas with AI, then fine-tune layouts, styles, and interactions with a Figma-like editor. 100% open source.

Continue reading