Agent Harness Engineering vs. Loop Engineering vs. Graph Engineering
I keep seeing the same mix-up in agent architecture conversations. Someone says “we need better loop engineering” when the actual problem is the harness. Someone else draws a 40-node graph before they’ve watched the agent solve the task once. The terms get used interchangeably because they all touch the same model and they all involve some kind of repetition. But they answer different questions, and once an agent starts touching real files, real APIs, or real customers, mixing them up gets expensive.
The one-line version
Harness engineering builds the environment the model operates in. Loop engineering designs the repeated work-and-feedback cycle. Graph engineering makes the workflow’s shape explicit: nodes, branches, joins, and controlled cycles.
Environment, then feedback, then flow. That’s the order I use when I’m diagnosing a broken agent.
Why this is suddenly a real conversation
A raw model can’t write to a filesystem, hold state across a session, run your test suite, click through a browser, or restart itself after a crash. All of that comes from what’s built around it. The stack is finally standardizing: the harness is the foundation, loops handle repetition and verification, graphs map the paths the whole thing is allowed to take.
None of these terms are fully settled yet. “Agent harness” is the one converging fastest. “Loop engineering” only started getting used this way in 2026. “Graph engineering” here has nothing to do with knowledge graphs. It just means treating your agent workflow as an explicit state machine instead of a pile of conditional logic. I’m using the term loosely on purpose, because the real point isn’t the vocabulary. It’s making sure a buzzword doesn’t hide the actual design decision you’re avoiding.
Agent Harness Engineering
The simplest definition I’ve found: the agent is the model plus the harness, and the harness is everything outside the model, the code, the config, the execution logic. System prompt, tool definitions, memory, sandboxes, model routing, handoffs, middleware, compaction, permissions, logging, verification. OpenAI’s Agents SDK describes the same thing from the runtime side: a runner that calls the model, executes tool calls, handles handoffs, carries state, and stops only at a real terminal condition.
I like the word harness because it kills model worship. Give two teams the same foundation model. Give one team clean tools, a stable workspace, tight permissions, and observable state. Give the other a vague prompt and a flaky API wrapper. The intelligence is identical. The working conditions aren’t, and the outcomes won’t be either.
What a real harness includes:
- Context injection: instructions, retrieved facts, conversation state, skills, task policies
- Action surfaces: APIs, browsers, shells, code interpreters, databases, MCP tools
- Persistence: files, checkpoints, sessions, progress logs, git history, long-term memory
- Execution control: timeouts, retries, budgets, model routing, sub-agent spawning, approval gates
- Safety and governance: permissions, isolation, allow lists, secret handling, human sign-off
- Observability: traces, tool inputs and outputs, state transitions, cost, latency, eval results
Test I use: delete the model from the architecture diagram. Everything still standing is the harness. Tools, data access, state store, sandbox, middleware, evaluators, retry policy, UI.
Where this actually pays off: long-running, multi-session coding work. Anthropic found that context compaction alone wasn’t enough to keep an agent oriented across sessions. What worked was a real system: an initializer, a progress file, git history, and a discipline of incremental commits, so every new context window can pick up exactly where the last one left off. That’s not a prompt fix. That’s harness work. Reach for it when the agent lacks a capability, can’t resume cleanly, loses state, has access it shouldn’t, can’t be audited, or behaves differently across environments.
Loop Engineering
Every tool-using agent already has a small loop baked in: call the model, look at the result, run the tool, feed the observation back, repeat until there’s a final answer. Loop engineering starts when you build additional cycles around that behavior on purpose.
A verification loop lets the agent produce something, run it through a deterministic check or grader, get specific feedback, and retry only if there’s real evidence of a problem. An event-driven loop wakes the agent on a schedule, a webhook, or a new document. An improvement loop reviews traces and failures, adjusts instructions or tools, and tests whether the new version actually does better. It’s a stack of loops, not one magic while-statement.
What a well-built loop needs:
- Trigger: user request, schedule, failed test, new data, evaluator feedback
- Goal: a specific state to reach, not “keep improving”
- State and memory: what the next cycle needs to know without replaying everything
- Action policy: what the agent is allowed to change, call, delegate, or spend
- Evidence: tests, schema validation, citations, diffs, metrics, human review
- Feedback: a compact, specific reason the evidence failed
- Stopping rule: success, budget limit, timeout, unrecoverable error, or human escalation
Don’t loop on confidence. Loop on evidence. “The agent says it’s done” is not a stopping condition. “Tests pass, links resolve, schema validates, reviewer approved” is.
A prompt tells the model what to do during one call. A loop decides what the system does after the call: how it reads results, picks feedback, decides whether to continue, persists progress, and stops. That’s the difference between a one-shot instruction and a managed process. The cost is real: every grader, reviewer, or retry is another model call or tool run. The right rule of thumb is the same one that applies everywhere in this stack: start with the simplest architecture that works, and only add loop complexity where the cost of a failure is higher than the cost of checking for one.
Graph Engineering
The graph question is different from the harness or loop question: not what the agent does, but what’s allowed to run next. Nodes represent steps. Edges represent permitted transitions, sequence, conditional branches, parallel fan-out, joins, cycles, human interrupts. State moves through the graph, and the topology is what lets you actually verify the control flow you intended.
LangGraph frames itself around exactly this: durable execution, explicit state, human-in-the-loop control, control over the agent rather than an abstraction layer on top of it. Microsoft’s AutoGen documentation puts the trigger condition plainly: reach for a graph when you need exact control over agent order, different next steps for different outcomes, deterministic branching, or a multi-step process with real cycles in it.
What you’re actually deciding when you design a graph:
- Node boundaries: what belongs in a deterministic function, an LLM call, a specialist agent, or a human review step
- State schema: what each node can read or write, how parallel updates merge
- Routing conditions: what evidence sends work forward, backward, sideways, or to escalation
- Concurrency: what runs in parallel, what has to join, what shared resources need coordinating
- Cycles and exits: where retries are legal, how many are allowed, what makes a cycle safe
- Durability: where checkpoints sit, how execution resumes after an interruption
This is not knowledge graph engineering. A workflow graph represents control and state transitions, not entities and relationships in your data. Don’t conflate the two, they solve different problems and get built by different teams.
Graphs earn their cost when the process has real branches, real parallel work, approval gates, recovery paths, or multiple specialist agents. They cost you when the job is genuinely “give one agent three tools and let it work.” A graph makes debugging easier, but it can also freeze your assumptions before you actually understand the task. If the model needs to invent the plan dynamically, forcing every path into a fixed diagram makes the system more brittle, not less.
How the three layers stack in one real system
Take a research-and-publishing agent producing a factual industry briefing. The graph runs inside the harness. One or more loops live inside the graph’s nodes. The harness supplies the state, tools, and evaluators those loops depend on. Each layer gives you a separate lever, and none of them substitutes for the others.
Diagnosing a broken agent by layer
I stopped trying to fix everything with a better prompt once I had this mapping in my head. Match the symptom to the layer, not the other way around.
- Agent can’t safely access the right data or tool → harness: fix the tool contract, permissions, sandbox, context injection
- Agent forgets progress across sessions → harness: durable state, checkpointing, progress artifacts, compaction
- First attempt is close but not reliable → loop: external grader, deterministic tests, feedback, bounded retry
- Agent keeps working past success, or stops before it has proof → loop: evidence-based terminal states, budget-aware stop rules
- Several specialists need to run in a controlled order → graph: explicit nodes, edges, routing conditions, joins
- Failures are hard to locate in a multi-step process → graph plus harness: stateful traces aligned to graph nodes
- The workflow changes too often for a fixed diagram → simplify the harness, keep control model-driven, delay formalizing the graph
The mistakes that cost the most
Building a graph before you understand the work. Teams translate a business process into dozens of nodes before watching a capable agent actually solve it once. Start with traces from a simpler harness. Formalize the paths that turn out to be stable.
Letting the same model write and grade its own work. Self-review helps, but it shares blind spots with itself. Prefer deterministic checks, separate reviewer context, and require human approval on anything high-impact.
Using “keep trying” as your entire loop spec. An unbounded retry is a cost leak, not a strategy. Every loop needs a measurable objective, fresh evidence each cycle, a maximum attempt count, and a named escalation path.
Treating the harness as a junk drawer. More tools and more memory aren’t automatically better. A crowded toolset increases selection errors. A noisy context increases confusion. Broad permissions increase risk. All three raise your blast radius.
Blaming the model for orchestration failures. A model can’t compensate for stale state, ambiguous tool schemas, a broken API, or a missing exit condition. Fix the layer that actually owns the failure.
A checklist before you ship
Harness: Are the tools narrow, documented, observable? Is state durable? Are permissions least-privilege? Can an operator pause, inspect, and resume a run?
Loop: What evidence proves success? What feedback goes back on failure? How many retries are allowed? What happens when the budget runs out?
Graph: Which paths have to be deterministic? Where can work run in parallel? What state is shared? Where are the human gates and recovery routes?
Evaluation: Can the team replay real traces, compare versions, and attribute an improvement to a specific change instead of a hunch?
Operations: Are cost, latency, failure rate, intervention rate, and task-level success actually monitored in production?
The way I remember it
Harness engineering builds the machine the model runs in. Loop engineering makes the work iterative, verifiable, and resumable. Graph engineering makes a complex execution path explicit and controllable. None of the three replaces the other two. A beautifully drawn graph doesn’t help if the harness loses state between sessions. The best harness in the world is wasted money if nothing has a stopping rule. And carefully built loops are still unmanageable once branching, parallelism, and approvals get buried in ad-hoc code instead of a real graph.
Design all three on purpose, and you get a system you can actually debug. Skip one and hope the others cover for it, and you get a demo that breaks the first time it touches production.
