harness engineering

Harness Engineering in AI: What It Is and Why It Matters More Than Prompts

Two teams use the same AI model. Same API, same price per token. One team ships a coding agent that clears two-thirds of a hard benchmark. The other team can’t get past half.

The difference isn’t the model. It’s the harness.

In February 2026, LangChain pushed its coding agent from 52.8% to 66.5% on Terminal Bench 2.0, moving from outside the top 30 into the top 5. It changed nothing about the model (gpt-5.2-codex). It only changed what surrounded it. That is harness engineering: the work of designing the tools, rules, memory, checks and feedback loops around an AI model so it can finish multi-step work without falling apart.

If you’ve spent the last two years getting better at prompts, this matters to you. Prompts still count. But once an AI agent has to take real actions, like editing files, pulling reports or pausing ad sets, the prompt becomes one small piece of a much bigger system. Below you’ll get a plain definition, a clear comparison with prompt engineering, seven components of a harness, worked examples, and a checklist for building your first one.

Table of Contents

What is Harness Engineering?

Harness engineering is the practice of designing the tools, context, constraints, feedback loops and runtime around an AI model so it can carry out multi-step work reliably. The harness is everything in an AI agent except the model itself.

A simple way to hold this in your head is one line:

Agent = Model + Harness

The model is the part that reads text and predicts what to do next. On its own, it can’t open a file, remember what happened yesterday, check its own work or know your company’s rules. The harness is what gives it hands, memory, boundaries and a way to find out when it got something wrong.

Databricks describes an AI agent harness in the same terms. It’s the layer that supplies the tools, memory, execution environments and guardrails an agent needs to complete real tasks, while the model supplies the reasoning (Databricks, 2026).

Where Did the Term “Harness Engineering” Come From?

The phrase took shape in early 2026, and two sources landed on it within days of each other.

Mitchell Hashimoto, co-founder of HashiCorp, used it on his blog in February 2026 to describe a working habit. When an agent makes a mistake, don’t just retry. Change the environment so that exact mistake can’t happen again.

A few days later, on February 11, OpenAI published “Harness engineering: leveraging Codex in an agent-first world,” written by Ryan Lopopolo. The team described building an internal product with no manually typed code. Martin Fowler’s commentary notes the product reached over a million lines of code in five months. OpenAI’s own conclusion was blunt: the engineering team’s main job became making it possible for agents to do useful work.

Fowler’s reaction was interesting. He said he liked “harness” as a word, which, for a writer who has watched a lot of AI buzzwords come and go, is a real endorsement. He also joked that it’s only a matter of time before someone calls a single-prompt code reviewer a harness. Keep that in mind. A prompt is not a harness.

Why is It Called a “Harness”?

Because a harness doesn’t make the horse stronger. It lets the strength be pointed somewhere useful and held in check.

That’s the job here. A modern AI model is already capable. What it lacks is direction, limits and a feedback signal. The metaphor also echoes the older software idea of a “test harness,” the scaffolding that runs code under controlled conditions. Either reading works.

Harness engineering is the practice of designing the tools, context, constraints and feedback loops around an AI model so an agent can do multi-step work reliably. The idea is captured in the formula Agent = Model + Harness. The term gained traction in February 2026 through writing by Mitchell Hashimoto and OpenAI’s Codex team.

Why Does the Same AI Model Perform Better or Worse?

Because the model is only one of the things that decides the outcome. The scaffolding around it, meaning what it sees, which tools it gets, how its work is checked and how it recovers from errors, can swing results by double digits.

LangChain’s experiment is the cleanest proof available. According to a February 2026 post by Vivek Trivedy, the team improved its coding agent, deepagents-cli, by 13.7 points on Terminal Bench 2.0. That’s a benchmark of 89 tasks spanning machine learning, debugging and biology. The model stayed fixed. Only the harness moved.

What did they actually change? Mostly unglamorous things:

  • Self-verification. The agent was pushed to test its own work before declaring it done, instead of stopping after the first plausible answer.
  • Loop detection. Agents sometimes get stuck repeating the same failing edit. The team added middleware to catch these “doom loops” and nudge the agent to rethink.
  • Upfront context. A local-context step mapped the working directory and available tools and injected that into the agent’s starting context, so it didn’t waste turns exploring.
  • Time budgeting. Models are poor at estimating how long things take, so the harness warned the agent as deadlines approached.
  • Traces. LangChain recorded every run and analysed failures at scale, then made targeted changes to the harness based on what the traces showed.

None of that is a clever prompt. All of it is engineering.

Here’s a second, quieter data point. Gabriel Chua, a developer experience engineer at OpenAI, said the Codex model family is trained with the harness present. Simon Willison flagged this as the first acknowledgment he’d seen from an OpenAI insider. The implication is that models and harnesses increasingly evolve together. You can’t always swap one out and expect the same behaviour.

Now the honest caveats. LangChain’s write-up is also marketing for its own tooling, and a coding benchmark is a long way from your content calendar. The direction of the finding is solid and widely repeated. The exact numbers won’t transfer to every workflow.

In February 2026, LangChain improved its coding agent from 52.8% to 66.5% on Terminal Bench 2.0 by changing only the harness, with the model held constant. The gains came from self-verification, loop detection, upfront context and tracing. The result shows that in agentic work, what surrounds the model can matter as much as the model.

A Plain-English Analogy: The Horse and the Harness

Picture a powerful horse in an open field. You can shout instructions at it all day. “Go to the barn. Slowly. Don’t step on the flowers.” Some of it will land. A lot won’t.

That shouting is prompt engineering.

Now give the horse a saddle and reins, so you can steer. Add a fenced path, so it can’t wander onto the road. Add a gate that only opens when you’ve checked the load. Keep a log of every time it spooked, and fix the spot on the path where it happened. That’s the harness.

Same horse. Very different ride.

Here’s a second version for the less equestrian. Think of an AI model as a brilliant new hire on day one. You can give them a great briefing (the prompt). But if they have no access to your tools, no handbook, no manager who reviews their work and no record of past mistakes, they’ll still make avoidable errors. The briefing helps. The system around the person decides whether they succeed.

Which brings us to the question everyone asks next.

Harness Engineering vs Prompt Engineering: What’s the Real Difference?

Prompt engineering is about the words you send to a model in a single request. Harness engineering is about the system around the model: what it can access, what it can do, what it remembers, what gets checked and what gets blocked.

Prompt engineering asks, “How should I phrase this?” Harness engineering asks, “What should this system prevent, measure and correct?”

There are really three layers worth separating, because people blur them constantly.

Also Read: Loop Engineering: What it is and Why it’s Replacing Prompt Engineering in 2026

What is Prompt Engineering?

Prompt engineering is the practice of writing and refining instructions, examples and formatting so a model gives better outputs for a given request.

It covers role assignment, style constraints, step-by-step reasoning and few-shot examples (showing the model two or three sample answers). It works because language models are highly sensitive to wording. The failure it fixes: poorly phrased instructions that produce inconsistent answers.

It’s a message-level skill. Great for chat. Limited once the task runs for twenty steps.

What is Context Engineering?

Context engineering is the practice of deciding what information the model sees at each step, including documents, memory, tool outputs and conversation history.

In June 2025, Shopify CEO Tobi Lutke said he preferred the term “context engineering” over “prompt engineering,” and Andrej Karpathy backed it publicly. The point was that the prompt is a thin slice of what the model reads. If the right customer ticket never reaches the model, no phrasing will rescue the answer.

Prompt engineering tells the model how to use information. Context engineering decides which information shows up and when. It’s a session-level skill.

What is Harness Engineering?

Harness engineering works at the system level. It includes the prompt and the context, and adds the things neither of them can do: running tools, enforcing permissions, validating outputs, retrying safely, logging what happened and learning from failures.

A summary of OpenAI’s article puts the split neatly. Context engineering asks what the agent should see. Harness engineering asks what the system should prevent, measure and correct.

Prompt vs Context vs Harness Engineering: Side-by-Side Comparison

Prompt engineeringContext engineeringHarness engineering
Core questionHow do I phrase this?What should the model see?What should the system prevent, check and fix?
ScopeOne messageOne session or stepThe whole system and its lifetime
What you controlWording, examples, formatDocuments, memory, retrieved dataTools, permissions, checks, loops, logs
Typical fixRewrite the instructionChange what gets retrievedAdd a verifier, a hook or a hard block
Failure it solvesInconsistent or vague answersMissing or noisy informationUnreliable, unsafe or repeating mistakes
Best forChat and one-off tasksKnowledge-heavy tasksAgents that act over many steps

Are These Layers Replacements or Nested Layers?

They’re nested, not sequential. Each one contains the one before it.

Good prompts still matter inside a good harness. Good context still matters inside a good harness. What changes is where the biggest failures hide. Atlan’s 2026 comparison and several practitioner write-ups describe the same progression: the focus moved from words, to information, to the whole system, as tasks moved from chatbots to agents.

A caution, because the terms are young. Not everyone draws the lines in the same place. InfoQ’s coverage of OpenAI’s work treats context engineering as part of the harness, along with architectural constraints and cleanup tasks. Other writers have started adding “loop engineering” and “graph engineering” on top. Expect the vocabulary to shift. The underlying ideas are more stable than the labels.

Nested architecture diagram comparing prompt engineering at the core, context engineering in the middle, and harness engineering as the outer system layer

A Worked Example: Weekly Ad Report

Take one task: “Pull last week’s Meta Ads results and tell me what to change.”

  • Prompt layer: You write a clear instruction. “Act as a performance marketer. Compare week over week. List three actions.”
  • Context layer: You make sure the agent gets the right account, the right date range, your target CPA and your last month’s notes. Without this, the prompt produces confident nonsense.
  • Harness layer: You make the agent read-only by default, require your approval before any budget change, check every number against the raw export, log what it did and block it from touching campaigns outside the account you named.

If the report has wrong numbers, rewriting the prompt won’t help. If the agent paused the wrong campaign, better context won’t help either. You need the harness. A useful rule: match the symptom to the layer before you fix anything.

Prompt engineering controls the words in a single request, context engineering controls what information the model sees, and harness engineering controls the system that runs, checks and corrects the agent. The three are nested rather than competing, so improving one layer rarely fixes a failure that lives in another. Most agent failures that survive good prompts sit at the harness level.

What Are the 7 Components of an AI Agent Harness?

An AI agent harness is typically made of seven parts: an instructions file, tools, context and memory, guardrails, verification loops, orchestration, and observability. Not every agent needs all seven on day one, but you’ll end up adding most of them.

Architecture diagram illustrating the seven components of an AI agent harness including instructions file, tools, context memory, guardrails, verification loops, orchestration, and traces

1. The Instructions File

This is the standing rulebook the agent reads before it starts. In coding agents it’s often a file called AGENTS.md (or CLAUDE.md in Claude Code) that lists the stack, the conventions and the things not to touch. DataCamp’s 2026 tutorial builds its minimal harness around exactly this file, and loads it into every call so the rules never drift out of sight.

It’s different from a prompt because it persists. You write it once and every run inherits it. Keep it short. A bloated rulebook gets ignored just like a bloated employee handbook.

2. Tools

Tools are the actions the agent is allowed to take: run a shell command, read a file, query an API, send a message. The model can only describe an action. A tool is what actually performs it.

Tool design is underrated. A vaguely described tool gets misused. Too many tools confuse the agent about which one to pick. Tightening a tool’s description is one of the cheapest harness fixes there is.

3. Context and Memory

This is the context engineering layer living inside the harness. It decides what goes into the model’s window at each step, what gets summarised when the window fills up, and what’s saved between sessions.

Long tasks break here first. Without a plan for compaction and memory, the agent forgets its own earlier decisions halfway through.

4. Guardrails and Permissions

Guardrails define what the agent can’t do, or can only do with approval. Read-only access. Spending caps. A human sign-off before anything irreversible.

The key idea: a guardrail enforced by code beats a guardrail requested in a prompt. “Please don’t delete files” is a request. A permission system that physically blocks deletion is a guarantee.

5. Verification Loops

A verification loop checks the agent’s output before it counts as done. Run the tests. Validate the JSON against a schema. Compare the numbers to the source data. Have a second pass review the first.

This is where LangChain found some of its biggest gains. Agents are good at producing plausible work and poor at noticing it’s wrong. Make checking a required step, not a hope.

6. Orchestration and Sub-Agents

Orchestration is how the work gets structured: which steps run in what order, when to retry, and when to hand a sub-task to a separate agent with a clean context window. A common pattern is one agent that plans, others that execute narrow tasks, and a checker that reviews.

Start without it. Multi-agent setups add real complexity, and most first harnesses don’t need them.

7. Observability and Traces

A trace is a step-by-step record of what the agent saw, decided and did. Without traces, you’re debugging a black box by guesswork.

With them, you can find the pattern. Maybe the agent keeps misreading one tool’s output. Maybe it burns half its time on the same dead end. LangChain used traces to find failure modes at scale and then tuned the harness against them. This is the component that turns harness engineering from a one-time setup into an improvement loop.

Harness Engineering Examples You Can Picture Easily

The concept is clearer with real cases. Here are four, from the technical to the everyday.

A Coding Agent That Keeps Breaking Your Tests

OpenAI’s Codex experiment is the flagship example. The team’s job shifted away from typing code and toward designing the environment the agents worked in. According to OpenAI and InfoQ’s coverage, they encoded documentation, architectural rules and feedback loops into files the agents could read and follow, and ran regular cleanup passes to stop quality drifting.

A plain-language version: instead of telling the agent “write clean code” a hundred times, they built a project where messy code gets caught automatically. The repository itself became the instruction manual.

A Marketing Agent Connected to Meta Ads

Say you connect Claude to Meta Ads Manager through the Meta Ads MCP (Model Context Protocol, a standard way of giving an AI model access to external tools and data). Now the model can read campaign data and, depending on the tools you expose, change things.

The harness decisions are the interesting part:

  • Which tools do you expose? Reading insights is low risk. Editing budgets is not.
  • Does every write action need your approval first?
  • Does the agent verify its summary numbers against the raw export?
  • Is there a log of every action it took?

You can use the exact same model with a loose harness (it might pause the wrong ad set at 2 a.m.) or a tight one (it reports, recommends and waits). The model didn’t get smarter. You got safer.

Also Read: AI Agent for Marketing Campaigns: How to Plan, Launch, and Scale Campaigns Autonomously

A Content Workflow With Built-In Checks

Here’s one closer to home. YUP’s own blog workflow runs on a Claude skill. That skill is a small harness. It contains standing instructions, three reference files (structure, voice rules, SEO checklist), a required outline-approval step before any drafting, and a pre-delivery checklist that has to pass before the article goes out.

Notice what’s missing: clever prompting. Nothing in that setup depends on a magic phrase. The quality comes from rules that persist, a gate that stops the agent from writing the wrong article, and a check at the end. Fix a recurring problem once, and every future run benefits.

A Refund Agent With Spending Limits

This one is illustrative rather than a named company case, but you’ll recognise the pattern. A support agent can issue refunds. The prompt says “be careful with refunds.” The harness says: refunds above a set amount are blocked until a human approves, every refund is logged with the customer ID, and the agent can only access the order it’s currently handling.

If the agent is manipulated or confused, the damage has a ceiling. That ceiling comes from the harness, not the prompt.

How Do You Fix an AI Agent Failure with Harness Engineering?

You fix it by changing the system so the same failure can’t recur, instead of retrying with a better-worded prompt. This is the habit Hashimoto described, and it’s the real heart of the discipline.

Here’s the loop:

  1. Capture the failure. Save the trace or the exact output that went wrong. Vague memories of “it messed up” can’t be fixed.
  2. Name the layer. Was it wording (prompt), missing information (context), or a missing check or limit (harness)?
  3. Choose the hardest fix that fits. Move down this ladder only as far as you need: add a line to the instructions file, tighten a tool description, add a hook that runs automatically, or add a permission block that prevents the action entirely.
  4. Add a test case. Turn the failure into something you can re-run, so the same bug can’t sneak back in silently.
  5. Re-run and compare. Confirm the fix worked and that nothing else broke.
  6. Keep the record. Over time you build a library of failures and the defences you built against them. DataCamp’s guide frames this as the real asset: a corpus of traced failures, rather than a habit of swapping models when something goes wrong.

A note on step 3. Soft fixes (an instruction) are fast but the model can still ignore them. Hard fixes (a block) are reliable but less flexible. For anything costly or irreversible, go hard.

The core harness engineering loop is to capture a failure, identify which layer caused it, and change the system so it can’t recur. Fixes range from soft (a line in an instructions file) to hard (a permission that blocks the action). Teams that keep a record of failures and their defences build a durable advantage that isn’t tied to any single model.

How Do You Build Your First Agent Harness?

Build it small and add pieces only when a real failure demands them. You don’t need a framework to begin. You need a rulebook, a short tool list, a check and a log.

Here’s a starter sequence that works whether you write code or use no-code tools:

  1. Define one narrow task. “Summarise last week’s ad performance” beats “be my marketing assistant.”
  2. Write the instructions file. Add the goal, the data sources, the format of the output, and three to five things the agent must never do. Keep it under a page.
  3. Pick the minimum tools. Give it only what the task needs. Start with read-only access.
  4. Control the context. Decide exactly which data goes in. Trim anything irrelevant.
  5. Add a verifier. Compare outputs against the source data, run a schema check, or have a second pass review the first. No unchecked output reaches you.
  6. Add an approval gate. Any action that spends money, sends a message or deletes something waits for a human yes.
  7. Turn on logging. Save every run’s inputs, tool calls and outputs so you can inspect failures.
  8. Run it, break it, patch it. Use the failure loop above. Expect the first week to produce a lot of fixes.

On the technical side, DataCamp’s tutorial shows a minimal Python harness built from a ReAct loop (reason, act, observe, repeat), a few tools, hooks and an AGENTS.md file. It’s a good reference if you want to see the moving parts in code. Start simple and keep going from there, as TechTarget’s enterprise guidance also suggests.

Common Harness Engineering Mistakes

Most failed harnesses fail in predictable ways.

  • Treating a prompt as a harness. One long instruction with no tools, checks or logs is still just a prompt.
  • A giant rulebook. The more you pile into the instructions file, the less any single rule gets followed. Short and specific wins.
  • Too many tools. Every extra tool is another way for the agent to pick wrong. Cut ruthlessly.
  • No verification. If nothing checks the output, you’ve built a confident error generator.
  • Skipping traces. If you can’t see what the agent did, you can’t improve it.
  • Starting with multi-agent systems. Complexity first, reliability never. Prove one agent works before adding five.
  • Forgetting that harnesses age. A workaround you built for a weaker model may be dead weight, or even harmful, on a newer one. It’s worth re-testing your harness whenever you change models.

That last point is a judgment call, not a law. But harnesses that never get reviewed tend to collect clutter.

Do Marketers and Non-Engineers Need to Care About Harness Engineering?

If you only use AI in a chat window, probably not yet. Good prompting and good context will take you a long way.

But the moment you let an AI take actions for you, the equation changes. Building a Claude project with standing instructions and reference files, wiring an n8n or Zapier flow that calls a model, or connecting an AI to your ad accounts or CRM all count. You’re doing harness work, whether you call it that or not.

Here’s the opinionated take. Most marketers are stuck at the prompt layer, polishing wording while the real failures come from missing checks and loose permissions. The people who’ll build agents they can trust are the ones who think like an operations manager: what can this thing touch, who reviews its work, and what happens when it’s wrong?

You don’t have to write code to do that. You do have to think in systems.

One limit worth stating. The strongest public evidence for harness engineering comes from coding agents, because that’s where the benchmarks and the case studies are. Marketing and content workflows are earlier. The principles carry over. The hard numbers aren’t there yet.

Conclusion

Three ideas are worth carrying out of this. First, a model is only part of an agent. Agent = Model + Harness, and the harness often decides whether the result is good enough to trust. Second, prompt, context and harness are nested layers, so match each failure to the layer it actually lives in. Third, the best harnesses grow from real failures, one fix at a time, with a record of what went wrong.

So here’s a practical next step. Pick one AI workflow you already run. Write down what it can touch, what checks its output and what happens when it’s wrong. Those three answers are your first harness spec.

If you want to build these skills hands-on, with practical AI workflows instead of theory, Hotskill is the place to do it. It’s YUP’s mobile app for learning AI skills in short, usable lessons. Download Hotskill on iOS or Android and start with your first workflow.

Frequently Asked Question About Harness Engineering

What is harness engineering in simple words?

Harness engineering is building the system around an AI model so it behaves reliably. That system includes the tools it can use, the rules it follows, the information it sees, the checks on its work and the logs of what it did. The model is the brain. The harness is everything that lets the brain do safe, useful work.

What is the difference between harness engineering and prompt engineering?

Prompt engineering improves the wording of a single request. Harness engineering designs the whole system around the model, including tools, permissions, verification and logging. Prompts sit inside the harness. A better prompt can’t fix a missing approval gate, and a better harness can’t rescue a badly phrased task.

Is harness engineering the same as context engineering?

No, though they overlap. Context engineering decides what information the model sees at each step. Harness engineering covers that and also what the system can do, what gets blocked, what gets checked and what gets logged. Many sources treat context engineering as one part of the harness.

Is prompt engineering dead?

No. Prompts still shape every model call inside an agent. What’s changed is that for agents running many steps, the prompt is no longer where most failures come from. Treat prompt engineering as one layer you still need, not the whole job.

What is an AI agent harness made of?

Most harnesses combine an instructions file, a set of tools, context and memory management, guardrails and permissions, verification loops, orchestration logic and observability (traces and logs). You can start with three or four of these and add the rest as failures show you what’s missing.

Who should learn harness engineering?

Anyone building or deploying AI agents that take actions: developers, AI product teams, marketing operations people and founders using tools like Claude, Codex, n8n or Zapier. If you only chat with AI to draft or brainstorm, you can wait.

How do I get started with harness engineering?

Pick one narrow task. Write a short instructions file, give the agent only the tools it needs, add one check on its output and one approval step for anything risky, and log every run. Then fix failures one at a time. The step-by-step checklist above walks through it.

Is harness engineering actually worth it, or just a rebrand?

It’s partly new vocabulary for older ideas, like testing, permissions and monitoring. That’s fair criticism. But the evidence that the surrounding system moves results is real: LangChain’s 13.7-point benchmark gain with a fixed model is one public example. The label may fade. The practice won’t.

Why does my AI agent keep making the same mistake?

Usually because the fix lives in the wrong layer. Rewording the prompt asks the model to remember something. Adding a rule to the instructions file, a check in the loop or a block in the permissions makes the mistake structurally harder to repeat. Capture the failure, find the layer, and fix it there.

What do most people get wrong about harness engineering?

They think it’s a framework you install. It isn’t. It’s a habit of treating every failure as a design problem in the system. The second most common mistake is over-building: adding multi-agent complexity before one simple agent works.