GenLucid

ARCHITECTURE

What Is an Agent Harness?

An agent harness is the software around a model that turns it into an agent. It runs the loop: call the model, run whatever tool calls the model asks for, feed the results back, repeat until the task is done. The model brings judgment. The harness brings the loop, the tools, and the guardrails.

Anatomy diagram of an agent: a model at the center labeled "brain", surrounded by the harness's jobs, the think-act-observe loop, filesystem, sandboxed computer, memory, subagents, and guardrails.
One-pager: the anatomy of an agent. The model at the center, the harness's jobs around it.
Explainer: the think-act-observe loop, what the harness actually does, and why it's where the leverage is.

What the video explains

Three things people all call "AI"

A chatbot tells you how to do something. An agent goes and does it. That is the whole difference.

People call three different things AI. A model is text in, text out, with no memory and no hands. A chatbot is a model plus a conversation, but it is still just talking. An agent takes an action, sees what happened, and decides the next action. Then it repeats.

Every agent runs one loop

Every agent, underneath the branding, runs one loop. The model decides the next action. The harness runs that action. The result goes back to the model. The model decides again. Think, act, observe, think again, until the goal is met. On a long job the model also keeps a plan it can revise as it learns.

The loop needs something to run it. That something is the agentic harness, and it is the part people leave out.

If the model is the brain, the harness is the body

Here is a clean way to draw the line. The harness is every piece of code, config, and infrastructure that is not the model itself. A raw model just takes in text and puts out text. The harness is what lets it run commands, edit files, and remember things.

It runs the loop. It gives the model a filesystem, a workspace to read and write and offload work that outlives one session, with git to track it. It gives the model a computer, a bash tool in a sandbox, so it can write its own tools instead of waiting for pre-built ones. It fights context rot, by compacting a full window, sending huge outputs to a file, and loading skills only when needed. It adds knowledge the model was never trained on, through memory files and web search. It delegates, spawning subagents with their own context for parts of the job. And it holds the guardrails: step limits, approvals, blocked commands, and recovery when a call fails.

One run, and where the leverage is

Watch one run. The goal: fix the broken build. The model decides to look at the last commit. The harness shows it. The model spots a renamed function with an old caller. The harness runs a search. The model edits both files. The harness applies them. The model runs the build. It passes. Nine decisions by the model, nine actions by the harness.

Where does thinking mode fit? The "decide the next action" step is often a thinking step. The model reasons privately about what it has learned, then commits. So an agent is really a thinking model, in a loop, with hands.

The hype says the agent is the intelligence. But the harness is where the leverage is. On the Terminal-Bench benchmark, the same model with a stock harness ranked around thirtieth. Swap in a harness tuned for the task, same model weights, and it jumps to the top five. Intelligence lives in the model. Usefulness comes from the harness around it. Pull the harness out and you have a model describing what it would do, to nobody.

The loop itself

At its simplest a harness repeats four steps. Send the current conversation state to the model. Read what comes back. If it asked for a tool call, run that tool and append the result to the conversation. Then check whether to stop, on task completion, an error, or a turn limit. That loop is the whole mechanism behind an agent that looks like it 'decides' to search the web, then read a file, then run a command.

The model has no memory between calls and cannot run anything. Every capability an agent seems to have, memory across a session, running code, browsing, is built by the harness and handed to the model as a tool or as conversation state the harness keeps.

What a harness has to handle

Tool execution and result formatting: run the requested function safely, turn its output into something the model can read. Context management: decide what stays in the conversation as it outgrows the model's context window (see what a context window is). Error handling: what happens when a tool call fails, or the model asks for a tool that does not exist. Stopping conditions: tell task completion apart from an infinite loop.

Permission and safety boundaries live here too. The harness decides whether a destructive action, deleting a file, sending a message, spending money, needs human confirmation first or runs on its own.

Harness vs. framework vs. agent

'Agent' usually means the whole system: model plus harness plus tools, doing a task. 'Harness' is the orchestration code that runs the loop. A 'framework', like a published agent SDK, is a packaged harness plus common utilities, so you do not write the loop from scratch each project.

FAQ

Can I build a harness without a framework?
Yes. The core loop is a few dozen lines: call the model, check for a tool call, run it, append the result, repeat. Frameworks add retries, tracing, and common tool integrations, but you do not need one to understand or build the pattern.
Is 'harness' the same as 'agent SDK'?
Related, not identical. An agent SDK is a packaged, reusable version of harness logic plus supporting utilities. 'Harness' is the orchestration pattern itself, which every SDK implements some form of.

Sources

Related

Last updated 2026-09-06