Accessing the best model is no longer enough to get a reliable AI agent: the difference lies in what surrounds it. This environment is called the harness, and it is tuned like a product. You will learn which levers to pull, in what order, and which limits to set before handing autonomy to an agent.
AI agent harness: everything around the model
The harness is the software layer that makes a language model work as an agent. Simon Willison describes it as software that acts as a "harness" for an LLM: it adds capabilities to the model through invisible prompts and callable tools. A tool is a function that the harness makes available to the model. The harness spots the tool call in the response, executes it, then sends the result back to the model. This is the "LLM + system prompt + tools" loop.
This notion extends two stages you already know. Prompt engineering was used to steer responses. Context engineering added custom instructions, memory, connectors, and MCP servers. Harness engineering goes further: it organizes the complete orchestration around the agent and decides what it can or cannot do.
An automotive analogy helps place the roles. The LLM is the engine. The harness covers the wheels, the seats, the dashboard, that is, everything you can customize around the engine.
Gabriel Chua (OpenAI) sums up Codex with a formula: model + harness + surfaces. The model and the harness form the agent, and the surfaces are the interfaces used to access it.
The model and the harness are not two sealed layers
According to Gabriel Chua, Codex models are trained with the harness present: tool use, execution loops, compaction, iterative verification. The "engine + bodywork" picture is therefore a useful simplification, not a strict separation. The Codex harness is also open source (openai/codex repository).
If you approach agents from a development angle, our analysis Vibe Coding vs agentic engineering shows why these foundations matter. For the broader picture, see our complete framework for understanding agentic AI.
Three harness levels: from closed product to in-house harness
The level of customization depends on the product you choose. The higher you go, the more control you have over each piece, and the more responsibility you bear.
| Level | Examples | What you can configure | Suitable profile |
|---|---|---|---|
| 1. Product harness | Agentic modes of ChatGPT and Claude (Cowork) | Connect tools and modify some elements, without customizing everything | Advanced users, business teams |
| 2. Advanced agent harness | Claude Code, Codex | Many more settings: instructions, skills, tools, automations | Experts who optimize every detail |
| 3. Custom harness | Your favorite model (LLM or open source) and your own components | Every piece | Technical teams who want a 100% custom solution |
This article focuses on levels 1 and 2. They cover most needs without developing your own orchestration.
First lever: context
Context covers the instructions, knowledge, and data accessible to the agent. It is the most profitable lever to work on first. It breaks down into four blocks.
- Instructions: system instructions are built into the product and cannot be changed. You work on the custom instruction files: CLAUDE.md on the Claude side, AGENTS.md on the OpenAI side. The agent reads them first to guide its responses.
- Knowledge: profile metadata (name, location), native memory, and memory that you add.
- Skills: a skill contains instructions for a task, possibly references (documents), assets (logos, templates), and executable scripts.
- External data: a local folder, a database, anything the model does not know.
Skills rely on progressive disclosure. The agent initially sees only the name and description of each skill, and activates it only if it judges it relevant. The harness thus orchestrates calling the right knowledge at the right time, without saturating the context window.
This mechanism is gaining ground. Simon Willison notes that most coding agent tools are adopting it quickly, and that projects such as Remotion, Supabase, Vercel, and Prisma are publishing official skills to help agents use their tools.
Scenario: an operations manager in Europe
Take the operations manager of a transport platform who oversees drivers and rides in several countries. Their context harness can be assembled in four steps:
- Create a dedicated project.
- Write an AGENTS.md file that describes their role, scope, and responsibilities.
- Place the useful data in the folder: Excel workbooks, activity reviews, presentation templates, demand analyses by city.
- Turn the driver registration form template into a skill, so that the agent generates it for each new application.
The agent then has instructions, business knowledge, a bounded data scope, and a reproducible working method. Check this scope by asking it to list the data it has access to: it should cite only what you have placed there.
Second lever: tools, or what the agent can do
Context provides knowledge. Tools give actions on external applications. You plug them in through connectors and MCP servers: email, Notion, CRM, search engine.
Three families of tools coexist:
- Connectors and MCP servers: in ChatGPT, you add them through plugins, or through the MCP section for a server that is not in the catalog.
- Tools via skills: a command script lets you drive an application that has neither a connector nor an MCP server and exposes only an API.
- Embedded tools: computer use gives the agent control of your workstation, and browser extensions let it act in Chrome.
In our scenario, the Gmail connector lets the agent read a driver's request. A web search MCP server feeds the demand analysis. Computer use finally enters assignments into a web application that has no usable API: the agent opens the browser and enters the values itself.
Too much access is the leading cause of drift
A harness is as much about allowing as about forbidding. Define the rights of each tool. On secrets, Simon Willison recommends that credentials visible to a coding agent (AWS keys, for example) be tied to non-production accounts with strict spending caps. He adds that the harness should handle authentication without ever revealing the key to the agent. Pasting an API key into a conversation goes against this principle: prefer the connector's native configuration and revoke any exposed key.
To see how a vendor structures this harness on the platform side, read our article on Copilot Studio agents and their new harness.
Third lever: automations
An automation triggers the agent without human intervention. Two mechanisms exist, and they are distinguished by their trigger.
| Mechanism | Trigger | Example | What it uses |
|---|---|---|---|
| Scheduled task (loop) | A moment in the calendar | Every Monday at 9 a.m. Paris time, analyze demand around a major event | Search MCP server, reporting instructions |
| Hook | A specific event | Receipt of a driver email, creation of a CRM contact, arrival of an invoice | Gmail, CRM, registration form skill |
Automations only work if the first two levers are in place. The hook in our scenario reads the driver's email in Gmail, retrieves their information from HubSpot, generates the form with the skill, and prepares the reply. Each step relies on a level 2 tool and on level 1 knowledge.
The scheduled task was tested with a single run before being activated. It produced forecasts by zone and by period, with three scenarios: low, central, and high. Adopt this reflex: always launch a manual run before letting an automation run on its own.
Bonus lever: evaluations and continuous optimization
Without evaluation, a human rereads every deliverable and alone judges whether the agent has too much access or whether it can work autonomously. With evaluations, the agent first checks its own output, corrects it, then resubmits it until the result is satisfactory. The human only does a final check.
The agent can also assess its own access, flag a risk, or request additional resources. A continuous improvement skill called auto-research goes in this direction: it lets the agent self-evaluate continuously to improve quality.
This self-evaluation does not replace final human control. It reduces the number of back-and-forths, not the responsibility of the person who approves.
Measure the cache hit rate
Simon Willison reports that the Claude Code team builds its entire harness around prompt caching. It monitors the cache hit rate and declares incidents (SEV) when it is too low, because caching reduces costs and allows more generous usage limits. If you build your own harness, keep a stable context from one request to the next to benefit from it.
Frequently asked questions
What is a harness for an AI agent?
It is the software that surrounds a language model to turn it into an agent: invisible system prompt, callable tools, execution loop. It determines what the agent knows, what it can do, and what it is not allowed to do.
Should you change the model or optimize the harness?
Start with the harness: context, tools, automations, and evaluations are levers you can control immediately. Changing the model remains relevant, but only after checking that the agent's context and access are correct. Keep in mind that some models are trained with their harness, as Gabriel Chua explains for Codex.
How do you limit the risks tied to an agent's credentials?
Follow Simon Willison's recommendation: tie the credentials visible to the agent to non-production accounts with strict spending caps. Let the harness handle authentication without ever revealing the key to the agent.
Where to start: build a first harness in four actions
Start from the agent, not from the scenario. Ask yourself what your agent must know, be able to do, and trigger on its own, then look for what it lacks. This stance, which consists of putting yourself in the agent's place to understand its limits and adapt its environment, directly improves the quality of deliverables.
Actions to launch in this order
- Write an instruction file (AGENTS.md or CLAUDE.md) that describes your role, your scope, and your rules.
- Limit accessible data to the working folder, then ask the agent to list it to check.
- Turn a repetitive task into a skill, with its template and references.
- Plug in one tool at a time, with minimal rights and no key pasted into the conversation.
- Test each automation with a manual run before activating it.
- Add a self-evaluation step, keeping a final human validation.
If your organization is starting out with agents, stay at level 1 or 2 and invest in context and skills. If you have a technical team and strong control requirements, consider a custom harness, starting with the open source Codex harness.
Going further
- How coding agents work, Agentic Engineering Patterns (Simon Willison): the LLM + tools + system prompt loop that makes up the harness.
- How I think about Codex (Simon Willison, quoting Gabriel Chua): the model, harness, surfaces breakdown, and training the model with its harness.
- Simon Willison's posts on AI agents: field feedback on harness design, including prompt caching.
- Copilot Studio August 2026: GitHub Copilot harness in GA: the harness seen from the Microsoft side and its new agent capabilities.



