Explainer

Loops vs graphs

What
Agent architecture: when a loop should become a graph, and when it shouldn’t. A test you can run on any agent you build.
Prompted by
Peter Steinberger’s July 2026 “loops or graphs?” question. Adapted from my own prototype on agent architecture; public-safe, no proprietary detail.
Back to

In July 2026 Peter Steinberger poked the field with one line: “are we still talking loops, or did we shift to graphs yet?” It read as a verdict. It wasn’t. It was a question, and the answer is a test you can run on any agent you build.

The one idea

A loop is one agent iterating on its own judgment until it’s done. A graph cuts that work into fixed nodes joined by gated edges. Escalate only to buy a gate, determinism, or a real handoff.

1The two shapes

These are not “old vs new.” A loop is a cycle; a graph is a fixed path with checkpoints. The defining difference isn’t how many agents there are. It’s who decides what happens next: the model’s own judgment (loop), or a structure you wired in advance (graph).

Loop — one agent, iterating
StepObserveRead the goal and current state.
StepActPick one tool, run it, see the result.
The cruxSelf-checkThe same agent judges “done?” — actor and judge are one.
↺ not done → back to Observe
Graph — fixed nodes, gated edges
Node ADo stage oneTyped state passes along the edge.
The edge that earns itGateA hard check or human approval the flow cannot pass without.
Node BDo stage twoOnly reachable once the gate cleared.

The crux node is the loop’s problem: it grades its own work. The gate is the only thing a graph gives you that a loop can’t: an edge the flow is forced through. Everything else a graph “adds”, more steps and more prompts, a loop already has.

2When a graph earns its place

There are exactly three honest reasons to break a loop into a graph. If none apply, you’re adding latency and rigidity for tidiness.

Gate
A step must be blocked until a hard condition passes or a human approves. A self-judging loop can’t enforce a stop it isn’t allowed to overrule.
Determinism
You need a boundary to behave the same way every time — a fixed route, a checkpoint you can resume from — not “whatever the model decided this run.”
Real handoff
Stages genuinely differ — different tools or models per node (cheap researcher → strong writer → strict reviewer), not one agent play-acting all three.
Not a reason
“The prompt got long.” “Four steps feels like a lot.” “A diagram looks more professional.” Step count and neatness aren’t reasons.
The collapse test

Try to fold every node back into one agent’s loop. If you can and lose nothing — no gate goes unenforced, no determinism disappears, no real tool/model split collapses — it was never a graph. It was a loop wearing a diagram, and you paid latency for the costume.

Rule of thumb: if five nodes collapse back into one loop and nothing is lost, you should collapse them. Master the loop first. Reach for a graph only when the work forces your hand.

3Check yourself

Six questions. The answer appears when you pick one.

Explain ·andrewshiau.com · Press ⌥G for the grid · Set on a 12-column grid