Agent Architecture
Breaking a goal into steps, and changing the plan when a step fails
Scroll
Breaking a goal into steps, and changing the plan when a step fails
An agent given a large goal, such as moving a service to a new database driver, cannot do it in one tool call. It has to break the goal into smaller steps, and how it does that shapes everything after: the order of the work, what gets checked along the way, and how much is wasted when something goes wrong.
There are two basic styles. In plan-then-execute, the model first writes out the whole list of steps and then works through it. The plan is visible before any work starts, a person can review it, and it keeps the agent from wandering. In interleaved planning, the style the ReAct page describes, the model decides only the next step, takes it, looks at the result and decides again. That adapts well to surprises but can drift from the goal over a long task. Many agents mix the two: a short written plan, with each next step chosen against it.
Plans break, so what matters most is what happens when a step fails. A good agent marks the failed step, works out which later steps depended on it, and replans from that point, keeping the work that already succeeded. Retrying the same step over and over rarely helps. Two limits keep this in check: a cap on how many times the agent may replan, and a rule for when to stop and ask a person. Without them, a confused agent can keep going for a long time, spending tokens on a plan that cannot work.
Agents