AIOps Peach

Agents · Module 09

Harness Engineering

Everything around the model that makes an agent reliable: the harness that manages context and memory, constraints and safety, specifications and workflows, evaluation and observability.

Học tương tác →

Học xong bạn làm được

Bài học

  1. What is a harness?

    A harness is everything around the model that shapes its behaviour - system prompt, tools, safety constraints, state management, evaluation hooks and orchestration. Performance gaps in agent systems are often harness problems rather than model problems; each typical failure, from drifting off-task to losing all progress, has a harness fix.

  2. Context and memory management

    Agents use the context window as working memory, and long tasks fill it until earlier decisions are lost. A harness treats context as a budget - it bounds the conversation by summarising old turns, condenses rather than truncates (summarise finished subtasks, drop tool output bodies, collapse file contents, never compress decisions), and offloads state to scratchpad files for tasks bigger than any window.

  3. Constraints and safety

    A harness defines what an autonomous agent can and cannot do - an allow-list of tools with per-tool limits (file size, allowed directories, blocked commands, result counts), sandboxes from temporary directories to VM snapshots, and human-in-the-loop gates that require approval before sensitive actions such as deleting files or pushing to a remote.

  4. Specifications and workflow design

    Spec files are the written contract between human and agent - CLAUDE.md, AGENTS.md, .cursorrules and copilot-instructions.md are read from the repository. A good spec defines the environment, states conventions, lists constraints and gives examples. In spec-driven development the human writes the spec, the agent plans and executes within its boundaries, and a human reviews at the gates.

  5. Evaluation, observability and benchmarks

    Agents take multi-step trajectories, so evaluation scores the whole sequence - completion, efficiency, safety and cost - and a trace logger records every action for later analysis. Seven metrics, from task completion rate to safety violation rate, show whether the harness works. Benchmarks such as SWE-bench, WebArena, OSWorld, GAIA, Cybench and HumanEval depend heavily on the harness.

  6. Runtimes, orchestration and the whole harness

    Production agents need durable execution - a checkpoint manager that saves state and resumes or starts fresh - and a harness that manages handoffs and shared state between agents. Four loop patterns (ReAct, plan-and-execute, Reflexion, supervisor) fit different tasks. The full harness layers specifications, context, constraints, runtime and evaluation, and it evolves towards reliable autonomy.

  7. Assignment: Harness Engineering

    Agent Harness for Reliable Autonomous Work