
What an AI harness actually is (and why it matters more than the model)
AI models can't do anything on their own. Here's how harnesses turn them into agents that browse, code, and take action safely.
Ask ChatGPT to book you a flight and it will happily write you an email, a checklist, even fake confirmation numbers. What it won't do is actually buy the ticket. That's not a limitation of the model's intelligence — it's a limitation of what the model is allowed to touch. A raw language model can only read text and write text back. It can't click a button, run a script, or remember what happened yesterday. Everything you see AI agents doing in the wild — closing deals, writing code, searching the web, managing your calendar — is happening because something else is standing between the model and the real world, translating its words into actions.
That "something else" is called a harness, and understanding it is the difference between using AI like a toy and using it like infrastructure.
What is an AI harness, exactly?
An AI harness is the software layer wrapped around a language model that gives it the ability to actually do things. A large language model on its own can only do one thing: take text in and give text out. It can't run code, read your files, remember yesterday's session, or check whether its answer is correct. An AI agent harness is the software that gives it those abilities. It wraps the model, calls it in a loop, runs the tools it asks for, feeds the results back, and decides when the work is done.
There's a simple formula worth memorizing: Agent = Model + Harness. When you're chatting inside Claude Code or Cursor, you're not talking directly to the model. You're talking to a harness that manages the model for you.
Microsoft's own engineering docs describe it almost identically: an agent harness, sometimes called an AI harness, is the runtime scaffolding that turns a language model into an agent that can perform work. It drives model and tool calls, manages conversation state and context, applies approval policies, and can keep the agent progressing through a multistep task. Salesforce frames it the same way from a business angle: an agent harness is the software infrastructure that wraps around an AI model to manage its lifecycle, context, and interactions with the outside world. It is not the "brain" that does the thinking; instead, it is the environment that provides the brain with the tools, memories, and safety limits it needs to function.
What's actually inside a production harness?
A real-world harness isn't one feature — it's a stack of them working together. According to a detailed breakdown from MLJar, real harnesses add a lot around the basic loop, including an agent loop that calls the model and parses tool calls, a set of tools like shell access and file editing, context management that trims old messages, memory that persists across sessions, permissions and sandboxing that decide what the agent can run without asking, and error handling that retries bad output and verifies "I'm done" claims.
Think of it like the human nervous system. You don't just have a thinking brain floating in a jar — you have a brainstem regulating your heartbeat, a cerebellum handling balance, and reflexes that fire before conscious thought even kicks in. The language model is the frontal cortex: the part that reasons and plans. The harness is everything else — the plumbing that turns a thought into a physical action in the world.
Why do permissions matter so much?
This is the part most people skip past, and it's the part that actually keeps you safe. Permissions are the stop conditions that prevent a model from doing things you don't want it to do — the reins on the horse, so to speak. Without them, an agent with access to your terminal could delete files, push broken code to production, or leak API keys, all while "trying to be helpful."
Claude Code's permissions documentation lays out exactly how this works in practice. Claude Code supports fine-grained permissions so that you can specify exactly what the agent is allowed to do and what it can't. You can check permission settings into version control to share them with every developer in your organization, and each developer can customize their own.
The permission system is tiered by risk level. Read-only actions like file reads and Grep require no approval within the working directory, Bash commands require approval except for a built-in set of read-only commands, file modification like editing or writing requires approval, and web fetch and web search require approval except for pre-approved documentation domains.
Critically, this enforcement doesn't live inside the model's head — it lives in the harness. Permission rules are enforced by Claude Code, not by the model. Instructions in your prompt or CLAUDE.md shape what Claude tries to do, but they don't change what Claude Code allows. That distinction matters enormously. You can't just ask a model nicely not to do something dangerous — you have to build a wall it physically can't walk through.
How do allow, deny, and ask rules work together?
Most harnesses use a three-tier rule system. A detailed guide to Claude Code permissions explains it cleanly: a deny rule blocks a matching call for a path, command, or tool Claude must not use; an ask rule requires confirmation for a consequential action needing a human decision; and an allow rule runs without a prompt for a narrow, reviewed repeat action.
The order these get checked in matters too. Rules are evaluated deny first, then ask, then allow, and the first match wins. A deny rule blocks the call even if a broader allow rule would have matched it. That's a deliberate design choice — in a system where mistakes can be expensive, the safest rule should always win the argument.
A practical settings file might look like this:
{
"permissions": {
"allow": ["Bash(npm run lint)", "Bash(npm test *)", "Edit(/src/**)"],
"deny": ["Read(/.env)", "Read(/secrets/**)"],
"ask": ["Bash(git push *)"]
}
}
That configuration lets an agent run tests and lint code freely, blocks it from ever reading your secrets file, and forces a human to approve anything that pushes code live. That's the harness doing its job — giving the model enough rope to be useful without enough rope to hang the business.
What permission modes should you actually use day to day?
Beyond individual rules, Claude Code ships with whole modes you can toggle depending on how much you trust a given task. A security breakdown from Datacamp sums up the main ones: default mode prompts on first use of each tool, acceptEdits auto-approves file edits in the working directory while still controlling shell commands, plan mode lets Claude read and analyze but not edit files or run commands — the right mode for code review or planning sessions — and dontAsk auto-denies anything not explicitly in the allow list.
In practice, that means you'd run in plan mode when you want an agent to scope out a refactor without touching anything, switch to acceptEdits once you trust the direction, and reserve full default mode for anything touching production infrastructure.
How does tool calling actually connect a model to the real world?
Permissions decide what an agent can do. Tool calling (sometimes called function calling) is the mechanism by which it actually does it. OpenAI's function calling documentation explains the core idea plainly: function calling provides a powerful and flexible way for OpenAI models to interface with external systems and access data outside their training data.
The flow looks the same across basically every major harness: you give the model a list of tools it's allowed to call, the model decides when a tool is needed and generates structured arguments for it, your code executes the actual function, and the result gets fed back into the model so it can keep reasoning. A guide on the mechanism confirms this is the standard pattern: function calling enables models to generate structured arguments for external functions, allowing them to interact with APIs, databases, and other systems.
This is also where the "dozens of times a minute" behavior comes from. Every tool call is a round trip — model proposes an action, harness checks permissions, harness executes if allowed, result gets fed back, model decides the next step. Multiply that by a long agentic task and you get a loop running continuously under the hood, invisible unless you're watching the logs.
Which tools should you actually use to build or run a harness?
You don't need to build a harness from scratch to benefit from one — most people are already using a harness disguised as a product.
- Claude Code — Anthropic's terminal-based coding agent, and the most transparent example of a harness you can configure yourself. Start with the permissions guide and the permission modes doc to set up guardrails before letting it touch a real codebase.
- OpenAI's Function Calling / Tools API — if you're building your own agent rather than using an off-the-shelf one, this is the primary mechanism for giving a GPT model the ability to call real functions and APIs.
- Cursor — an IDE with a built-in agent harness for coding, useful if you want harness-style tool use without managing a terminal.
- n8n — for people building multi-step automations that call AI models as one node in a larger workflow, n8n effectively lets you build your own lightweight harness visually.
How do you set up your first permission rules in Claude Code?
Here's the fastest path to a safe setup:
- Install Claude Code and open a project directory.
- Create a
.claude/settings.jsonfile in your project root. - Add an
allowlist for safe, repetitive actions (like running your test suite). - Add a
denylist for anything sensitive —.envfiles, secrets folders, credentials. - Add an
askrule for consequential one-way-door actions likegit pushor deployment commands. - Run
/permissionsinside a session anytime to review or adjust the active rules.
That's a working harness configuration in about ten minutes, and it's the exact pattern professional teams use to let AI agents touch real codebases without someone babysitting every keystroke.
What does this mean for how you use AI going forward?
The model is never the bottleneck anymore — the harness around it is. Two people using the exact same model can get wildly different results depending on what tools, memory, and permission rules surround it. If you're still judging AI tools by "which model is smartest," you're asking the wrong question. The better question is: what's the harness letting it do, and what's it stopping it from doing?
Start paying attention to the scaffolding, not just the brain inside it. That's where the real leverage is hiding.