What is Harness Engineering

The discipline of designing everything that wraps a raw LLM into a reliable agent — tool contracts, system prompt architecture, context/memory management, permission gates, and feedback loops. Distinct from prompt engineering and model training.

Updated August 9, 2026 · §202608011200 ·

Harness engineering is the discipline of designing the system that wraps a raw LLM so it behaves as a dependable, steerable agent — the tool-calling loop, system prompt architecture, context and memory management, permission gates, sandboxing, sub-agent orchestration, and the feedback loops that catch drift. The model supplies reasoning; the harness turns that reasoning into software you can actually run in production.

It’s a distinct layer from two things it’s often confused with:

Not the same as:
  • Prompt engineering — optimizing the text of a single instruction or few-shot example.
  • Model training / fine-tuning — optimizing the weights themselves.
Harness engineering optimizes everything around the model: what it's allowed to touch, what it can see, what stops it when it's wrong.

The components of a harness

ComponentWhat it doesFailure mode if missing
Tool contractsTyped schemas for every action the agent can take (file edit, shell exec, API call)Agent invents arguments, calls undefined tools, silent no-ops
System prompt architectureDurable behavior rules layered over per-turn instructionsInstructions drift or get overridden turn to turn
Context/memory managementCompaction, retrieval, summarization once the window fillsSilent context loss, contradictory actions after compaction
Permission modelApprove/deny gates scoped to blast radius (read vs. destructive)Irreversible actions (force-push, rm -rf, prod writes) run unsupervised
Sandboxing / execution environmentIsolates what a tool call can actually reachA shell tool becomes a full RCE surface
OrchestrationSub-agent spawning, parallel fan-out, workflow sequencingMonolithic context window, no separation of concerns
Feedback loopsHooks, telemetry, evals, guardrails that catch bad behaviorRegressions ship silently; no signal until a user complains
Concrete example: this session is a harness

The Claude Code session you’re reading this in is a harness around an LLM: typed tool schemas (Bash, Edit, Read, Agent, Workflow), a layered system prompt (global CLAUDE.md → project CLAUDE.md → session context), a permission-mode gate on risky tool calls, hooks for pre/post tool-call behavior, a memory system for cross-session state, and sub-agent orchestration via the Agent and Workflow tools. None of that is the model — it’s the engineering that makes the model trustworthy enough to run git commit on your behalf.


Why it’s its own discipline

Harness engineering brings systems-design rigor to a layer that’s often treated as an afterthought bolted onto a prompt:

  • Reliability framing — the harness needs the same posture as any distributed system: failure modes enumerated, blast radius bounded, degraded modes defined. A tool call without a permission gate is the agentic equivalent of an ungated destructive API endpoint.
  • Observability framing — every tool call, every context compaction, every sub-agent spawn is an event worth being able to trace and audit after the fact, the same way a request is traced through a distributed system.
  • Guardrails as circuit breakers — an evaluator that halts a bad agent loop plays the same role a circuit breaker plays in a service mesh: fail fast, contain the blast radius, don’t let one bad decision cascade.

This is why What is Google ADK, What is CrewAI, What is Hermes Agent, and What is OpenClaw are all, underneath their differing APIs, competing answers to the same harness design questions: how is memory scoped, how are tools sandboxed, how does orchestration compose. Comparing them productively means comparing harness decisions, not comparing prompts.

Where this shows up in practice

  • The Build an AI SRE Assistant hands-on build (Part 00) is a harness engineering exercise in miniature: the tool layer wiring to Grafana/Loki/Tempo, the approval checkpoints before remediation, and the RCA-confidence scoring are harness decisions, not prompt decisions — see also Production-Ready Agent Design (Part 00 of Building & Evaluating Agents) for the checklist this generalizes into.
  • MCP servers like What is MCP Toolbox and What is Grafana MCP are harness inputs — they define the tool contract surface an agent can be granted, with their own permission scoping (OAuth2, RBAC) layered underneath.

The practical takeaway: when an agent misbehaves, the fix is rarely “reword the prompt.” It’s almost always a harness gap — a missing tool contract, an ungated destructive action, or a context window that silently dropped the constraint that mattered.

Local graph

Full graph →