Why it matters · Lesson 1 of 4 · 5 minutes

Anatomy of an agent harness

Separate the model from the system that lets it act. By the end, you’ll be able to point to the parts of a harness and say what each one is responsible for.

One word, three different jobs

The model reads a context and produces a response. The response may be plain text or a request to call a tool. The model does not automatically have access to your files, database, browser, or shell.

The harness is the application code around that model call. It builds the request, supplies available tool descriptions, validates requested actions, executes tools, returns observations, tracks state, and decides when to stop. Tools are the functions or external capabilities the harness can execute. The environment is what those tools act on: a repository, API, browser, or other system.

Model
Proposes an answer or action based on the context it receives.
Harness
Controls the interaction and enforces application rules.
Tool
Performs a specific operation and returns an observation.
Environment
Contains the state the agent is trying to inspect or change.

Why this boundary matters

Suppose a coding model is asked to fix a failing test. With no repository tool, it can only suggest a patch. Add file-reading, file-writing, and test-running tools, and the harness can give the model evidence from the actual project. That changes the task the system can complete even though the model itself stayed the same.

It also changes what must be kept safe. The model may propose a shell command, but the harness decides whether that command is allowed, where it runs, and how long it can run. Safety and reliability must be enforced at the boundary where actions happen, not only described in the prompt.

Workflow or agent?

A workflow follows a path chosen by the developer: call step A, then step B, then produce a result. An agent can choose its next action based on observations. Both can use models and tools. Prefer the workflow when the sequence is known; use model-directed steps when the task genuinely requires flexible decisions. Anthropic recommends starting with the simplest design that meets the need in its guide to building effective agents.

Read this as a responsibility map
  1. User task
  2. Harness builds context
  3. Model proposes action
  4. Harness validates + runs tool
  5. Environment result

The return path matters: the tool result is added to the model’s context. The model can use that observation to answer, request another action, or recover from an error. The full system is therefore the model plus a particular harness configuration and environment—not just a model name.

Which description best names a harness?

Primary source: Building Effective Agents — Anthropic. Read the sections on workflows vs. agents and deciding when to use agents.

Ask your teacher about anything unclear, or bring a harness diagram from a project you use.