ArticleslgStudy

computer science

Agent harness

Agent harness is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Agent harness rather than just read about it. In short: An agent harness, also known as agent scaffolding, is the software infrastructure surrounding a large language model (LLM) that enables it to operate as an AI agent. It manages tool use, prompts, memory, state persistence, permissions, error handling, execution environments and feedback loops, as opposed to the model's internal reasoning.

Agent harness — main illustration
Agent harness — illustration

Key takeaways

  • Agent harness belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Agent harness to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Agent harness from memory before moving on to harder problems.

Reference excerpt

An agent harness, also known as agent scaffolding, is the software infrastructure surrounding a large language model (LLM) that enables it to operate as an AI agent. It manages tool use, prompts, memory, state persistence, permissions, error handling, execution environments and feedback loops, as opposed to the model's internal reasoning. In 2023, the UK's AI Security Institute described an AI agent as being formed by the model plus the scaffolding. The relationship can be expressed as agent = model + harness. The term came into common use in 2026 to describe middleware between an AI agent and its output, though defining exactly what is and isn't a harness can be difficult. The harness can help with understanding otherwise opaque models by seeing how they behave so that AI safety can be improved. Because a "base model" LLM is a stateless probabilistic function that maps input token sequences to output token sequences, the harness is what makes an agent out of a model, i.e. a thing that interfaces with external tools, inputs and outputs non-token data (such as images), and interacts with a task-environment coherently over many rounds. Rather than repeatedly re-reading an ever-growing transcript inside the context window, a harness can offload record-keeping into a structured software environment that manages the agent's state. A minimal harness is unnecessary for a single prompt-and-response exchange, but becomes more useful as tasks grow multi-step, tool-oriented, or long-running. Popular agent harnesses are focused on AI-assisted software development, including Anthropic's Claude Code, OpenAI's Codex, Google DeepMind's Antigravity, AWS's open-source Strands, OpenCode, Microsoft's MDASH, DeepSeek Harness, Cursor, and oh-my-pi.

Architecture Components commonly grouped under a harness include tool dispatch, memory and state persistence, an isolated sandbox or workspace, context management, and guardrails such as scoped permissions, approval tiers and monitoring. In a 2026 engineering write-up, Anthropic described a worked example built from an initialiser agent that prepares the environment and a coding agent that repeatedly selects the next unfinished task, commits, and updates a progress record before stopping. Birgitta Böckeler of Thoughtworks distinguishes an inner harness shipped by the model's builder (for example, an agent SDK or a coding tool, such as Cursor or Codex or Claude Code) from an outer harness that the user assembles on top, such as instruction files, Model Context Protocol servers, and custom skills. She further separates guides, which steer the agent before it acts, from sensors, which observe the result and let the agent self-correct; each may be computational (deterministic checks such as linters or tests) or inferential (semantic checks such as an "LLM as judge"). Agent harnesses use CPUs not GPUs.

History and terminology The term came into common use in 2026 to describe middleware between an AI agent and its output, though defining exactly what is and isn't a harness can be difficult. By mid-2026 the harness had become an object of academic study. Independent reporting described research such as Self-Harness, in which an agent iteratively mines its own failures to propose and validate changes to its harness, and Harness-1, an open-source search agent that improved retrieval accuracy chiefly by redesigning the software environment around the model rather than by enlarging the model.

Relationship to prompt and context engineering Harness engineering is often positioned as a broader layer than prompt engineering, which optimises a single interaction, or context engineering, which governs what information the model sees at a given moment; in this framing the harness designs the whole operational environment and contains the other two as parts. A distinguishing feature is that the component being wrapped is non-deterministic, so a harness is designed to recover gracefully when the model fabricates an action or reports a task as finished when it is not.

See also AI agent List of large language models Model Context Protocol Prompt engineering Reinforcement learning Software agent Test harness

References

Illustrations

Agent harness: OpenAI Codex agentic harness working under the hood with the Tauri (software framework) DOM Inspector
OpenAI Codex agentic harness working under the hood with the Tauri (software framework) DOM Inspector

Worked examples

Example 1 — a first encounter with Agent harness

Start with the simplest possible case. Write down what Agent harness claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Agent harness before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Agent harness ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Agent harness

In research
Agent harness appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Agent harness in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Agent harness is common in secondary-school and first-year university syllabi. It links to neighbouring topics Application software suites, Artificial intelligence, Large language models, so understanding it makes those chapters shorter.
In everyday life
Look for Agent harness outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Agent harness” →

How to study Agent harness in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Agent harness means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Agent harness out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Agent harness in simple terms?

An agent harness, also known as agent scaffolding, is the software infrastructure surrounding a large language model (LLM) that enables it to operate as an AI agent. It manages tool use, prompts, memory, state persistence, permissions, error handling, execution environments and feedback loops, as o…

Why does Agent harness matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Agent harness?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Agent harness.

Tags

  • Application software suites
  • Artificial intelligence
  • Large language models

Keep exploring