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.
Walkthrough: the harness built up one part at a time, from a bare model to an agent.

What the video explains

A model alone cannot act

You have probably heard that an AI agent can fix a bug or book a meeting, but the model on its own cannot do any of that. The LLM is the brain: text goes in and text comes out. It can reason about a problem, but it can only write. It cannot open a file, call a service, or remember yesterday.

So we wrap it in a harness. The harness is the orchestrator. It routes every step, always gets a result back before deciding the next one, and loops until the goal is met.

The hands, the cabling, and the notebook

First, the hands. Commands are the local tools the model can use. The model asks for an action, the harness starts the code, gathers the results, and hands them back to the model.

Second, the cabling. MCP reaches external services, usually behind an API, such as an external database or a web service. The harness makes the call and brings the answer back.

Third, the notebook. Memory remembers your preferences, and when the context fills up, it trims what the model has to carry.

Brain plus harness equals an agent

Watch it work. The model picks one step, the harness runs it with the hands or through the cabling, and the result comes back and gets remembered. Then the model picks the next step, until the goal is met.

The LLM is the brain, and the harness is everything around it: the hands, the cabling, and the notebook. Without a harness you have a chatbot. With one, you have an agent.

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.

1. Send the conversation to the model2. Read what comes back3. Tool call asked? Run it, append the result4. Stop? Task done, an error, or a turn limitnot finished: go round again

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

The agent is the whole system: model plus harness plus tools, doing a task. What an agent does, and how it differs from a chatbot or a fixed workflow, is covered on the AI agent page. The harness is the part this page is about: 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.

Harnessthe orchestratorLLMthe brain · text in, text outCommandsthe handslocal toolsMCPthe cablingexternal servicesMemorythe notebooktrims contextroutes every step, loops until the goal is metbrain + harness = agent

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.