Structuring AI Agents with Graphs to Enhance Workflow Reliability

The "loops vs. graphs" debate is not about a passing trend, but about who controls the workflow. A graph defines the steps, routing logic, and controls in advance, reserving model judgment for the appropriate moments. From theory to production precautions, here’s how to structure operable agents in practice.
Checkpoints, Interruptions, and Side Effects: The Safeguards
Going into production requires capturing the system's state and being able to resume without restarting everything. A checkpoint preserves the state of the graph at a given moment and allows continuation after a forty-minute flow crash. State reducers become essential when parallel branches converge to update the same field: they define how to combine results, for example by merging lists or combining dictionaries, without overwriting concurrent updates. Some frameworks naturally associate checkpoints and interruptions: the flow is paused awaiting human approval and then resumes with the same thread identifier, making long sequences with human intervention feasible. A human-controlled edge explicitly interrupts execution until the green light is given. The final imperative: monitor side effects during retries and resumptions. As soon as a node sends an email, bills a card, or triggers an external action, that action must be idempotent; otherwise, a resumption could replay it twice.
Nodes, Edges, and State: The Triptych of an Agent Graph
An agent graph relies on three elements: nodes, edges, and shared state. A node is an autonomous unit of work: LLM call, human approval, or deterministic computation. Not all need a model: checking a billing approval threshold can be coded deterministically, while qualifying an email as a refund request likely requires model judgment. The edges decide the next steps: direct passage without branching, conditional routing (for example, skeptical to merge, then to human), parallel execution, looping in case of failure with the reason attached, error capture and redirection to recovery logic, or human-controlled pause. The state carries the initial task, searches, drafts, intermediate outputs, and verification verdicts: each step reads and writes in this structure rather than stacking a chat history. Thus, nodes do the work, edges chart the path, and the state carries the information.
From the Shopify Case to Structured Workflow
Applied to the question "should we create an AI accounting tool for Shopify merchants?", a planning node breaks the request into three pillars: customer pain, competitors, and distribution. The graph splits into three parallel research nodes whose results feed into the state. A skeptical node then checks the robustness of the claims produced. Based on the remaining evidence, another node drafts a recommendation. The recommendation, along with the underlying research and verifications, is presented to a human who decides the next steps.
Le brief IA que les pros lisent chaque soir
Les 7 actus IA du jour, décryptées en 5 min. Gratuit.
Inclus dès l'inscription : notre sélection des meilleurs guides & comparatifs IA.
Choisissez votre rythme
Gratuit · Pas de spam · Désabonnement en 1 clic
A Single Model Without Framework Produces Uneven Results
In a single-agent loop, a model receives a big question, returns a confident answer, and the user validates it without a fixed framework, leading to variable quality. The Shopify example illustrates that a model can independently decide on leads, collect and interpret evidence, recommend, and self-evaluate in a single execution, without intermediate control. In practice, these loops get stuck repeating unproductive steps, omitting business rules, or lacking context. The proposed solution is not to write a finer prompt but to reduce the size of tasks and directly code known rules. The model serves only where judgment is required, for example, to interpret ambiguity or arbitrate between steps; it does not control the entire flow. Graph engineering then provides a flow that decides the next steps, while the model brings its judgment at the appropriate moments.
What Changes with Prompts and Context
Prompt engineering adjusts the content addressed to the model, while context engineering adjusts what the model can see, and these approaches remain in a single round. Loops equip the model, giving it memory and iteration, but leave control in a continuous execution where it chooses the next step. Graphs shift this control to an explicit structure: nodes, routing, and checkpoints are defined in advance, and the model only intervenes at points requiring judgment. The advised movement is to entrust process management to the structure and reserve judgment for the model where it is truly needed.
Target Audience and Origin of the Controversy
The approach targets teams already using AI for recurring tasks such as research, support, code review, writing, or decision-making on messy data, who are noticing the limitations of ad hoc loops. Without building an agent or adopting an orchestration framework, the challenge is to make the transition to a graph concrete enough to assess whether the structure provides a gain. The public discussion gained momentum in mid-2026 when Peter Steinberger contrasted loops and graphs in a question on X, followed a few hours later by a post from Hamel Husain proclaiming the death of loops in favor of graphs. In the following days, counterarguments, threads, and videos supported the idea that loops were not dead and attempted to clarify the terms of the debate, bringing the question back to what exactly graph engineering entails and its practical interest.
Brief IA — L'actualité IA en français
L'essentiel de l'actualité de l'intelligence artificielle, décrypté et expliqué chaque jour.