Field Notes
Agentic AI

Loop Engineering, Graph Engineering, and the Hill-Climb

The industry conversation is shifting from prompting agents to designing the loops and graphs that evaluate, retry, and improve them, including the outer hill-climb from production traces.

A one-shot agent is a demo. A production agent is a machine that can start without you, work until a stop condition, survive failure, and leave evidence.

That is why the current discourse on loop engineering and graph engineering matters. The labels are new. The problems are not. Teams are rediscovering, at industrial scale, that the model is the least interesting part of an agent once you need unattended work, multi-step verification, and continuous improvement.

The useful question is not "which model." It is: what loops run, what graph coordinates them, what grades the work, and what gets better after the run ends.

What Loop Engineering Actually Means

Loop engineering is the move from human-in-the-loop as the default scheduler to system-defined cycles with explicit stop conditions.

In a hand-run session, a person does two jobs:

  1. Decide what runs next.
  2. Check the output before the next step.

Both are bottlenecks. Both cap how far an agent gets while you sleep.

Loop engineering puts both jobs into infrastructure:

  • A trigger starts work (message, failing CI, open issue, schedule).
  • A maker produces artifacts through tool use and observation.
  • A checker grades the result with a different objective than the maker.
  • State lands on disk or in structured store, not only in a context window that dies when the session ends.
  • An exit is defined before the run, not improvised mid-flight.

The hard rule that keeps showing up in serious writeups: do not let the same agent grade its own work. Self-grading collapses into self-justification. A second review path, another model, another prompt, another tool suite, or a deterministic suite of tests and linters, is what turns "keep trying" into "keep improving."

Operating pattern: The maker optimizes for completion. The checker optimizes for refutation. The loop optimizes for convergence under a budget.

Exit Conditions Before Autonomy

An unattended loop without a stop condition is not clever. It is a token furnace.

Good exits are boring and measurable:

  • All required tests pass and lint is clean.
  • Checker returns zero blocking findings after at most N revision rounds.
  • Cost or wall-clock budget is exhausted; emit partial result + residual risk.
  • Policy gate fails; escalate to a human with a full trace.

If you cannot write the exit condition in one paragraph, you do not have a production loop. You have an infinite chat.

Graph Engineering: From One Loop to Many Workers

Loop engineering makes one autonomous unit reliable. Graph engineering organizes many units with dependencies, parallelism, and shared state.

A graph is a claim about control:

  • Nodes hold nondeterminism (a model call, a sub-agent, a tool-using loop).
  • Edges are scheduled by deterministic code (dependencies, fan-out, merge, retry policy).
  • State is typed and durable (plan versions, artifacts, findings, ownership of worktrees).
  • Verification can attach per-node and at the terminal objective.

Why Graphs Show Up After Loops

Once a single agent can run unattended, the next pain is coordination:

  • Product vs architecture vs security vs tests should not share one polluted context.
  • Parallel workers need isolation (worktrees, sandboxes, credentials).
  • Findings must be typed objects, not chat transcripts, if another agent will act on them.
  • Replanning must append or revise the graph without rewriting history into mush.

The clean principle, repeated across research systems and production harnesses: nondeterminism lives in nodes; scheduling and contracts live in code. That is graph engineering as engineering, not as a framework brand.

Evaluate Hard, Then Hill-Climb

Loops and graphs that only "finish" still stagnate. The competitive layer is the outer optimization loop: production experience becomes durable capability.

That outer loop looks like gradient-free hill-climbing on the harness:

  1. Instrument every run (tools, decisions, costs, checker findings, terminal outcomes).
  2. Score with task evals, not vibes, golden trajectories, property checks, adversarial review.
  3. Promote a change only when it wins on a regression suite and does not burn the budget.
  4. Freeze the winning config as the new baseline (prompt, tool schema, policy, graph template).
  5. Replay the incident that taught you something so it cannot silently return.

What Not to Optimize Blindly

Hill-climbing is not "let the agent rewrite itself in production." Unsupervised self-modification of tools, permissions, or egress policy is how systems fail open.

Treat the outer loop like a release process:

  • Changes are candidates, not live edits.
  • Graders are versioned.
  • Bad promotions roll back with the same rigor as a bad deploy.
  • Cost, latency, and blast radius are first-class scores, not afterthoughts.

A Practical Stacking Order

If you are building or reworking an agent product, the order of operations is usually:

  1. Make one trajectory debuggable. If you cannot inspect a failed run as a timeline, nothing else compounds. (See our note on trajectory debugging.)
  2. Close the inner loop. Maker + tools + stop condition + durable state.
  3. Add adversarial verification. Separate checker, tests, linters, policy gates.
  4. Automate the trigger. Only then does the loop run without a human starter.
  5. Introduce a graph when one context or one worker is the bottleneck, decomposition, parallel worktrees, typed handoffs.
  6. Install the hill-climb. Traces → evals → candidate harness changes → promotion.

Skip steps and the meme still looks good in a diagram. Production will not care.

How This Relates to the Harness Product

Loop and graph engineering are not a replacement for the harness. They are the harness, described from the control-flow side.

Teams that only buy model upgrades keep relearning the same lesson: the product boundary is the system that prompts, grades, and improves the agent, not the agent monologue itself.

Operating Checklist

Use this as a field review for any "autonomous" system:

  • Trigger is event- or schedule-driven, not only chat-driven.
  • Maker and checker are separated by objective (and ideally by identity).
  • Stop conditions are written before the first unattended run.
  • State is durable outside the context window.
  • Parallel work is isolated (worktrees, sandboxes, credentials).
  • Node success is not confused with objective success.
  • Every production failure can become a regression case.
  • Harness changes promote through evals, not vibes.
  • Cost and risk sit on the same scoreboard as quality.

Closing

Loop engineering without verification is spinning. Graph engineering without contracts is distributed confusion. Hill-climbing without evals is optimizing noise.

What works in production is quieter: bounded loops, deterministic edges, adversarial checks, durable state, and an outer climb that only accepts measured gains.

That is how agentic systems stop being impressive demos and start becoming infrastructure that can be operated, audited, and improved, the same discipline we apply when building, operationalising, and scaling systems that have to hold for real users.