Skip to content
Sajith JeewanthaSoftware Engineer

Track 11 · Specialisation

Harness Engineering

Build the scaffolding around a model that turns it into a dependable agent: the loop, tools, context management over long runs, sandboxes, permissions and guardrails, human checkpoints, and the evaluation harnesses that prove it works.

Last updated
Total effort
510 h · ≈ 51 weeks
Your progress

Overview

A model on its own only predicts text. The harness is everything around it that turns those predictions into reliable work: the agent loop that decides when to call the model and when to stop, the tools it can use and how they are described, the way context is managed over hundreds of steps, the sandbox it runs in, the permissions and hooks that keep it safe, the points where a human approves, and the test harness that measures it. Two agents built on the same model can differ hugely in quality because of their harness. Harness engineering is where software engineering, security and AI meet, and it is very close to integration work: connecting agents to real systems through well-designed interfaces such as MCP.

Why it matters heading into 2027

The term spread in early 2026. Mitchell Hashimoto described his own practice as harness engineering in February 2026, and days later OpenAI published Harness engineering: leveraging Codex in an agent-first world, describing a product built with agents writing the code while engineers designed the environment, tools and feedback loops. Anthropic's 2025 engineering posts on tool design, long-running harnesses and Claude Code sandboxing describe the same craft. Demand follows agent adoption: 66% of developers who use AI now use coding agents, and the agentic-AI skill cluster is the fastest-growing in job postings. Every company deploying agents needs engineers who can make them safe, observable and testable.

Prerequisites

  • AI Engineering Intermediate: you have built tool calling and a small RAG app.
  • Context Engineering Beginner–Intermediate: you know what goes into a context window and how it fails.
  • Comfort with Linux, processes, Docker and the shell; basic networking.
  • Basic security ideas: least privilege, untrusted input, secrets handling.

Learning path

How the stages build on each other, and where this track hands off to others.

flowchart TB
  P["Prereqs: tool calling · Docker · shell"] --> B
  subgraph B["1 · Beginner — the agent loop"]
    direction LR
    B1["loop + stop conditions"] --> B2["3–5 good tools"] --> B3["traces"]
  end
  subgraph I["2 · Intermediate — tools & context"]
    direction LR
    I1["tool design (ACI)"] --> I2["MCP servers"] --> I3["compaction · notes"]
  end
  subgraph A["3 · Advanced — safety & evaluation"]
    direction LR
    A1["sandbox"] --> A2["permissions · hooks"] --> A3["human approval"] --> A4["eval harness"]
  end
  subgraph E["4 · Expert — long-running systems"]
    direction LR
    E1["multi-session harness"] --> E2["sub-agents"] --> E3["benchmarks · observability"]
  end
  B --> I --> A --> E
  I -.-> CTX["Context Engineering"]
  A -.-> SEC["AI Security & Safety"]
  A -.-> CLOUD["Cloud: IAM · isolation"]

Stages

Tick items as you go — progress is saved in this browser only. Times are focused hours (reading + building); the week estimates follow the study time you pick above.

01Beginner70 h · ≈ 7 weeksWrite an agent loop yourself, with no framework, so you understand every step: call the model, run tools, feed results back, and stop safely.

Key concepts

Build these

Ready for the next stage when…

02Intermediate110 h · ≈ 11 weeksDesign the agent-computer interface: tools that are easy for a model to use correctly, MCP servers for real systems, and context that stays clean over many steps.

Key concepts

Build these

Ready for the next stage when…

03Advanced150 h · ≈ 15 weeksMake agents safe to run with real permissions, and build the evaluation harness that tells you whether a change helped.

Key concepts

Build these

Ready for the next stage when…

04Expert180 h · ≈ 18 weeksBuild harnesses for long-running, multi-session and multi-agent work, measured on public benchmarks and observed in production.

Key concepts

Build these

Ready for the next stage when…

Field guide

The ideas behind the checklist, with diagrams and the math where it helps.

What a harness is

Think of the model as an engine and the harness as the rest of the car: steering, brakes, dashboard and seatbelts. The same engine can be safe and useful, or dangerous and useless, depending on what you build around it.

flowchart TB
  START["task"] --> CTX["build context<br/>instructions · notes · tool list"]
  CTX --> M["model step"]
  M --> D{"tool call or done?"}
  D -- "done" --> V["verify<br/>tests · checks · grader"]
  V -- "fails" --> CTX
  V -- "passes" --> END["result + trace"]
  D -- "tool call" --> H1["pre-tool hook<br/>policy · allow-list"]
  H1 -- "blocked" --> CTX
  H1 -- "needs approval" --> HU["human approves?"]
  HU -- "no" --> CTX
  HU -- "yes" --> RUN
  H1 -- "allowed" --> RUN["run tool in sandbox"]
  RUN --> H2["post-tool hook<br/>truncate · redact · log"] --> CMP{"context too big?"}
  CMP -- "yes" --> C["compact · update notes"] --> CTX
  CMP -- "no" --> CTX

Every box outside “model step” is harness code you own. That’s where reliability comes from.

Tools are an interface for a model

SWE-agent’s key finding was that agents do much better with interfaces designed for them: a file viewer that shows 100 lines with line numbers, a search that returns a short summary, an editor that runs a linter after each edit. The same lessons appear in Anthropic’s tool-writing guide:

  • Fewer, higher-level tools. schedule_meeting beats list_users + list_events + create_event.
  • Clear names and descriptions. Write them as if for a new teammate; the description is the documentation.
  • Helpful errors. "No file at src/app.ts; did you mean src/app.tsx?" teaches the model; a stack trace doesn’t.
  • Concise outputs. Paginate, truncate and filter by default; offer a “detailed” option.
  • Evaluate the tools. Run real tasks and read the traces to see where the agent gets confused.

This is also how to think about MCP servers for integration platforms: an MCP server is an agent-computer interface. Good API design skills transfer directly.

Layers of defence

Never rely on the model to police itself. Put deterministic layers between the model and the world, so that each layer limits the damage if the one above fails.

flowchart TB
  subgraph L1["Layer 1 · Instructions"]
    direction LR
    A1["system prompt rules"] --> A2["tool descriptions with limits"]
  end
  subgraph L2["Layer 2 · Harness policy (code)"]
    direction LR
    B1["allow-lists: commands · paths · domains"] --> B2["pre/post tool hooks"] --> B3["human approval for risky actions"]
  end
  subgraph L3["Layer 3 · Sandbox"]
    direction LR
    C1["container / gVisor / microVM"] --> C2["no network by default"] --> C3["scoped work directory"]
  end
  subgraph L4["Layer 4 · Identity & cloud"]
    direction LR
    D1["short-lived scoped credentials"] --> D2["least-privilege IAM role"] --> D3["audit logs"]
  end
  L1 --> L2 --> L3 --> L4

Simon Willison’s lethal trifecta is the quickest risk check: if an agent has (1) access to private data, (2) exposure to untrusted content and (3) a way to send data out, a prompt injection can steal that data. Remove at least one of the three for any risky task.

Measuring a harness

Agents are stochastic, so one success proves little. Two metrics help:

pass@k=P(at least one of k tries succeeds)passk=P(all k tries succeed)\text{pass@}k = P(\text{at least one of } k \text{ tries succeeds}) \qquad \text{pass}^k = P(\text{all } k \text{ tries succeed})

pass@k tells you whether the agent can solve a task; pass^k (from τ-bench) tells you whether it reliably does. If each try succeeds independently with probability pp, then passk=pk\text{pass}^k = p^k. A 90%-reliable agent passes all of 5 tries only about 59% of the time. Users experience pass^k.

A good eval harness has:

  1. Reproducible environments: containers or snapshots, so every run starts from the same state.
  2. Automatic graders: unit tests, state checks, or a validated LLM judge.
  3. Cost and step tracking per task, not just success.
  4. Failure categories from reading traces: wrong tool, lost context, gave up early, unsafe action blocked.

One agent or many?

Cognition argues for single-threaded agents: when sub-agents can’t see each other’s decisions, they make conflicting choices. Anthropic’s research system shows that parallel sub-agents help on broad tasks like research, at several times the token cost. A practical rule: use sub-agents for read-only exploration that returns a summary; keep writes and decisions in one agent with one shared context.

Long-running work

For tasks that span many context windows or sessions, Anthropic’s long-running harness pattern is a good template:

  • An initialiser step sets up the environment, a feature or task list, and a progress file.
  • Each session reads progress first, works on one item, runs tests, commits, and updates the progress file before ending.
  • Clean, tested checkpoints mean the next session never inherits a broken state.

It is the same discipline a good engineer uses when handing work to a teammate, written down so an agent can follow it.

How this track connects

References

Original sources first: arXiv, official docs, university courses and lab blogs. Every link was checked on 7 Nov 2026.

Foundational & seminal papers(10)

  1. Firecracker: Lightweight Virtualization for Serverless Applications

    Agache et al. · 2020 · usenix.org

    The microVM design used by many agent sandboxes.

  2. ReAct: Synergizing Reasoning and Acting in Language Models

    Yao et al. · 2022 · arxiv.org

    The reason-act-observe loop at the heart of most harnesses.

  3. Voyager: An Open-Ended Embodied Agent with Large Language Models

    Wang et al. · 2023 · arxiv.org

    An agent that builds and reuses a skill library.

  4. MemGPT: Towards LLMs as Operating Systems

    Packer et al. · 2023 · arxiv.org

    Memory management for agents, modelled on an OS.

  5. SWE-bench: Can Language Models Resolve Real-World GitHub Issues?

    Jimenez et al. · 2023 · arxiv.org

    The reference benchmark for coding harnesses.

  6. SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering

    Yang et al. · 2024 · arxiv.org

    Shows interface and tool design drive agent performance.

  7. OpenHands: An Open Platform for AI Software Developers as Generalist Agents

    Wang et al. · 2024 · arxiv.org

    An open, inspectable coding-agent harness.

  8. τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains

    Yao et al. · 2024 · arxiv.org

    Measures reliability over repeated tries (pass^k).

  9. Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models

    Zhang et al. · 2025 · arxiv.org

    Evolving context playbooks for agents.

  10. Agentic Misalignment: How LLMs Could Be Insider Threats

    Lynch et al. · 2025 · arxiv.org

    Why harness permissions and oversight matter.

Courses & videos(1)

  1. Hugging Face AI Agents Course

    Hugging Face · 2025 · huggingface.co

    Hands-on introduction to agent loops and frameworks.

Books(1)

  1. AI Engineering: Building Applications with Foundation Models

    Chip Huyen · 2025 · oreilly.com

    The chapters on agents and evaluation are the foundation for harness work.

Articles, blogs & official docs(20)

  1. Harness engineering: leveraging Codex in an agent-first world

    Ryan Lopopolo, OpenAI · 2026 · openai.com

    The post that made the term mainstream: engineers design the environment, agents write the code.

  2. My AI Adoption Journey

    Mitchell Hashimoto · 2026 · mitchellh.com

    An early, practical description of harness engineering.

  3. Writing effective tools for AI agents

    Anthropic · 2025 · anthropic.com

    How to design, evaluate and improve agent tools.

  4. Effective harnesses for long-running agents

    Anthropic · 2025 · anthropic.com

    Initialisers, feature lists and progress files across sessions.

  5. Making Claude Code safer with sandboxing

    Anthropic · 2025 · anthropic.com

    Filesystem and network isolation for a real coding agent.

  6. How we built our multi-agent research system

    Anthropic · 2025 · anthropic.com

    Orchestrator-worker design and its costs.

  7. Don't Build Multi-Agents

    Walden Yan, Cognition · 2025 · cognition.com

    The case for single-threaded agents with shared context.

  8. Building agents with the Claude Agent SDK

    Anthropic · 2025 · claude.com

    A production harness design: gather context, act, verify.

  9. Claude Agent SDK overview

    Anthropic · code.claude.com

    The SDK reference.

  10. Claude Code: sandboxing

    Anthropic · code.claude.com

    How a production agent enforces filesystem and network limits.

  11. Claude Code: hooks

    Anthropic · code.claude.com

    Deterministic checks before and after tool calls.

  12. 12-Factor Agents

    Dex Horthy, HumanLayer · 2025 · github.com

    Principles for building production agents you control.

  13. Context Engineering for AI Agents: Lessons from Building Manus

    Yichao 'Peak' Ji · 2025 · manus.im

    KV-cache-aware harness design from a production agent.

  14. The lethal trifecta for AI agents

    Simon Willison · 2025 · simonwillison.net

    Private data, untrusted content and outbound communication: never all three.

  15. Model Context Protocol specification

    MCP project · modelcontextprotocol.io

    The protocol for exposing tools and resources to agents.

  16. LangGraph overview

    LangChain · docs.langchain.com

    A framework for stateful agent graphs.

  17. OpenAI Agents SDK

    OpenAI · openai.github.io

    Handoffs, guardrails and tracing built in.

  18. gVisor documentation

    Google · gvisor.dev

    A user-space kernel for strong container isolation.

  19. E2B documentation

    E2B · docs.e2b.dev

    Cloud sandboxes for running agent-generated code.

  20. Terminal-Bench

    Stanford & Laude Institute · 2025 · tbench.ai

    A benchmark for agents working in a real terminal.