MLGuerrillaStart M1 →
Free · in beta·intermediate·M9·51 min read·Prereq: Observability & Traceability (M2) and The Model as a Component (M4). The support agent from M6 to M8 is the running example.

Harness & Reliability

The capability

What a harness is

A harness is basically all the code that sits around the model call. It builds the context that gets sent to the model and runs whatever tools the model asks for. Then it checks what comes back, and it decides what happens when any of that fails.

The first thing a harness gives you is one place that every model call goes through. M4 put every call behind a single complete() function, and the harness is the code that lives inside that function. That's why retries, deadlines, fallbacks and output checks each end up being one edit in one file.

The second is a move for every failure it can detect. It can retry the call, repair the output, fall back to another model or a simpler reply, decline to answer, stop the run, or hand the conversation to a person. Most of this module is about deciding which of those moves goes with which failure.

The third is a way to measure the failures it can't detect at all. Some bad answers come back well-formed and still wrong, with no error for the code to catch, and either you count those on real traffic or they don't get counted.

A wide dashed box labeled the harness, code you write, containing four steps in a row: build the call, the model drawn as the one terracotta box, check the output, and tool or reply, with a dashed arrow looping back from the last step to the first for the agent's next step. Under each step sits what goes wrong there and what the harness does about it. Building the call, the list grows past the budget from M5, so the harness compacts it or trims tool results. At the model, slow replies, 429 and 529 errors and timeouts lead to a retry with backoff and then a fallback. At the output check, cut-off JSON and a cited article that search never returned lead to one repair and then a safe reply. At the tool step, a hand_off that timed out is retried with the same key, and the same lookup repeated again and again stops the run and hands it to a person. A band along the bottom says quiet failures, fluent wrong answers or quality dropping while errors stay flat, are seen by no step and are measured on real traffic.
The table this module builds gets one row for each failure drawn here.

A harness can't change the model itself. The weights are fixed, and no amount of code around the call is going to teach the model something it doesn't know.

It can still change how often the system is right, though, because it owns all three positions around the call, and those positions are the four steps in the figure above.

Before the call, the harness decides what the model sees. The flower agent's retrieved articles come in with an article_id stamped on each one. That's what lets the model cite an article, and it's also what lets section 5's check catch a citation that search never returned. If you label the things you hand a model, so it can refer to one of them without guessing, that's a harness change that costs you one line of code, and it makes a difference to accuracy on any task where the model has to point at a particular input.

Around the call, the harness decides which model runs and with what settings. Section 6's fallback chain sends the same request to a different model when the first one fails, and a different model gives different answers. Settings change quality too, even when the model stays the same. Anthropic's April 2026 postmortem, which section 2 goes through, covers a month of users reporting worse output from a model that hadn't changed, after three settings around it moved. One of those was the default reasoning effort going from high to medium.

After the call, the harness decides what happens to a wrong answer. Section 7's coverage check declines the questions that no article covers. On the made-up eval dataset in that section, it takes accuracy on the answers the agent does give from 97% to 99.4%, and the model behind it is the same one.

So the harness does affect quality, and if you think of it as plumbing that only handles errors, that's a misconception you want to drop early. What a harness can't do is make one model better on one input. But which model runs, what that input contains, and what happens to the answer afterwards are all decisions the harness makes.

Reliability work on an AI feature comes down to two jobs. The first is building those moves before you need them, and the second is measuring on real traffic whether they worked.

Loud failures and quiet failures

Every failure in this module falls into one of two families, and which family it's in decides which of those two jobs handles it.

  • Loud failures come with a signal your code can check, like an error code, a timeout, output that won't parse or a run that keeps going. Because the code can see them, it can decide ahead of time what to do about each one.
  • Quiet failures come with no signal. The answer is well-formed and wrong, or the quality drops while the error rate stays where it was. Nothing throws an exception, so nothing in your code reacts unless you built something to measure it.

You'll also see people use "harness" for the code that runs evals, usually as "evaluation harness." In this module it always means the code around the model in production.

Where it shows up

Every production feature that has a model call in it has a harness, whether anyone calls it that or not, and the question is whether anybody ever designed it.

  • A support agent that has to decide whether a slow provider means waiting, retrying, or telling the customer something went wrong.
  • A coding assistant that has to decide what to do when the model's patch doesn't apply.
  • A document pipeline that has to decide whether a field it extracted is trustworthy enough to write into a database.
  • A batch job that has to decide whether to reprocess 400 failed rows now or park them for later.

The moves are the same in all four, and what changes from one to the next is who's waiting and what a wrong answer costs.

Keep reading

The rest of this lesson is free with an account

Create a free account to read the remaining 13 sections. It takes about twenty seconds and there's nothing to pay. The same account opens the slide decks and CV reviews.

  1. 02The agent passed its eval and still failed in Valentine's week
  2. 03Sort failures by what your code can see
  3. 04Retry what can succeed later, and give every call a deadline
  4. 05Check the output before anything acts on it
  5. 06Fall back to a path you already run
  6. and 8 more

That's the last one written so far

Pick your next module from the board.

All modules →