Glossary · Technique
ReAct (Reason + Act)
Also known as: ReAct prompting, Thought-Action-Observation
Alternate reasoning and acting in a tight loop. The dominant pattern for tool-using agents — think, act, observe, repeat.
When to use it
- Multi-step agentic tasks that need to use tools.
- Research / scraping / search workflows.
- Anywhere the model needs to react to real-world feedback before its next step.
- When pure CoT would hallucinate facts it doesn't have.
When not to use it
- Tasks that fit in a single shot — overhead isn't worth it.
- When tool outputs are huge — observations blow up context.
- Closed-domain tasks with no need for external information.
How it works
- 1Each step has 3 parts: Thought (what to do next + why), Action (the tool call), Observation (the result).
- 2Loop continues until the model emits a final answer.
- 3Forces the model to interleave reasoning with actions rather than deciding all moves up front.
- 4Critical: structure the prompt with explicit Thought:/Action:/Observation: markers.
Example
Lazy prompt
Find me the top 3 restaurants in Paris and book a table.
Using the technique
You are a ReAct agent. For each step output: Thought: <reasoning> Action: <tool_name>(<args>) Observation: <returned by tool> Repeat until you have a final answer, then output: Final: <answer> Max 8 steps. If stuck, output Final with what you have.
Common pitfalls
- Models can fall into action loops (calling the same tool repeatedly without progress).
- Long loops accumulate huge context — must summarize or truncate observations.
- Tool errors must be caught and re-injected as observations, or the loop derails.
- Without a max-step limit, the loop can spiral.
Where this came from
Yao et al., 2022 — "ReAct: Synergizing Reasoning and Acting in Language Models". Foundation of LangChain's early agent design.
Related techniques
Function Calling / Tool Use
Let the model decide when to invoke a real function or API instead of free-text answering. The foundation of every modern agent.
Retrieval-Augmented Generation (RAG)
Don't train on it — retrieve it. Inject relevant documents into the prompt at runtime so the model answers from real source material.
Chain-of-Thought (CoT) Prompting
Force the model to think step-by-step before answering. Dramatically improves accuracy on multi-step problems.