---
title: What is a harness in AI agents? Explanation and examples
description: "A harness is the layer around the model: tools, context, state and
  execution. Read what that layer does and why an agent's success depends on
  it."
lang: en
canonical: https://www.en-twine.ai/en/what-is/harness/
updated: 2026-10-02T17:19:37.000Z
---
A language model predicts text. It cannot send an email, write an order or open a page. Everything an [AI agent](/en/what-is/ai-agent/) does in practice happens because the layer around it makes it available and carries it out. That layer is called the harness. The word comes from engineering practice and is also used untranslated in Dutch, but the image fits: a harness that surrounds something, determines its freedom of movement and that you fit yourself.

## What a harness does

A harness does four things:

- It **provides tools**: searching, reading, writing or updating a system. A tool is not just a function, but also an agreement about what it is intended for, when it should not be used and what the response means. A large part of an agent's behaviour lies in that description rather than in the model.
- It **prepares context**: which information is provided at each step? That is selection, not storage. Sending too much information makes an agent more expensive and can make its answers less reliable.
- It **keeps track of what happened**: the model cannot see whether an action succeeded and only sees what the harness returns. That record is called [state](/en/what-is/agent-state/) and is a common cause of problems in production.
- It **limits execution**: how often may the agent retry, when does it stop, what must never happen without approval and who may do what? That should be enforced in the software rather than requested in the prompt, with [human approval for irreversible actions](/en/what-is/human-in-the-loop/).

## Why this distinction matters

Two businesses can use the same model and get completely different results. The difference is almost never in the model and almost always in the layer around it: which tools are available, which information is provided and what happens when a step only partly succeeds. That is also the practical reason to own that layer yourself. If you own the harness, you can choose the model for each task, switch providers or move to an open source model without rebuilding the agent. If you do not control the layer, the model becomes a dependency rather than a component.

## What this looks like in practice

We have published one ourselves. The [Minimal Coding Harness](/en/blog/minimal-coding-harness-open-source/) is on GitHub under the MIT licence and has deliberately been kept small. It limits how much information goes to the model, checks locally whether the delivered work is correct and tracks usage separately. That keeps the agent faster, cheaper and easier to check. It is a harness for code. For an agent in your own processes, the contents look different, but the four parts above stay the same. With a CRM agent, for example, the model writes a follow-up while the harness retrieves the right customer data, requests approval, sends the email and records in the CRM what actually happened.

If you want to know what that means when you want to build something yourself, read the guide to [building your own AI agent](/en/guides/build-ai-agent/). If you first want to know which process is suitable, start with the [AI Readiness Scan](/en/ai-readiness-scan/).