Order the five steps of the canonical agent loop from first to last
- 1Observe the environment or prior tool result
- 2Feed the result back as the next observation
- 3Select and invoke the appropriate tool or action
- 4Reason about what action to take next
- 5Execute the tool call and receive the result
Each turn of an agent loop runs in one fixed order: observe state, reason, choose and invoke a tool, execute it, then feed the result back as the next observation.
Imagine cooking a dish you have never made before. First you look at what is on the counter. Then you think about the next move. Then you pick up a tool, maybe a knife or a pan. Then you actually do the step, like chopping an onion. Then you look again to see how it turned out before deciding what comes next. An agent works the same way, round after round. It reads the situation, decides, grabs a tool, runs it, and checks the result. The order matters: it has to look before it can think, think before it can pick a tool, and run the tool before any result exists. Each round feeds the new result back in, so the next decision is based on what actually happened rather than a guess made at the very start.
Detailed answer & concept explanation~8 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
State the five steps in order, justify each ordering from its data dependency on the previous step, highlight the feedback step as the one that closes the loop, and contrast the dynamic loop with a fixed chain.
Real products, models, and research that use this idea.
- LangGraph's prebuilt ReAct agent encodes this order as graph nodes: observe state, call the model to reason, route to a tool node, execute, then loop the result back to the model node.
- Claude's computer use mode observes a screenshot, reasons about the next action, emits a click or keystroke tool call, executes it, and feeds the resulting screenshot back as the next observation.
- Cursor and Cline coding agents observe the current file and test output, reason about the next edit, call a file-write tool, execute it, then re-observe by rerunning the test suite.
- The original ReAct paper formalised the Thought, Action, Observation ordering that modern frameworks like the Anthropic SDK and OpenAI tool use still follow turn by turn.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy is the feedback step the one that actually makes the system an agent rather than a chain?
QHow does the plan-and-execute pattern rearrange these steps compared to the canonical ReAct loop?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Putting tool execution before the reasoning step, or dropping the feedback step so the result never returns as the next observation that shapes the following decision.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.