Start here

Harness Engineering Explained: 60 Real Questions Answered

What is harness engineering, who coined it, is it a buzzword, and which book should you read? 60 real questions, answered in plain English.

Abhishek Ashtekar holding a question and answer sign beside Harness Engineering, 60 Real Questions, Answered text.
On this page
  1. Harness engineering explained: the basics
  2. Books, courses and how to learn
  3. Is harness engineering real, and does it matter?
  4. Harness engineering compared
  5. How to build and choose a harness
  6. How to make agents reliable and safe
  7. Careers and what comes next
  8. Questions you may ask next
  9. Final thoughts
  10. Sources and further reading

The short answer

Harness engineering is the work of building everything around an AI model so that it becomes a reliable agent. The harness gives the model its instructions, its tools, its limits, a way to save progress and a way to check the result. Here is harness engineering explained through 60 real questions, from the first doubt to building, testing and careers.

If you have used ChatGPT, Claude Code or Cursor, you have already met a harness without knowing its name. You asked for something, the AI read a few files or searched the web, and a result came back. A lot of software worked between your request and that result, and this page is about that software.

You can read from the top, or use the contents list to go straight to the part you need. I have kept the answers in plain language, because most explanations of this subject are written for people who already understand it.

Harness engineering explained: the basics

What is harness engineering?

Harness engineering is the practice of designing and improving the system around an AI model so that it can finish real work reliably. The model does the thinking. The harness decides what the model sees, which tools it can use, what it is not allowed to touch, and how you know the job is done.

Suppose you ask an AI agent to answer customer emails. The model can write a polite reply in seconds. But it does not know your refund policy and it cannot look up an order. It also has no idea that a large refund needs your approval. When you give it the policy, connect the order system, block large refunds and check each reply before it goes out, you are doing harness engineering.

This work matters because a clever model can still do the wrong thing with great confidence. The harness gives it better conditions to work in, and it shows you when the work is wrong. My guide to what harness engineering is takes you through each part with a full example.

Can someone ELI5 what a harness is and why it matters?

A harness is everything that helps an AI do a job, apart from the AI's own brain. Think of a brilliant new cook on their first day in your kitchen. They know how to cook, but they do not know your menu, where you keep the knives, or which customer has a nut allergy.

So you hand them a recipe, show them the tools, lock the cupboard they should not open, and taste the food before it leaves the kitchen. The cook has not become any smarter, but the food is better because the kitchen is better. That kitchen is the harness.

You will often hear people say that the harness matters as much as the model, and this is why. Two people can use the same AI model and get very different results. One of them has a well-run kitchen, and the other has an empty room.

What is an agent harness?

An agent harness is the software that surrounds an AI model and turns it into an agent that can act. A model on its own can only produce text. The harness reads that text and works out which action the model is asking for. If the action is allowed, the harness carries it out and sends the result back.

You can see this in a simple request such as "book the 10 a.m. slot". The model cannot open your calendar. It can only say that it wants to. The harness opens the calendar, refuses if the slot is taken, and tells the model what happened so it can try another time.

Google Cloud describes it in much the same way. Its page on agent harnesses lists the running of the loop, saved state, tool calls, memory and safety guardrails as jobs of the harness. LangChain has a shorter version: "If you're not the model, you're the harness."

What do people mean by "my harness" re: agentic coding?

They usually mean the setup they have built on top of a coding agent such as Claude Code or Codex. It includes their project instructions, their test commands, the hooks that run automatically and the actions they have blocked. They did not write the agent itself. They made it fit the way they work.

Sometimes a person means something bigger. They may have written their own program that calls a model, runs tools and decides when to stop. You can tell which one they mean by asking whether they wrote the loop that calls the model. If they did, they built a harness from the ground up. If they did not, they shaped one.

Birgitta Böckeler calls that second kind an outer harness, because it wraps around the one the tool already has. Most developers should start there. You can improve your results in an afternoon with one clear instruction file and one test that the agent must pass.

Why is it called harness engineering?

The name comes from an older engineering term. Software developers have used "test harness" for many years to describe the code that runs a program under controlled conditions. When people began building control systems around AI models, they borrowed the word. One 2026 research paper follows it all the way back to the harness on a horse.

The horse is a useful picture, because a harness directs something strong towards useful work. I would not push the picture too far. A harness on a horse mostly guides it. A harness on an AI model also gives it new abilities, such as reading a file or sending a message.

Who coined harness engineering?

Mitchell Hashimoto, the co-founder of HashiCorp, is the person most often linked to the name. In February 2026 he wrote about his journey with AI tools and said he had started calling one habit "harness engineering". Each time an agent made a mistake, he built something so that it would not make the same mistake again.

I would not say he invented the practice. Anthropic was already writing about harnesses for long-running agents in November 2025, and developers were writing test scripts for agents before that. Hashimoto gave a clear name to something people were doing. OpenAI then used the phrase in the title of its own article that same month, and after that the whole industry started using it.

Why is everyone talking about Harness Engineering now?

Because AI agents have moved from answering questions to doing work, and that is where a good prompt stops being enough. An agent that writes a paragraph can be wrong and you will notice. An agent that edits forty files, sends emails or spends money can be wrong for an hour before you find out.

Companies felt this problem at about the same time. OpenAI wrote about a product whose code was produced entirely by agents. LangChain showed that its coding agent went from 52.8% to 66.5% on a benchmark while the model stayed the same. The team changed the harness, including how much reasoning the model used. When people saw results like that, they started asking what a harness is.

Some of the noise is fashion, and you will see job titles that mean very little. The skill underneath the noise is worth learning, because someone has to make these agents safe to use.

How does harness engineering work?

It works as a cycle that you repeat. You give the agent a real task, watch where it goes wrong, add one thing that prevents that mistake, and run the task again. Over a few weeks, those small additions become a system that you can depend on.

Let me take you through one round of it.

  1. Decide what a correct result looks like, so you can check it without guessing.
  2. Run the agent somewhere it cannot cause damage.
  3. Read what it did, and find the first step that went wrong.
  4. Ask what was missing. It may have lacked a fact, a tool, a limit or a check.
  5. Add that one thing and run the same task several times.

Do not skip the third step. It is tempting to see a bad result and rewrite the prompt, when the agent may have opened the wrong document at the very beginning. You can practise this whole cycle without an API key in my harness engineering tutorial.

What is an Agentic AI loop?

An agentic AI loop is the cycle in which an AI chooses an action, sees what happened and chooses again until the work is finished. Simon Willison puts it in one line: "Agents run tools in a loop to achieve a goal."

You do the same thing when you look for your keys. You check the table, they are not there, so you check your bag. Each place you look changes what you do next. An agent that is fixing an error works this way too. It reads the error, changes the code, runs the program again and reads whatever comes back.

The danger is a loop that does not know when to stop. An agent can repeat the same failing step until you run out of money. A good harness sets a limit on the attempts, the time and the cost.

Is Claude code an agent or harness

Claude Code is a harness, and the Claude model inside it does the thinking. Anthropic's own documentation says that Claude Code is the layer around the model, and that this layer is what people mean by "agentic harness".

When you use it, you experience the two together, so it is fair to call the whole thing an agent. You type a request, and it reads files, makes changes and runs commands on its own. The difference starts to matter when something goes wrong. If Claude did not know about a rule in your project, you need to change what it sees. If it ran a command it should not have run, you need to change its permissions. Blaming the model would not fix either of those.

Harness engineering vs Harness: are they the same thing?

No, they only share a word. Harness engineering is about the systems we build around AI agents. Harness with a capital H is a software company whose platform helps teams build and deliver software. There is also the wire harness, which is the bundle of cables inside a car or a machine.

You will notice the mix-up when you search for jobs or courses, because the results mix all three. Add a word such as "agent", "LLM" or "AI" to your search and the results become much cleaner. This website and my book are about AI agents.

Books, courses and how to learn

Which is the best book to learn harness engineering?

The Harness Engineering Blueprint is the best book to learn harness engineering if you want to understand the whole system in one place. I wrote it, so let me give you the reasons and you can decide whether it is right for you. It takes you from what an AI agent is to running one in production.

I wrote the book because the information was scattered. One article explained context, another explained loops, a third explained tests, and a beginner had no way to see how they fit together. The book has 18 chapters, and they follow one example from start to finish. You begin with an AI agent that has received a single instruction. Chapter by chapter, you give it context, tools, limits, memory, tests and a way to recover from failure.

You do not need a machine learning background, because each technical term is explained when it first appears. You also do not need to install a particular framework. The ideas are the kind that last, such as deciding what success means and limiting what an agent can damage. When you want to practise, there is a free companion course with 11 Python projects that run offline.

It is the wrong book if you need a manual for one framework, or if you only want to study evaluation. Look at the chapter list before you buy, and compare it with the others in my guide to harness engineering books.

Where can i learn about context engineering, and harness engineering?

Learn them together, because context engineering is one part of harness engineering. Context engineering is about what the model gets to see. Harness engineering includes that, and then adds tools, limits, memory and checks.

Begin by reading one clear overview, and then build something small as soon as you can. An afternoon spent on a tiny agent will teach you more than a week of articles. My free course starts with a scripted model, so it costs nothing to run. For context, Anthropic's guide to effective context engineering is one of the best things you can read.

If you want to build small, local agents, the same path works. You will learn faster with a small model, because it makes more mistakes and you get to see what each part of the harness is for. Follow my 30-day roadmap if you want to know what to do on each day.

Best resources on harness development?

Start with the teams that have built harnesses and written about what went wrong. Anthropic's article on harness design for long-running apps is a wonderful example. The author builds a complicated harness and later removes parts of it when a better model arrives. Böckeler's article on guides and sensors gives you a simple way to think about your own setup.

After that, stop reading for a while and build. You can spend months saving links and still not know how to handle an agent that says it has finished when it has not.

I have put together a free resource pack so that you do not have to search for everything yourself. It has courses, articles, videos, open-source harnesses, tools, checklists, five projects and a 30-day plan. Choose one course and one project from it, and ignore the rest until you have finished them.

Any good books on context engineering or agent architecture?

Yes, and the right one depends on the trouble you are having. If your agent gives poor answers because it does not have the right information, read about context engineering. I wrote The Context Engineering Blueprint for that problem. If your agent has the information and still does something careless, you need to learn about the system around it. I wrote The Harness Engineering Blueprint for that.

A common worry is that a book on AI will be out of date before it reaches you. That is a fair worry when a book teaches the code of one framework. Look for books that explain why something works, because those reasons do not change each time a library releases a new version. For the exact code, use the official documentation.

Technical Book recommendations specifically on AI agent planning, tool calling & orchestration

Look for a book that treats planning, tool calling and orchestration as one subject. They depend on each other. A good plan is useless if the tools give confusing errors. And if one agent cannot recover from a failure, several agents working together will only multiply the problem.

In The Harness Engineering Blueprint, I cover tools in Chapter 7, planning and loops in Chapter 13, graphs in Chapter 14 and human control in Chapter 15. If you already run agents in production, I would begin with Chapter 9 on saving state and Chapter 12 on checking results. Those two subjects decide whether your agent survives a bad day.

You may also want a specialist book for the area you find hardest. I have compared several by other authors in my list of books on harness engineering.

Could you recommend some books on Prompt Engineering and Agent Engineering?

If you are early in your career, choose one book that takes you from prompts to a complete agent. Reading a book of prompt tricks first is tempting, but those tricks are often tied to one model and they age quickly. The habit underneath them is what you want to keep. Say clearly what you need, show an example, and explain what a finished result looks like.

The Harness Engineering Blueprint follows that path. Chapter 3 is about prompts, Chapter 4 is about context, and the chapters after that build the agent. My advice would be to keep a small project beside you while you read. Try each idea on it the same evening, because you will remember what you have tried far longer than what you have highlighted.

Would you recommend reading these books? And what is the correct order for reading them?

I would put any collection of AI books in this order. Read one that explains the whole system first, so that you have a map. Read one on evaluation second, because you need to know whether the things you build are working. Then read about the part you use most at work. Leave the big catalogues of patterns until the end.

It is easy to do it the other way round. You read thirty design patterns before you have met the problems they solve, and you forget nearly all of them. Those books become far more enjoyable when you can say, "I had this problem last month."

You also do not have to finish everything. If a book on training models from scratch is sitting in your pile, and you want to build agents with existing models, it can wait.

Is there a harness engineering book PDF?

Some authors sell or give away their books as PDFs, and their own websites will tell you so. My book is sold on Amazon, and the book page takes you to the formats available in your country.

Please be careful with websites that offer a paid book as a free PDF. The file may be old or incomplete, and a file from an unknown website can harm your computer. The author also gets nothing for the work.

If you want something free to start with, take the resource pack. It has PDFs with a 30-day roadmap, projects and checklists, and the companion course is free to read in your browser.

Is there a free harness engineering course?

Yes, there are several. I made a free course with 18 lessons and 11 projects in Python. You can run the projects offline, so you do not need to pay for an API key or worry about a bill while you learn.

What I like about learning this way is that you get to watch an agent fail. In one project, your agent keeps trying the same thing again and again, and you have to write the code that stops it. Once you have done that, you will never look at a confident AI answer in quite the same way.

You will need basic Python. If you have not written any code before, spend two or three weeks on that first. I have compared other options, both free and paid, in 10 courses to learn harness engineering.

Is 6 months enough to become an AI Agent Engineer from absolute zero?

Six months is enough to build a small agent that works and to explain how you made it reliable. It is usually not enough to become a professional engineer from zero. The job also needs programming, debugging and the judgement that you get from doing the work.

If you can give it two or three hours a day, spend the first two months on Python, Git and the command line. Build your first agent in the third month. Use the fourth to give it limits and a way to save its progress. Spend the fifth testing it properly, and use the last month to finish one project you would be proud to show someone.

Nobody can promise you a job at the end. What you can control is whether you have something to show. A person who can say "here is how my agent failed, and here is what I changed" stands out, even with only six months behind them.

How can I start making AI agents without any background in programming and coding?

Begin by making an existing AI tool do one small job well. Choose something you do each week, such as turning meeting notes into a list of tasks. Write down the steps as if you were training a new assistant, and write down what a good result must contain.

Now give it three different sets of notes, and make one of them messy on purpose. You will see where it goes wrong. Perhaps it invents a deadline that nobody mentioned. Add a rule that tells it to leave the deadline blank when there is none, and try all three again. That was a small piece of harness engineering, and you did it without writing any code.

Keep this first experiment away from your email, your money and your customers' information. When you want the computer to enforce the rules, you will need some Python. The learning roadmap shows you how to begin.

If you were starting to learn AI agents today, what would you build first?

I would build a tiny agent that does one job and can be proved right or wrong. It might read a list of expenses and report the total. You already know the correct total, so you will know at once when the agent makes a mistake.

Give it a tool to read the file, a limit of five attempts, and a check that compares its answer with the real total. Then start breaking things. Put a word where a number should be. Hide the file. Remove the check, and see how easily a wrong answer gets through. This is the part where you learn the most.

I would stay away from a personal assistant that manages your whole life. It sounds exciting, but it has no finish line, and it needs access to all of your accounts. Once your small agent works, choose the next one from these 11 projects with code.

Is harness engineering real, and does it matter?

Is harness a new buzzword?

The word is fashionable right now, but the thing it describes is old and useful. Developers had test harnesses long before AI agents existed. What changed is that we now need a whole system around a model that can make its own decisions, and "harness" is a convenient name for it.

You will meet people who use it as a buzzword. Ask them what their harness can stop. If someone tells you it refuses to delete customer records, or that it will not accept a report with a missing source, there is something real behind the word. If all they can show you is a longer prompt with a new name, you have found the buzzword.

Is harness engineering dead?

No, harness engineering is not dead. Some parts of a harness do become useless as models improve, and you should delete them when that happens. But an agent still needs limits on what it can touch, a way to save its work, and a check that proves the job is done. A smarter model does not give you any of those.

Think about a support agent that can issue refunds. Last year you may have written a long prompt telling it to think step by step, because the older model kept rushing. A newer model may not need that prompt, so you can remove it and test again. Would you also remove the rule that stops it from refunding the same customer twice? I would not, because that rule protects your money from a mistake that any model can make.

My advice would be to review your harness each time you change the model. Remove one thing, run the same tasks again, and bring it back only if the results get worse. Over time, your harness becomes smaller, and the parts that remain are the ones you need.

On "harness engineering": Are people actually building things or just giving impressive labels to "tweaking?"

People are doing both. If someone changes one sentence in a prompt and calls it harness engineering, that is tweaking with an impressive label. But there are also teams building serious systems under the same name.

OpenAI's account of its Codex project is a good example of the second kind. The team made it possible for the agent to start the application by itself, look at the screen, and read the logs and performance numbers. The agent could then see its own mistakes. You cannot get that from a better sentence.

When you want to know which one you are doing, look at what remains after the task is finished. A tweak helps you once, and you may not remember why it worked. Engineering leaves something behind, such as a test or a limit, that helps the next task too.

Does Harness really matter?

Yes, it does, although not in the way that many online arguments suggest. A harness matters a great deal when it fixes a problem your agent has. Swapping one popular tool for another, with no particular problem in mind, may change very little.

There is good evidence for both halves of that. LangChain raised its agent's score by 13.7 points with the same model, by studying where the agent failed and fixing those places. Then a 2026 study took three well-known harnesses and ran them with seven models. No harness led consistently, and swapping one for another changed about as many results as running the same one twice.

So before you move to a new tool because somebody on the internet loves it, find out what is going wrong with the one you have. The answer is often something you can fix today.

Here we go again.. Is Superpowers / harnesses redundant with Opus 5.5?

I have not tested Superpowers with Opus 5.5, so I will not tell you that it is redundant. What I can tell you is that a better model usually makes some of your setup unnecessary and leaves the rest as important as before.

The instructions that age fastest are the ones that teach the model how to think. If you have pages telling it to plan first, stay focused and not give up early, a newer model may already do those things. Your project rules are different. No model can guess that your company never deploys on a Friday, or that one folder belongs to another team.

Please do not delete everything in one go. An Anthropic engineer tried a drastic cut, could not match the original performance, and could no longer tell which parts mattered. The engineer then removed one piece at a time, and that worked much better. Take five real tasks, run them with your full setup, remove one thing, and run them again.

Why bigger context windows won't replace Harness Engineering?

Because a context window is only a place to keep text. You can give a model room for an entire library. It still cannot tell you whether it is allowed to send an email, or prove that the number in its report is correct.

A bigger window can even make things worse. Imagine that you give the agent all of your company's documents, and two of them describe the holiday policy. One is from this year and the other is from four years ago. The agent now has more information, and a better chance of quoting the wrong policy. Anthropic explains in its guide to context that a model's recall gets worse as the window fills.

I am happy when windows get larger, because long documents become easier to work with. But use the space for things the agent needs, and let the harness handle permissions, memory and checks.

Is "harness engineering" just a Python script?

Sometimes a Python script is all the harness you need. If a script calls the model, runs one safe tool and checks the answer, it is a harness, and you should be pleased that it is so small.

The trouble begins when you ask more of it. What happens if your laptop restarts halfway through? What if the model asks to delete a folder? How would you find out, next week, why it made a strange decision on Tuesday? Each of those questions adds something to your script. One day you look at it and realise that the part that calls the model is only a few lines. Nearly everything else is there to keep the model honest.

That surrounding code is harness engineering. You can see a complete version in a single file in my Python tutorial.

Harness engineering compared

Harness engineering vs context engineering vs prompt engineering: what is the difference?

Prompt engineering is about what you ask. Context engineering is about what the model knows when you ask it. Harness engineering is about the whole system in which the work happens, and it includes the other two.

Suppose you want an AI agent to write a weekly sales report.

Term What you decide What it looks like in the sales report
Prompt engineering The request "Summarise this week's sales and explain the three biggest changes"
Context engineering The information This week's figures, last week's figures and a note about the product that was out of stock
Harness engineering The system The agent can read the sales data but not change it, the totals are recalculated, and you approve the report before it is sent

When a report comes back wrong, this difference tells you where to look. If it answered a question you did not ask, improve the prompt. If it blamed poor demand for a product that was out of stock, it needed better context. If it emailed the report to your whole company without asking you, no prompt or document would have helped, because that is a problem with the harness.

I have taken one task through all three in harness vs prompt vs context engineering.

Is prompt engineering still a thing, or is it dead?

It is still a thing, but it has grown up. A few years ago, people collected magic phrases and told the model that it was a world-class expert. Newer models do not need much of that. They need you to be clear.

Compare "You are an award-winning analyst, think very carefully about this data" with "Compare March and April sales, show the percentage change for each region, and tell me if a region has no data." The second one is far less dramatic and far more useful. It tells the AI what you want, and it tells it what to do when something is missing.

A prompt has a limit, and it is good to know where it is. You can ask an agent to never touch a file, and most of the time it will listen. If you need it to listen every single time, you have to block the file. I explain where prompts stop helping in the comparison of all three layers.

Is loop engineering actually real, or just another AI buzzword?

Loop engineering is real, even though the name is new. It means designing the cycle in which an agent tries something, looks at the result and tries again. IBM describes it as building loops that guide agents towards a goal with very little human help.

Anyone can build a loop that keeps going. The skill is in building one that stops for a good reason. Your agent should stop when the work is correct, when it has run out of attempts, or when it realises that it needs a person. It should also tell you which of those happened, because "I finished" and "I gave up" must never look the same.

I think of loops as one part of harness engineering, and I give them Chapter 13 in The Harness Engineering Blueprint. The word will probably change again in a year. You will still need to know when your agent should stop.

What's your real world use cases of loop / graph engineering ?

A loop suits work where you know the goal but not the steps. Fixing a failing test is a good example, because each error message tells the agent what to try next. Making a web page load faster is another, because the agent can measure the speed, change something and measure again.

A graph suits work where the steps are known and some of them must not be skipped. Think about a refund. Someone has to find the order, check that the refund is allowed, get approval if the amount is large, send the money and record it. You would not want an AI to decide that approval is optional today.

You can combine the two. The step that finds the order might be a small loop, because the customer may have given you the wrong number. That loop sits inside a graph that still insists on approval. Plenty of projects need neither, and one request with one check is enough for them.

LangGraph vs Harness Framework

LangGraph gives you control over each stage of the work, while a ready-made harness gives you an agent that can already do things. LangChain explains in its documentation that runtimes, frameworks and harnesses are different products for different needs.

If you want an agent that can read files, make changes and run commands, start with something like the Claude Agent SDK or Deep Agents. A lot of hard work has already been done for you. If your process must pause for a person, continue three days later and never repeat a payment, LangGraph lets you say exactly how that happens.

The two also work together, because Deep Agents runs on LangGraph underneath. Choose the higher-level one first, and go deeper only when it cannot do something you need. My tools guide compares the main options.

AI harness vs MCP: what is the difference?

MCP connects an AI application to outside tools and data, and the harness controls what the agent does with them. The people behind the Model Context Protocol compare it to a USB-C port. That comparison is helpful, because a port lets you plug something in, but it does not decide whether you should.

Say you connect your calendar through MCP. Your agent can now see that a tool exists for deleting a meeting. Should it be allowed to delete your meeting with the bank? MCP will not answer that for you. The harness has to ask you first, carry out your decision and keep a record of it.

So you are not choosing between the two. You can use MCP inside your harness whenever it saves you from writing the same connection again.

The difference between agentic engineering and vibe coding?

The difference is whether anyone takes responsibility for the result. With vibe coding, you describe what you want, the AI builds it, and if it looks right you move on. With agentic engineering, you still let the AI write the code, but you decide how it should work and you check that it does.

I have nothing against vibe coding. If you want a small page for your own use this weekend, it is a lovely way to make one. The trouble comes when that page starts taking bookings from real customers. Has anyone gone back to check whether two people can book the same table?

Simon Willison makes the point that when agents write code, there is still plenty of work left for people. Deciding what to build is a large part of it. So is knowing what would count as broken.

Harness engineering vs spec driven development: what is the difference?

A spec tells the agent what to build. A harness makes sure the agent builds it without breaking something else, and proves that it did. You can use either one alone, but they are much stronger together.

Imagine a spec for a booking system that says a customer can cancel up to 24 hours before the appointment. It is clear and useful, and an agent can still ignore it by accident. Now add a test that tries to cancel 23 hours before and expects to be refused. The sentence in your spec has become something the agent cannot talk its way around.

Spec Kit is a popular open-source toolkit if you want to try writing specs with an agent. For a two-line fix, I would not bother. A short, clear request is enough.

How to build and choose a harness

Before you code an AI agent harness, how do you blueprint it?

Take one page and write down nine things before you write any code. Begin with the task, what finished means, what the agent may read and what it may change. Then add its tools, what it must never do, what it saves, when it stops and what needs a person. If you get stuck on a line, good. You have found a question that would have hurt you later.

Here is a blueprint for an agent that answers customer emails.

Decision For this agent
Task Draft a reply to each new customer email
Finished means The reply answers the question and quotes the current policy
It may read Orders, policies and earlier emails from that customer
It may change Drafts only
Its tools Find an order, find a policy, save a draft
It must never Send an email, issue a refund or read another customer's data
It saves The policy it used and the order it found
It stops After three attempts, or when the customer mentions a lawyer
A person Approves each reply before it goes out

Writing it down is only half of the work, because a page cannot stop anything. Take each "never" on your list and make it impossible in code. Then try to break it. Ask the agent to send an email and see if it can. Stop it in the middle of a job and see whether it picks up where it left off.

Chapter 16 of The Harness Engineering Blueprint starts with decisions like these and builds a complete harness from them.

How to build a good harness

Start with one task and build only what that task needs. A good harness is rarely designed in one sitting. It grows because someone keeps asking, "What would have prevented that?"

  1. Choose a task whose result you can judge without arguing about it.
  2. Write the check before anything else, and make sure it fails when the answer is wrong.
  3. Give the agent two or three tools with clear names and helpful error messages.
  4. Block the actions that would hurt you, and try them to see that they are blocked.
  5. Make it save its progress, then stop it halfway to see if it can continue.
  6. Set a limit on attempts, time and cost.
  7. Run the same task ten times, and look closely at the runs that failed.

You may find that your agent ignores a skill you gave it, or misunderstands what people are asking for. Adding more instructions is the natural reaction, and it is usually the wrong one. Collect ten real requests that it got wrong and read them together. You will often notice that two of your tools sound alike, or that the description of a skill never mentions the words people use. Fix that first.

When you are ready to build one yourself, my harness engineering tutorial starts with a small version that works.

What is a harness engineering example?

A simple example is an agent that cannot say "done" until a test agrees with it. I built one for this page so that you can see it happen.

The job was to count someone's current streak in a habit app, where a missed day sends the streak back to zero. I scripted the agent so that it would give three answers and claim success each time. The first answer added up all the completed days. The second counted the last seven. Both were wrong, and both came with a confident "done". The third was correct.

Without a check, the program accepted the first wrong answer and finished. I then added a check that tried three sets of days and compared the results. The agent said "done" twice and was sent back twice. Only the third answer got through.

python
failures = check(code)
if not gate or not failures:
    return "accepted", turn, len(failures)

That is the heart of it. The agent's words decided nothing, because the check decided. I wrote the agent's answers myself, so this shows how the check behaves and not how clever a real model is. You can download the script and change it.

Is there a point to custom harnesses?

There is, when you need something that an existing tool cannot do for you. For everyday coding, I would begin with Claude Code, Codex or a similar agent, and put my effort into good project rules, tests and permissions.

Think of it like a house. Most people are happy to rearrange the furniture. Some need to knock through a wall. Very few need to build from the foundations, and the ones who do usually have a reason they can explain in a sentence. "We need a lawyer to approve this step, and the tool cannot pause" is a reason. "We want twelve agents" is not.

Remember that you have to look after whatever you build. The models will change, the APIs will change, and the person who wrote it may leave. If you are building one to learn, though, please go ahead, because you will understand every other tool better afterwards.

What are the best Agent harnesses right now?

There is no single best one, so let me tell you where I would look. If you work in a code repository, try Claude Code and Codex first. If you want something open source, look at OpenCode, Goose and Pi. If you are putting an agent inside your own product, look at an agent SDK or a managed service.

I would be careful with rankings. When researchers ran Claude Code, OpenCode and mini-SWE-agent with seven different models, no harness stayed on top. Even the cost depended on which model they used.

So give two of them the same small job from your own work. Run it five times on each. You will learn which one needs the least rescuing, which one costs less, and which one you enjoy using. I keep a longer comparison of harness engineering tools that you can use to choose your two.

Any open source harness that does it better than just Claude Code?

It depends on what you want to be better. If you want to read the code, change how it works or use a model from another company, an open-source harness will suit you more than Claude Code. If you want something that is ready to use, it may not.

Ask yourself what is bothering you today. When people are unhappy with how an agent handles a new project, they often change tools and meet the same trouble again. The agent had no written decisions, no examples to follow and nothing to tell it when its work was wrong. You can add those to any harness, and it costs nothing to try.

Do look at safety before you switch. Some open-source agents expect you to provide the sandbox yourself, so read that part of the documentation first. Five open-source options and their licences are in my tools guide.

What's the best framework for building an agent harness right now?

For your first harness, I would use plain Python and no framework at all. You need to see the loop with your own eyes once. After that, you will understand what a framework is doing for you, and you will be able to fix it when it breaks.

When you are ready for one, let the job choose. LangGraph is good when the work has clear stages and has to survive a restart. The Claude Agent SDK is good when you want the abilities of Claude Code inside your own application. Deep Agents gives you planning, files and subagents from the beginning.

Whatever you choose, test it on a bad day. Disconnect a tool in the middle of a task. Close the program and open it again. You will learn more from those ten minutes than from any list of features.

Is "harness engineering" only a coding thing? What does a harness for knowledge work look like?

No, it works for knowledge work too. Coding gets most of the attention because it is easy to check, since the tests pass or they do not. A report or a piece of advice has no such test, so you have to decide what proof would look like.

Suppose an AI agent is writing a report on a supplier for a consulting team. You can make it keep the source of every claim. You can have a second step open each source and ask whether it supports the sentence. You can recalculate each total. You can refuse a report that has nothing under "risks". When all of that has passed, a person with experience decides whether the advice is wise, because no harness can decide that for you.

You will notice that nothing here needed a smarter model. The agent could already write well. What was missing was a way to trust what it wrote. My harness engineering projects include one for a support agent that handles money.

How many tools is too many for an AI agent?

You have too many when your agent starts choosing the wrong one. There is no exact number. OpenAI's documentation suggests having fewer than 20 available at the start of a turn and calls it a soft suggestion.

Confusion is usually the bigger problem. Picture a drawer with three keys that look the same. You would struggle with three, and you would have no trouble with ten if each one were clearly labelled. Anthropic noticed the same thing and warns that tools which overlap can distract an agent.

Write down twenty real requests and the tool that each one should use. Run them, and count the wrong choices. Merge the tools that do the same job, rename the unclear ones and remove whatever this agent never needs. Then run the twenty again.

What are some tips, tricks, and gotchas when doing harness engineering for AI coding agents?

The tip I would give first is to stop trusting the summary. When an agent tells you that everything works, read the test result instead. Agents write very convincing summaries of work they have not finished.

Put the command that runs your tests in the project instructions. Anthropic's best practices call it the single most useful line you can add if you already have a check. Delete old documents too, because an agent has no way of knowing that the second copy of your style guide is from 2023. Write error messages that explain what to do next. And do not let the agent edit the tests that judge it, because changing the test is sometimes the easiest way to pass.

The biggest gotcha comes later. Your harness grows a rule at a time until nobody remembers what half of it is for. Write a few words beside each rule about the mistake that caused it. When the day comes to clean up, you will know what you can remove.

How to make agents reliable and safe

Why do AI agents fail even when the underlying model is good?

AI agents fail because a good model can still be given the wrong information, the wrong tools or far too much freedom. You could hire the most talented person in your city, and they would still make a mess on their first day if nobody told them how your company works.

The useful thing is that different failures leave different signs. This is how I would start looking.

What you notice What is probably missing
It confidently uses an old rule The current information, or someone to delete the old one
It picks the wrong tool Clear names and descriptions
It does something it should never do A limit in the code
It starts again from the beginning Saved progress
It says "done" and it is not A check that can say no

Go back to the very first moment when the run went wrong. Suppose an agent gives a customer the wrong delivery date. You see the mistake in the last message, but the cause may be a search ten steps earlier that returned someone else's order. The search is what you need to fix.

Sometimes the model is the problem. If the agent had the right facts and good tools and still could not work it out, try a stronger one. You will find ten common failures and their fixes in why AI agents fail.

how do you get claude code to actually check its work before saying "done"?

Give Claude Code a command that can pass or fail, and then make it run that command before it finishes. Anthropic explains the reason in its best practices. Claude stops when the work looks done, so if there is nothing to run, the look of it is all that Claude has to go on.

The easy way is to ask. Write "run the booking tests and show me the output" in your request, or put it in your project's CLAUDE.md file. This works most of the time, but it is still a request.

The stronger way is a Stop hook, which is a small script that runs whenever Claude tries to finish. If your tests fail, the script sends Claude back to work. It is a serious improvement, although it is not a perfect lock. According to the hooks guide, Claude Code overrides the hook after eight blocks in a row if Claude has not used a tool in between. Run the same tests again in your build system as a second check.

Why do AI agents hallucinate in production even when they work perfectly during testing?

Because real people ask things that your tests never asked. During testing, you give an agent questions that have answers. In production, someone asks for an order that does not exist, a tool takes too long to reply, or two documents disagree. The agent feels the pull to be helpful, and it fills the gap with something that sounds right.

You have to test the awkward moments on purpose. Ask about a customer who is not in the database. Give it two prices for the same product. Make a tool fail halfway. In each case, decide what a good employee would do. They might say, "I cannot find that order, can you check the number?" Make that the answer your test expects.

Check the facts as well as the wording. Anthropic gives a fine example in its guide to evals. An agent can say that your flight is booked, but what counts is whether the booking is in the database.

How do you actually test an agent harness when half of it is non-deterministic?

Treat the two halves differently. The part you wrote, such as permissions, retries and saving progress, should behave the same way every time, so test it like any other software. If the agent must never open the payroll folder, write a test that tries to open it and expects to be refused.

The model is the other half, and you cannot ask it to use the same words each time. Judge the result instead. Did the refund reach the right customer? Is the total correct? Run the same task ten times and count. If an agent succeeds three times out of four, the chance of three successes in a row is only about 42%, as Anthropic's evals guide works out.

That number surprises people, and it explains why a good demo can become a bad product. My guide on how to test AI agents takes you through a full method.

How do you make AI agents remember what they did yesterday?

Save the important things outside the conversation, and make the agent read them before it starts again. A short note is enough to begin with. What was the goal, what has been finished, what comes next, and what did we decide along the way?

But do not rely on the note alone, because the agent wrote it. An agent that failed at step four can still write that step four is complete. Let it look at the world as well. The files that changed, the rows in the database and the result of the last test will tell it what happened.

Anthropic used this idea for agents that work over many sessions. Each new session read a progress file and the Git history, and could work out where things stood. You do the same thing on a Monday morning when you open your notes and your last few emails before you begin.

How are people actually sandboxing AI coding agents on dev machines?

They use anything from the sandbox inside the tool to a completely separate virtual machine, and some people use nothing at all. What you need depends on what the agent could reach if it made its worst mistake.

What you use What it is good for Where it stops helping
A Git worktree Keeping the agent's edits away from yours It does not limit commands or the network
The tool's own sandbox Limiting what shell commands can touch Anything outside the scope it describes
A container Separating files, processes and network Secrets that you mount inside it
A virtual machine The strongest separation of the four Data that you copy into it

Please read the default settings, because they are not the same everywhere. Claude Code's sandbox is off until you turn it on, and even then commands can read most of your machine unless you change that. Codex puts commands in a constrained environment in its default mode.

Then test your wall. Put a fake password in a file outside the project and ask the agent to read it. If it can, fix your setup before you give the agent real work.

How are you protecting AI agents from runaway API costs?

Put a limit on each run, a limit on each day, and a hard limit on the account itself. An alert alone will not help you, because it can arrive after the money has gone.

Most large bills come from an agent repeating itself. It tries something, gets an error, and tries the same thing again with great patience. So count the attempts. If it makes the same call with the same input three times, stop the run and ask a person to look. Give one retry to a network problem, and none to an answer that was plainly wrong.

Be careful about where a limit falls. Suppose you stop an agent in the middle of taking a payment. You could end up with a customer who has paid and an order that does not exist. Check the budget before a step like that begins. When runs keep hitting your limit, read them before you raise it, because the limit may be telling you that something is broken.

Careers and what comes next

How do I become a harness engineer?

Learn to build ordinary software well, and then prove that you can make an AI agent dependable. There is no fixed route yet, which is good news if you are starting now. You do not need a special degree. You need evidence.

Get comfortable with Python or TypeScript, Git, testing and the command line. Learn how models call tools. Then move on to permissions, saved state, recovery and testing agents, because these are the parts that keep an agent running.

Build one agent and write about it, including what went wrong. Show the action that you blocked, and how you tested the block. Show it recovering after you closed the program. Show how often it succeeded before your changes and after them. A hiring manager can learn more from that page than from a long list of tools.

The title itself is still rare, so search for AI engineer, agent engineer and AI platform engineer too. The learning roadmap will help you with the skills.

What does a harness engineer do?

A harness engineer makes AI agents safe and reliable enough to do real work. They build the tools an agent uses, decide what it may touch and make sure it can recover. When something goes wrong, they find out why.

Picture an ordinary Tuesday. A support agent has told a customer that they can return a product after ninety days, and the real limit is thirty. The harness engineer reads the record of that conversation and discovers that an old policy was still in the knowledge base. They remove it, add a test about returns, and run the agent again to see that the answer is now correct. Then they ask which other old documents are still in there.

In many companies, nobody has this title. A platform engineer, a security engineer or a product engineer does the work as part of their job. When you read an advert, look at the tasks before the title, because a harness can also mean cables.

What is a harness engineering salary?

There is no reliable average yet, and I would be suspicious of any website that gives you one. The role is new. The numbers you find online often mix AI engineers with people who design cables, or with jobs at the company called Harness.

You can make a better estimate yourself. Find ten current adverts in your own country for AI engineers or agent engineers, and choose the ones that mention tool calling, evaluation or agents. Note the level and the full salary range. After ten, you will have a picture that no average can give you.

Your level and your location will affect your pay more than the word in your title. Being able to show that you made an agent more reliable will help you argue for a higher level.

Tips on harness design ?

If this comes up in an interview, begin with the risk before you draw a diagram. Ask who will use the agent, what a correct result is, and what the worst thing it could do is. The answers will shape the rest of your design.

Say you are asked to design an agent that schedules appointments. Walk through one request from start to finish. A patient asks for Tuesday, the agent looks at the calendar, the harness checks that the slot is free, and the booking is saved. Now make something fail. The booking request times out, and you do not know whether it went through. If the agent tries again, it may book the same patient twice. Explain how a unique ID for each request prevents that, and you have shown more understanding than ten framework names could.

Leave a few minutes to talk about testing, cost and the point at which a person steps in. Say your assumptions out loud so the interviewer can change them. You can practise with the design in my tutorial, because it is small enough to explain from memory.

Can LLMs Engineer Their Own Agent Harness?

They can, up to a point. A 2026 study called HarnessDev asked six models to build harnesses from a very small starting point. For coding and for research tasks, what they built was still well behind the best work by people. For writing and machine learning experiments, they matched or beat the harnesses they were compared with.

The researchers also let the models improve their own harnesses. Some changes helped, but the gains were unstable and only partly carried over to new tasks. So an agent can be a very good source of ideas for your harness, and you should still test each idea on work it has not seen.

There is one thing I would not hand over. Do not let an agent decide its own permissions, because it could remove the limits that protect you.

Questions you may ask next

Should I learn harness engineering in 2027?

Yes, if you build AI agents or depend on them for work that matters. More and more software will be able to act for us. Somebody has to decide what it may do and check that it did it properly.

Learn the parts that will still be true after the tools change. A configuration file will look different in a year. Knowing how to define a good result, limit a dangerous action, recover from a failure and test something ten times will serve you for much longer. If you only use AI to help you write text that you always read yourself, you can take this slowly.

Can I learn harness engineering if I only use Claude Code or Cursor?

Yes, you can, and you already have everything you need. You will be working on the outer harness, which is the part that belongs to you. It includes your project rules, your tests and the things you allow the agent to do.

Take one small improvement each week. Write a short project file in the first week and delete anything outdated. In the second, add a test for a mistake that the agent keeps making. In the third, block one command that worries you and try to make the agent run it. In the fourth, stop it halfway through a task and see whether it can carry on.

By the end of a month, you will understand why people care so much about this. If the agent keeps failing in the same way, look it up in why AI agents fail. And if you are curious about what happens inside the tool, spend an afternoon building a tiny agent of your own.

Do I need a separate harness for each AI model?

Usually not. Keep one harness for the things that should never change, and adjust a few details for each model. Your definition of a correct result, your forbidden actions and your final tests should be the same whichever model you use.

What often needs adjusting is the guidance. A smaller model may need shorter instructions and fewer tools, while a stronger one may do better when you step out of its way. Test this instead of assuming it, because the HarnessDev study found that improvements made with one model did not fully carry over to another.

How do I know if my harness is good enough?

Your harness is good enough when it meets a standard that you chose before you tested it. If you choose the standard afterwards, you will be tempted to accept whatever you got.

Write down two kinds of rules. The first kind has a number, such as nine correct replies out of ten. The second kind has no room for error, such as never showing one customer another customer's details. Then try it on a normal request, a confusing one, a forbidden one and one where a tool breaks. Include one where you stop it in the middle.

How strict you are should depend on who gets hurt. A harness for your own notes can be relaxed, and one that handles payments cannot. Test it again whenever you change the model or the tools. You will find harness checklists in the free resources.

Is The Harness Engineering Blueprint enough, or do I need a course too?

The Harness Engineering Blueprint is enough to understand how everything fits together. To become good at it, you also need to build, and that is why I made the companion course free.

My advice would be to read a chapter and then do the project closest to it while the idea is fresh. If you are already working on an agent, go straight to the chapter about the problem you are having. You can come back to the rest later.

Neither of them gives you a teacher who reviews your work, a deadline or a certificate. If those things keep you going, look through the courses I have compared and find one that offers them.

Final thoughts

You have now seen harness engineering explained from the simplest question to the hardest ones, and I hope the word feels less mysterious than it did. A model can think, but somebody has to build the place where that thinking becomes work you can trust.

Choose one agent that you already use and ask what would have prevented its last mistake. Build that one thing this week. If you would like to see every part of a harness first, read about the six parts of an agent harness. And if I have not answered your question, you can send it to me through the contact page.

Sources and further reading