AI Agent Loop (ReAct)
AI Engineer path · lesson 81 of 124Watch an agent reason and act in a loop, see what one step really is (context in, action out), learn how the loop stops safely, and compare ReAct with plan-execute, reflexion, and tree-of-thought.
Press Run to watch the agent loop.
Key insight
An agent is tool calling in a loop: think, act, observe, repeat. The model itself picks each next action from what it has observed — and stops by emitting a final answer instead of another action. Bound the loop, or it can spin.
One turn of the ReAct loop
Order a single iteration.
Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.
- 1Drop a step here
- 2Drop a step here
- 3Drop a step here
- 4Drop a step here
- 5Drop a step here
Test your knowledge
What are the three repeating parts of a ReAct step?
The short version
A ReAct agent is a detective thinking aloud: "I need the capital" (thought), checks a reference (action), reads "Paris" (observation), then repeats — closing the case only when the clues add up.
In more depth
AI Agent Loop (ReAct)
ReAct (Reason + Act) interleaves reasoning and tool use: each iteration the model writes a Thought, takes an Action (tool call), reads the Observation (result), and loops — until it emits a Final Answer instead of another action. It's tool calling in a loop, steered by the model's own reasoning. Bound the loop (max steps) and guard tool use, or the agent can spin or act unintentionally.
Interview Questions
References & Further Reading
Love this visualization?
Sign up to track your progress, earn achievements, use the AI assistant, and access your personal learning dashboard.
100% free • No credit card required