Skip to content
Simon Place
FR EN
Book a Meet call

Module 4 of 10, lesson 2 of 5

Going deeper

Reasoning loops and architectures

An agent is a state machine

Drawing the states forces the questions a loop lets you skip. Where can a run wait? Where can it fail? What can resume it?

planning → acting → observing → acting → … → done
                 ↘ waiting_for_human ↗
                 ↘ failed

Once the states are explicit, each transition is a place to save progress, write a log line or ask a person. A run that waits two days for approval can’t live in a process’s memory: it needs to be stored.

ReAct, ReWOO, plan and execute

ReAct calls the model between each action. It adapts well and costs the most. ReWOO (Xu et al., 2023) writes the whole plan once and fills in the results, using far fewer calls, but it can’t change course if step 2 returns a surprise. Plan-and-execute sits between them: follow the plan, and call the model again when a step fails or returns something unexpected. Choose by how often reality departs from the plan. Stable tasks suit ReWOO, and unknown territory suits ReAct.

Replanning costs too

Replanning after every step turns a planner back into ReAct, with an extra call. Set triggers instead: a tool failed, a required field is missing, or the result contradicts an assumption of the plan. Keep what has been done in the context of the new plan, or the agent will happily repeat a payment it already made.

Spot a stuck agent early

A step limit is the last line of defense, and it fires after the budget is gone. Earlier signs include the same tool and arguments repeating, two tools alternating, or a run of steps that adds no new information. On the first sign, tell the model it’s repeating itself. If it continues, stop.

Interrupt, then resume

Human approval needs more than a yes/no prompt. The run saves its state, frees its resources and stops. When the answer arrives, possibly much later, it loads the state and continues from the same step. The person also needs context to decide: what the agent wants to do, why, and with what evidence. An approval screen showing only “Refund $89?” soon becomes a button people click without reading.

Legal notice and privacy