// Foundations · ~2 min read
ReAct
Reach for it when: the next step depends on what the last tool returned.
After this lesson you can: Build a reason → act → observe loop and give it a clear stop rule.
// 60-second mental model
How to hold it in your head
Think, use a tool, look at what came back, then decide again — until you can stop with an answer.
ReAct interleaves reasoning steps (Reason, sometimes called chain-of-thought) with tool calls (Act) and the results they return (observations), looping until a stop condition.
How this differs
Plan-and-Execute writes the whole plan first and reasons less between steps. ReAct decides each step after seeing the last result, so use it when you can’t plan ahead.
// Mini architecture
Reason → Act → Observe → loop
The user goal goes to a Reason step that decides the next step. Reason sends a tool call to a tool (or MCP tool) and observes the result that comes back. This repeats until Reason decides it is done, then it writes the final answer.
In the original ReAct, each turn is: decide → call one tool → read the observation → repeat or stop. (Newer model APIs can also call several tools in one turn.)
// Mini-project
Cited research agent (stub)
Any agent framework · one stub web_search tool (MCP optional)
Goal: Answer a factual question with 2–3 citations from search results — never from memory alone.
- Accept a research question.
- Reason: decide whether you need a search or can stop.
- Act: call a stub `web_search` tool — a fake that returns canned results. (You can serve it over MCP, the Model Context Protocol, an open standard for connecting tools to AI apps.)
- Observe: extract titles + URLs from the tool payload.
- Loop until you have enough sources or hit a step limit (for example, six tool calls).
- Stop: write the answer with inline citations.
Stub the tool. Real search is optional later — the point is the loop and the stop condition.
// Common failure
What goes wrong
Symptom
Infinite tool loops / never stopping — the agent keeps searching “just in case”.
Fix
A hard step limit plus an explicit stop rule: “If I can cite two or more sources that answer the question, stop.”
// Self-reflection
Sit with this
When did you last ship a one-shot prompt that should have been ReAct?
Sources
Session only. Nothing is saved.