--- title: "Harness Engineering: What It Is, Parts and Security Risks" url: https://playciso.com/blog/harness-engineering-ai-agents-explained updated: 2026-11-30 section: Blog publisher: PlayCISO --- # Harness Engineering: What It Is, Parts and Security Risks > Harness engineering explained: what an AI agent harness is, its parts, who uses the term, and why security leaders should treat it as a boundary. Source: https://playciso.com/blog/harness-engineering-ai-agents-explained · Published: 2026-11-30 · Publisher: PlayCISO (https://playciso.com) --- **Harness engineering** is the work of building everything around an AI model that makes it behave as a dependable agent: the instructions it reads, the tools and permissions it has, how its context and memory are managed, the sandbox it runs in, and the feedback loops that check its work. LangChain's shorthand is **agent = model + harness**. For a security leader the useful fact is where the risk sits: the harness holds the permissions, the credentials and the places an attacker can steer the agent. This guide defines the term, lists what a harness contains, and shows where the security risks are. **Who this is for:** CISOs, AI-security and AppSec engineers, and platform teams rolling out coding agents or building their own. *Every claim is attributed to a primary source we opened on 30 November 2026. PlayCISO is not affiliated with any company named. Items marked "our analysis" are our own reasoning.* Confirmed vs not settled **Sourced:** the definitions below (OpenAI, LangChain, Thoughtworks), the harness parts the sources list, two GitHub advisories for a coding-agent harness, and a November 2026 preprint and a vendor opinion that both say to treat the harness as a boundary. **Not settled:** who coined the term (no source we opened says), and how large the security effect of harness choice is: the evidence is a preprint and a vendor study, not an independent benchmark. ## What harness engineering means The term has two uses in the sources, and they fit together. - OpenAI titled a February 2026 post about its Codex work ["Harness engineering: leveraging Codex in an agent-first world"](https://openai.com/index/harness-engineering/). The job, as the post frames it, is designing environments, specifying intent and building feedback loops so agents do reliable work. - Mitchell Hashimoto uses ["Engineer the Harness"](https://mitchellh.com/writing/my-ai-adoption-journey) as a step in his AI adoption story: whenever an agent makes a mistake, fix it at the source so it does not repeat it, with a line in an instructions file or a small scripted tool. - LangChain gives the definition most people quote: the [harness is every piece of code, configuration and execution logic that is not the model itself](https://www.langchain.com/blog/the-anatomy-of-an-agent-harness). A model becomes an agent when a harness adds state, tool execution, feedback loops and enforceable constraints. - Thoughtworks' Birgitta Böckeler, writing on martinfowler.com, calls [harness a shorthand for everything in an AI agent except the model](https://martinfowler.com/articles/harness-engineering.html) and, for coding agents, separates the vendor's built-in harness from the user's outer harness (your rules, hooks and checks). **Who coined it?** No source we opened settles it. OpenAI's post carries the term in its title; Hashimoto's page shows no date; and Böckeler's [February 2026 memo](https://www.martinfowler.com/articles/exploring-gen-ai/harness-engineering-memo.html) calls the term about two weeks old and only suggests that one may have inspired the other. **Context engineering vs harness engineering.** Context engineering is about what goes into the model's context window on each call. Harness engineering is wider: it also covers tools and permissions, sandboxing, feedback loops, evaluation and the code that runs the loop. Context management is one component of a harness. ## What a harness contains | Part | What it does | Source | | --- | --- | --- | | Instructions and knowledge files | OpenAI keeps a roughly 100-line AGENTS.md as a map into a structured docs directory; Hashimoto bases each line on a real bad behaviour. | OpenAI | | System prompt, tools, skills, MCP servers | LangChain lists these with bundled infrastructure (filesystem, sandbox, browser), orchestration (sub-agents, handoffs, model routing) and hooks (compaction, continuation, lint checks). | LangChain | | Guides and sensors | Guides steer before the agent acts; sensors observe after and let it self-correct. Each can be computational (linters, tests) or inferential (AI review). | Böckeler | | Mechanical enforcement | OpenAI describes custom linters, structural tests and CI jobs that enforce a layered architecture. | OpenAI | | Plans, progress files, handover notes | Anthropic uses a progress file, an init script and git history so a fresh context window can pick up the work; a feature list the agent may change only by marking passes. | Anthropic | | Evaluators and sub-agents | Anthropic describes planner, generator and evaluator agents and the choice between context resets and compaction. | Anthropic | | Sandboxing | Filesystem isolation limits where the agent can read and write; network isolation sends traffic through a proxy that restricts domains. Anthropic says both are needed. | Anthropic | | Enforcement outside the model | Red Hat argues permissions, identity, isolation and budgets must hold even when the model is wrong, with gateway-enforced tool authorisation. | Red Hat | ## Why the harness is the security boundary A model on its own can only produce text. The harness is what lets it read files, run commands, call APIs and remember things, so the harness decides what a hijacked or mistaken agent can do. Three lines of evidence point the same way: - Research. The ["Harness Matters" preprint](https://arxiv.org/abs/2611.11971) (Wu et al., November 2026) reports that across web-agent harnesses some unsafe behaviour happens without any explicit attack content, that both the harness and the model affect security, and that the harness should be treated as a security boundary. It is a preprint, not peer reviewed. - Vendor studies. Manifold Security's [agent behaviour study](https://www.manifold.security/reportsandwhitepapers/the-agent-behavior-index) tested coding-agent harnesses side by side and says harness choice changed outcomes, including how often payloads that git or the harness ran automatically took effect. It is a vendor study with stated limits. - Real flaws. GitHub published two advisories for the Copilot CLI harness: [CVE-2026-29783](https://osv.dev/vulnerability/GHSA-g8r9-g2v8-jv6f) (crafted shell parameter expansion could run commands classified as read-only, bypassing approval prompts, fixed in 0.0.423) and [CVE-2026-45033](https://osv.dev/vulnerability/GHSA-9ccr-r5hg-74gf) (a nested malicious bare git repository could run commands through core.fsmonitor during routine git operations without approval, fixed in 1.0.43). Neither advisory states exploitation in the wild. The [OWASP Top 10 for Agentic Applications](https://genai.owasp.org/2025/12/09/owasp-top-10-for-agentic-applications-the-benchmark-for-agentic-security-in-the-age-of-autonomous-ai/) (9 December 2025) names ten risks: agent goal hijack, tool misuse, identity and privilege abuse, agentic supply chain vulnerabilities, unexpected code execution, memory and context poisoning, insecure inter-agent communication, cascading failures, human-agent trust exploitation and rogue agents. *Our analysis:* nearly all of them are decided by harness design: which tools are allowed, how credentials are scoped, what the agent remembers and who approves what. A sandbox helps but is not a guarantee. Anthropic says Claude Code sandboxing needs both filesystem and network isolation and reports it cut permission prompts by 84% in its own use. In July 2026 OpenAI [reported](https://openai.com/index/hugging-face-model-evaluation-security-incident) that its models, running an internal cyber benchmark with production safeguards deliberately off, exploited a flaw in a package proxy to leave a sandbox. The lesson is defence in depth, not trust in one layer. ## Harnesses that improve themselves Google Cloud AI Research's [Harness²](https://arxiv.org/abs/2610.14224) paper describes recursive self-improvement of the harness itself. The paper's abstract makes no security claims; the governance risks in our [Harness² analysis](/blog/harness2-self-improving-agents-security-governance) are our own. A harness that edits itself needs change control like any other privileged code. Practise that decision in the [recursive harness change control lab](/tools/recursive-harness-change-control-lab). ## What security leaders should do this week - Inventory your harnesses. List every coding agent and in-house agent, who runs it, what tools and credentials it has and which instruction files it reads. - Treat instruction files as code. Review changes to AGENTS.md and similar files, and be wary of ones that arrive with a repository the agent opens. See [AI coding agent config malware](/blog/ai-coding-agent-config-malware-bitdefender). - Enforce limits outside the model. Permissions, isolation, budgets and approvals belong in the harness and the platform, not in a prompt. The [12-control checklist](/blog/secure-ai-agent-harness-controls) gives an order. - Patch the harness. Track advisories for the agents you run as you do for any developer tool. - Practise. Work through the [agent harness attack surface lab](/tools/agent-harness-attack-surface-lab) and design one in the [Harness Designer](/tools/harness-designer). ## Frequently asked questions ### What is harness engineering? Designing everything around an AI model that makes it work as a dependable agent. OpenAI's February 2026 post on Codex describes the job as designing environments, specifying intent and building feedback loops so agents do reliable work. Mitchell Hashimoto uses "engineer the harness" to mean fixing each agent mistake at the source so it does not repeat, for example with a line in an instructions file or a scripted tool. ### What is an agent harness? LangChain defines it as every piece of code, configuration and execution logic that is not the model itself. LangChain's shorthand is "agent = model + harness": a raw model becomes an agent when a harness adds state, tool execution, feedback loops and enforceable constraints. ### Who coined the term harness engineering? No source we opened settles it. OpenAI titled its 11 February 2026 post with the term; Hashimoto used "Engineer the Harness" in an earlier-looking post (his page shows no date, and secondary write-ups say 5 February 2026); Birgitta Böckeler of Thoughtworks wrote on 17 February that the term was about two weeks old and only suggested one may have inspired the other. We say "popularised by OpenAI's post" and leave it there. ### What is the difference between a guide and a sensor in a harness? Böckeler splits harness controls into guides, which steer the agent before it acts (instructions, rules, examples), and sensors, which observe after it acts so it can correct itself. Each can be computational (linters, tests, type checkers) or inferential (an AI reviewer or LLM judge). ### What goes in an AGENTS.md file? OpenAI says it keeps a short AGENTS.md of about 100 lines that works as a map into deeper documents. Hashimoto says each line should come from a real bad behaviour of the agent. Treat the file as part of your attack surface: it is instructions the agent obeys. ### How do long-running agents keep context between sessions? Anthropic describes a progress file, an initialisation script and git history that let a fresh session learn the state of the work quickly, plus a feature list the agent may not weaken by editing tests. ### Is the agent harness a security boundary? A November 2026 preprint, "Harness Matters" (Wu et al.), says it should be treated as one: across web-agent harnesses it reports unsafe behaviour that occurs without explicit attack content, and finds that both the harness and the model affect security. Red Hat argues permissions, identity, isolation and budgets must be enforced outside the model. The preprint is not peer reviewed and Red Hat's piece is vendor opinion. ### What is the difference between harness engineering and context engineering? Context engineering is about what goes into the model's context window on each call. Harness engineering is wider: it also covers tools and permissions, sandboxing, feedback loops, evaluation, memory and the code that runs the loop. Context management is one part of a harness. ## Sources - [OpenAI: Harness engineering: leveraging Codex in an agent-first world](https://openai.com/index/harness-engineering/) (11 February 2026) - [Mitchell Hashimoto: My AI Adoption Journey](https://mitchellh.com/writing/my-ai-adoption-journey) (date not shown on the page) - [LangChain: The anatomy of an agent harness](https://www.langchain.com/blog/the-anatomy-of-an-agent-harness) (10 March 2026) - [Böckeler: Harness engineering for coding agent users, martinfowler.com](https://martinfowler.com/articles/harness-engineering.html) (2 April 2026) and [her first-thoughts memo](https://www.martinfowler.com/articles/exploring-gen-ai/harness-engineering-memo.html) (17 February 2026) - [Anthropic: Effective harnesses for long-running agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents) (26 November 2025) and [Harness design for long-running apps](https://www.anthropic.com/engineering/harness-design-long-running-apps) (24 March 2026) - [Anthropic: Making Claude Code more secure and autonomous with sandboxing](https://www.anthropic.com/engineering/claude-code-sandboxing) (20 October 2025) - [OWASP Top 10 for Agentic Applications](https://genai.owasp.org/2025/12/09/owasp-top-10-for-agentic-applications-the-benchmark-for-agentic-security-in-the-age-of-autonomous-ai/) (9 December 2025) - [Harness Matters, arXiv 2611.11971](https://arxiv.org/abs/2611.11971) (9 November 2026, preprint) and [Red Hat Developer: agent harness engineering](https://developers.redhat.com/articles/2026/11/12/agent-harness-engineering-separating-model-capabilities-enforcement) (12 November 2026, vendor opinion) - [Manifold Security: The Agent Behavior Index](https://www.manifold.security/reportsandwhitepapers/the-agent-behavior-index) (24 November 2026, vendor study) and [OpenAI: Hugging Face model evaluation security incident](https://openai.com/index/hugging-face-model-evaluation-security-incident) (21 July 2026) - [GHSA-g8r9-g2v8-jv6f](https://osv.dev/vulnerability/GHSA-g8r9-g2v8-jv6f) and [GHSA-9ccr-r5hg-74gf](https://osv.dev/vulnerability/GHSA-9ccr-r5hg-74gf) (GitHub advisories for Copilot CLI) and [Harness², arXiv 2610.14224](https://arxiv.org/abs/2610.14224) *This article is educational guidance for security leaders. Findings and definitions are the named sources'; check them for updates.*