Agent Harness Explained: The Components That Turn an LLM Into an Agent
What an agent harness is, why long-running LLM agents need one, the eight components it's built from, and how they cooperate on a real coding agent task.
This article is published in English.
Sources: Agent Harness — A complete guide
In 2023 working with a language model was easy to describe. You typed a question, such as "write a Python function that sorts an array of numbers", and a reply came back almost instantly. The model didn't go into any visible thinking mode. It was a bare LLM without the extras that surround today's agentic systems: tools, memory, skills and more. Those extras are exactly what turn a plain LLM into an AI agent.
How the race changed
Through 2023 and 2024 the competition was about models. OpenAI had a leading general-purpose model, Anthropic had a leading coding model, and everyone chased each other on benchmarks like MMLU and SWE-bench. Eventually that race started to flatten out, and reasoning and long context took over. A "thinking..." indicator began appearing in chat interfaces, and people wondered what was going on behind it.
Users were changing too. As models improved, people stopped asking questions and began handing over tasks. A task expects the system to set goals, use outside tools such as a browser, recall earlier conversations and stored facts, and then deliver something.
Compare the two eras with one example. Early on, someone might screenshot Amazon's landing page, give it to a coding model and ask for a site that looks the same, all in one shot. The result would be a passable UI. Now imagine wanting the UI, the backend, the infrastructure and everything else set up in one go.
By 2026 the same user might write "fix the bug raised in issue #122 on GitHub". That one sentence hides several steps. A 2023 model would have replied that it couldn't reach your repository. A model wrapped in a good harness goes into a thinking cycle: reason, plan, pick a tool or action, run it, observe the result, then repeat or stop.
What a harness is
All those add-ons around an LLM (context, tools, memory and so on) need an organized way to interact with the model. That discipline has a name, and the usual definition is short. It's the infrastructure layer sitting around an AI agent, responsible for wrapping it, steering it, testing it, watching it and judging its results. Put plainly, it's the operating system around the LLM.
That layer covers the agent architecture, the orchestration framework that coordinates sub-agents, the evaluation system that grades output, runtime infrastructure, security, governance and observability.
Why it's needed
The tasks people assign keep getting bigger, and so does the time agents spend on them. Anthropic's data shows execution times growing at a steep rate. A year earlier, in 2025, an agent might work for roughly an hour on a given job. Today that figure sits closer to twelve hours.
Long-horizon work brings its own failures. Agents may loop forever, invent tools that don't exist, corrupt their own state, blow through token budgets, lose context, retry bad actions, fail without telling anyone, misuse permissions or even forget the objective.
Those failures cost real money. An agent stuck in an infinite loop for twelve hours would burn an enormous amount of tokens and compute. A harness can cap that by enforcing a budget per task, measured in time, tokens or compute.
Security is the bigger worry. If the model picked a destructive tool, say one that wipes the file system, the harness is where you decide what it may touch. In short, the harness gives you control over the agent and, with it, confidence that the agent is doing what you intended.
The components
Whatever a particular team calls its harness, its parts fall into eight groups. Each one stands for a question the agent has to be able to answer.
- Agent state: where is the run right now? It tracks the current task, step, observations and decisions. If a plan has four steps, state records which are done, which one is underway and which haven't started. Without it, an agent that gets interrupted has no way to pick up where it stopped.
- Tools: what actions are available? This is the most visible part. Code execution, a browser, APIs, databases and a shell all live here. For a coding agent, a
read_filefunction is one of the basics. - Planning: what comes next? It decides what happens next and drafts or revises the plan. On a coding task it might produce a sequence of four or five steps.
- Memory: what is already known? It stores and retrieves information across steps or sessions. When content is pulled from a vector database into context, summarizing it first can save space, and handling that falls to the memory component.
- Orchestration: how does the process execute? It controls the execution loop, tool calls, retries, sub-agents, parallelism and handoffs. In a purchase flow, a payment sub-agent might run while an inventory agent updates stock in parallel, or the inventory agent might be told to wait until payment succeeds.
- Context management: what should the LLM see right now? It decides what lands in the context window at each step.
- Safety and governance: what is permitted? Permissions, sandboxing, approval gates, policies, limits and authentication fit here. Even when the model is allowed to edit files, it's wise to forbid deleting them.
- Observability and evaluation: did it actually work? It traces what happened and measures success, failure or violated constraints. If a task needed three of the ten available tools, you'd want to see how they were used. When one fails, the cause might be a tool the model never had, or it might be data that never reached its context. Traces are how you tell those apart.
The practice of designing, building and running these pieces so the agent performs at its best is called harness engineering. It's a newer discipline, and most teams are still working out where each responsibility belongs.
A coding agent from start to finish
Take a coding agent with a harness and give it the prompt "solve the bug in issue #122 in GitHub". It isn't an "explain this to me" request. It's a real task that needs planning, tool use and memory. One logical flow looks like this:
- The user's input enters the context. The model reasons about it and forms a goal, which stays in context until it's met.
- The model plans the work: look at related bugs, fix the right file, compile, run the tests and update memory.
- For the first step, the harness fetches memory from a vector database, namely details of past bugs relevant to this one. Authentication-related notes come back as the closest match and go into context.
- Using that context, the model decides to open
auth.pyand fix the authentication bug. That requiresread_fileandwrite_filetools, which it uses to edit and save the file. - Next it tests the change from the terminal, using a terminal tool from its available set. The harness makes sure it has the right level of access to both the terminal and the files.
- The model moves to the next plan step and runs the test cases, which needs further tools. Each step updates the context so the model knows where it is and what's left.
- Throughout, observability logs everything: tools used, time taken, memory consumed, failures along the way.
Evaluation hasn't come up yet, and it deserves its own treatment. It goes beyond accuracy and can cover several metrics tied to how the agent actually behaves.
Where this is going
Long-horizon reliability is one of the largest open problems. As agents run for hours and even days, a run has to be dependable. An agent stuck in a loop or a corrupted state wastes resources and can compromise safety.
Evaluation also gets harder as harnesses grow more elaborate. Every task leaves a trail of data, such as memory usage, and teams must decide whether to swap the model or rework the harness, add tools or repair existing ones. The community is actively working through those questions.