The more I experiment with AI agents, the more I realise that the model is only part of the story. What sits around the model, the infrastructure that governs how it behaves, what it can do, and when it stops matters just as much. This is what harness engineering is about. An AI harness or agentic harness is the infrastructure layer wrapped around the agent.
You can treat the harness as a control mechanism that makes sure tasks are completed in a secure and observable way. The AI model will propose actions and tool calls, and the harness executes them. As part of this execution, the harness validates, authorises and checks schemas, permissions, budgets, and safety rules. At minimum, harnesses should implement at least three risk levels: read-only (autonomous), draft, and external write (requires human approval). A strong harness serves two main purposes: increasing the probability that agents produce the right output, and providing a feedback loop that self-corrects issues before a human ever sees them.

The agentic harness is made up of two main components: tools and a system prompt. Tools are functions the LLM can use to perform specific tasks such as querying a database or placing an order. The task itself is then completed by the MCP server, not by the LLM (unless the task can be executed by the model directly). A system prompt is a set of instructions that defines the AI agent’s behaviour and boundaries.
System prompts generally take two styles: directive (instructions to complete steps in a sequence) or encyclopaedic (documentation of available tools and workflows, without a fixed sequence). You can use AI, for example, the workbench in Claude Console, to help generate your system prompt. The system prompt can also be dynamic, meaning instructions change in real time based on context, user input, or external data.
Now that we know what a harness is, let’s look at the foundations of harness engineering and what they mean for those of us working with AI agents.
1. Context engineering is at the core of harness engineering
Gathering the right context is still difficult for agents, especially in new or unfamiliar environments. The harness implements context engineering strategies such as reducing context via compaction, offloading state to storage, or isolating tasks into sub-agents. By onboarding models with relevant context in the form of directory structures, available tools, problem-solving strategies, the harness helps reduce errors in planning and output.
2. The harness works through two types of control
I learned from Birgitta Böckeler and Heeki Park about the two control mechanisms that make up a good harness. Feedforward controls anticipate and steer agent behaviour before it acts. Feedback controls observe outputs and allow the agent to self-correct after the fact. You need both: feedforward alone means you encode rules but never know if they worked; feedback alone means you keep correcting the same mistakes. I’ve definitely seen examples of Claude Code trying to implement the same broken approach and going in loops until I intervened.
3. Every long-running agent needs explicit budgets
Every agent loop must have a step budget (maximum iterations), a time budget (wall-clock), a token budget (per turn and cumulative), and a cost budget. When any of these is exhausted, the harness terminates gracefully and returns a structured failure. If anything, you need a budget to avoid an gent going in loops without the desired result and burning tonnes of tokens in the process.
Main learning point: The harness is the infrastructure that keeps an AI agent reliable, safe, and steerable. Getting harness engineering right means combining good context, the right controls, and clear budgets from the outset.
Related links for further learning:
- https://medium.com/@tort_mario/ai-agent-best-practices-production-ready-harness-engineering-2026-guide-c1236d713fac
- https://heeki.medium.com/building-an-agent-harness-31942331d605
- https://www.langchain.com/blog/improving-deep-agents-with-harness-engineering
- https://blog.techforproduct.com/p/i-built-a-coding-agent-in-90-days
- https://www.philschmid.de/agent-harness-2026
- https://martinfowler.com/articles/harness-engineering.html

