Agent harness
Definition
The software around a model that turns it into an agent: the loop, tools, prompts, context management, permissions and limits.
In more detail
The same model can perform very differently in different harnesses, because the harness decides what the model sees and what it can do. Claude Code, Codex, OpenHands and Cursor's agent are harnesses; so is the loop you write with an agent SDK.
A harness handles calling the model, running requested tools, adding results to the context, compacting or clearing old content, loading instruction files and skills, asking for approval and stopping at limits. When an agent misbehaves, the fix is often in the harness (a clearer tool description, a tighter limit, a better summary) rather than in the prompt.
Related terms
Agent
A system where a model decides which actions or tools to use, in a loop, until a goal or stop condition is met, rather than following fixed steps.
Agent loop
The repeating cycle of model call, tool call, observation and next decision that drives an agent until the task is done or a limit is hit.
Agent memory
Information an agent keeps beyond a single context window, such as user preferences, past decisions or task notes, and retrieves when needed.
Compaction
Summarising earlier parts of a long conversation and replacing them with the summary to free context space for the work still to do.
Context engineering
Deciding what information, tools and history a model sees at each step, and what to leave out, to get the result you want.
Read more about Agent harness
- Harness engineering: why the setup around a coding agent matters as much as the model
Harness engineering is designing the instructions, tests, limits and feedback loops a coding agent works in: what OpenAI reported, the critique, where to start.
- What is an AI agent? A plain explanation
An AI agent is a language model that uses tools in a loop until a task is done. What that means in practice, what agents are good at and where they go wrong.
- AI agents
Building systems where models plan and call tools in a loop to complete tasks.
- Build your first agent in Python
Three tools, a hard turn limit, a clear stop condition and a log of every tool call it makes.