AI · interactive
The ReAct loop
An agent alternates between reasoning and acting: think about what's missing, call a tool, read the result, and think again. It stops when it can answer. Compare it with a model that just answers from memory.
- Question
What's the temperature right now, in °F, in the city where the Eiffel Tower is?
The question goes in with a list of tools the model may use.
Agent
Think
The model reasons about what it knows and what it still needs.
Writing the plan down makes the next step better.
Act
It emits a tool call with arguments. Your code validates and runs it.
{ tool: "weather", args: { city: "Paris" } }
Observe
The tool output goes back into the context. The model now knows something it couldn't have guessed.
Errors are observations too: the model can retry.
Answer, or stop at a limit
When nothing is missing, it answers. Always cap the number of steps and the spend, or a confused agent loops forever.
max_steps = 10
In production
Tools and technologies
Most agent frameworks run a version of this loop.
Not tied to one language — use these names when you search docs or design a system.