Big picture of ReAct:
AI doesn't just answer immediately, it goes through stages.
think -> plan -> action -> observe -> output(total 5 steps)
ReAct = Forcing the AI to show its work step by step before arriving at a conclusion, just like how a student arrives to the solution of a math problem step by step.
Here is the simplest mental model for ReAct:
┌──────────────────────────────┐
│ YOU send a question │
└──────────────┬───────────────┘
▼
┌──────────────────────────────┐
│ AI replies with JSON like │
│ { "step": "...", ... } │
└──────────────┬───────────────┘
▼
┌──────────────────────────────┐
│ Python looks at "step" and: │
│ • plan → loop again │
│ • action → run a tool |
│ • output → print & STOP │
└──────────────────────────────┘
Comparing Chain of Thought(another prompting technique) vs ReAct:
CoT - In this technique, the LLM is instructed to generate its intermediate reasoning steps as part of the output, instead of jumping straight to the final answer.
ReAct - CoT only thinks, ReAct thinks and does stuffs.
Here is the code
Top comments (0)