A tweet from Peter Steinberger, creator of the AI agent OpenClaw, asking whether AI builders are “still talking loops” or have “shifted to graphs” just racked up hundreds of thousands of views.

I knew about loops but, graphs? That was new to me. So i dig a little to fix that for myself and anybody else who might be searching.
This is what a loop is, what a graph is, why AI builders keep fighting about which one is “right,” and why the honest answer is that you are probably already using both without knowing it.
Why This Actually Matters
If you have used any AI coding tool or an AI agent that seems to “figure things out” over several steps, you have already watched a loop or a graph in action. You just did not have the vocabulary for it.
Understanding the difference matters because it explains why some AI tools feel unpredictable and creative while others feel rigid and reliable. That is not an accident. It is an architecture decision, and once you can see it, a lot of AI product behavior stops feeling mysterious.
Loop, Defined
A loop is the simplest way to let an AI agent work on something over multiple steps. The agent takes an action, looks at the result, decides what to do next, and repeats. There is no predetermined path. The agent is improvising its own next move every single cycle.
This is what makes coding agents feel almost alive when they work well. Ask one to fix a bug and it might read a file, run a test, see the test fail, read a different file, try again, and keep going until the test passes. Nobody wrote out that exact sequence in advance. The agent found its own way there.
The tradeoff is predictability. Because the agent is choosing its own path each time, two runs of the same task can look completely different. That makes loops harder to debug and harder to guarantee will behave the same way twice.
The other main disadvantage people flagged is cost. Since a loop has no fixed stopping point unless you build one in, it can keep calling the model and burning tokens until it finally solves the problem, and that meter runs a lot faster than most people expect.
Graph, Defined
A graph takes the opposite approach. Instead of letting the agent improvise, you as the builder decide every step in advance, before the AI ever runs. In practice, that means writing out a list of stages the workflow can be in, giving each one a name, which is called a node, and writing a rule for what happens right after each one finishes, which is called an edge. Some of those edges are conditional, meaning the rule checks something in the current situation, like whether a test passed, a value crossed a threshold, or a piece of data came back a certain way, and sends the workflow to a different node depending on the answer. The AI itself does not decide what happens next. You already decided it. Its only job inside a graph is to do the specific task each node asks of it, then hand control back to the rule you already wrote.
Here’s an example to make it click. Say you are vibecoding a racing game with Claude Code, and you want an AI opponent that actually competes with you instead of driving a scripted line around the track. Built as a graph, you would write out something like this ahead of time. Node one checks the opponent’s position on the track. Its edge says if it is behind, go to node two, if it is ahead, go to node three. Node two picks an aggressive move. Node three picks a defensive move. Both of those connect to a node that checks fuel and damage, which loops back to node one for the next corner. You wrote every one of those connections before the race ever started. The AI is not thinking freely, it is just walking the path you already built.
Now compare that to a loop version of the same opponent. You would tell the AI to race competitively and adapt as needed, and let it work out its own strategy each lap with no fixed structure behind it. Less setup work on your end, but no guarantee it drives the same way twice.
The benefit of a graph is control, since you already know every path it can take before it runs. The tradeoff is that you have to know the shape of the problem in advance, which does not work well for open ended or creative tasks where you cannot predict every situation ahead of time.
Where People Actually Build Graphs
A graph lives inside code, as part of whatever app or product someone is building. The most common way is code first, using a framework like LangGraph, where a developer writes the nodes as functions and connects them with a few lines defining the edges, exactly the racing game pattern above, just typed out instead of imagined.

There are also no-code, drag and drop versions, like n8n or Microsoft Copilot Studio, where you draw the graph visually, dragging boxes onto a canvas as nodes and drawing lines between them as edges.
So Which One Is Actually Better
Neither. In production systems, teams are not choosing loops or graphs. They are combining them. A common pattern looks like this: use a loop for the part of the task that genuinely needs improvisation, like researching or reasoning, then wrap that loop inside a graph that handles the parts that need to be reliable, like approval checkpoints, retries, or handing off to a different specialist agent.
Even LangGraph, the tool most associated with “graphs,” supports cycles, meaning a loop is technically just a graph with an edge that points back at itself. The distinction is less “versus” and more “which tool for which part of the job.”
FAQ
What is a loop in AI agents? A loop is a repeating cycle where an AI agent takes an action, observes the result, and decides its own next step, without a fixed predetermined path.
What is a graph in AI agent design? A graph is a workflow mapped out in advance as connected steps, called nodes, with rules called edges that determine what happens next based on conditions in the task.
Do I need to choose between a loop and a graph for my AI project? Usually not. Most production AI systems combine both, using loops where flexibility matters and graphs where predictability and control matter.
The Takeaway
The “loops versus graphs” debate blew up because it sounds like a rivalry, and rivalries are fun to watch. But underneath the buzzwords, it is really just two tools solving two different problems. A loop gives an agent room to think. A graph gives you room to trust it. Most real systems need both, and now you know enough to spot which one you are looking at the next time an AI tool “figures something out” in front of you.






Leave a Reply