AI Agents Engineering · What an Agent Actually Is · Lesson 2 of 3
The ReAct loop
The canonical agent pattern is ReAct (Reason + Act): Thought → Action (tool) → Observation (result), repeated until the model decides it is done.
- Thought: the model reasons about what to do next.
- Action: it emits a tool call with arguments.
- Observation: your code runs the tool and feeds the result back into context.
- Repeat; when the goal is satisfied the model emits a final answer instead of a tool call.
- The loop is driven by your runtime, not the model — you decide whether to continue, and you enforce the limits.
- Termination: always cap steps, wall-clock time, and cost — agents can loop or thrash.
- Add progress/loop detection (e.g. same tool + same args repeated) to catch a stuck agent early.
Reliability compounds downIf each step is 95% reliable, a 5-step agent is only ~77% reliable end-to-end (0.95^5). Minimize steps, validate between them, and add checks.
◆ Lock it in
- ReAct = Thought → Action → Observation, looped, ending in a final answer.
- The loop and its stop conditions live in your runtime — always cap steps, time, and cost.
- Reliability compounds down — minimize steps and validate each one.
Feynman drill — say it out loudRecite the three phases of the ReAct loop and explain why an agent needs a hard stop condition.
Step 1 rate your confidence · Step 2 pick your answer
A 6-step agent where each step is 90% reliable has roughly what end-to-end reliability?
Step 1 — how sure are you?