ReAct Prompting
Yao et al., 2022 introduced ReAct, a framework where LLMs generate both reasoning traces and task-specific actions in an interleaved manner.
Summary (confidence: high)
- Estrutura que intercala raciocínio (Reason) e ações (Act) em LLMs (Yao et al., 2022).
- O raciocínio permite induzir, rastrear e atualizar planos de ação; a ação coleta informações de fontes externas.
- Permite interagir com ferramentas externas (bases de conhecimento, APIs) para respostas mais factuais.
- Supera baselines em tarefas de conhecimento e decisão, especialmente quando combinado com Chain-of-Thought.
Definição (confidence: high)
ReAct combina geração de traços de raciocínio (thinking) com chamadas a ações (tool use) de forma intercalada. O modelo pensa sobre o que precisa, executa uma ação (ex: busca na Wikipedia), observa o resultado e continua raciocinando até chegar a uma resposta final. The action step allows interfacing with external sources such as knowledge bases or environments, enabling dynamic reasoning to create, maintain, and adjust plans for acting while interacting with external environments.
How it Works (confidence: high)
ReAct is inspired by the synergies between “acting” and “reasoning” which allow humans to learn new tasks and make decisions. Chain-of-Thought (CoT) has shown LLMs can carry out reasoning traces, but its lack of access to the external world can lead to fact hallucination and error propagation.
ReAct addresses this by prompting LLMs to generate verbal reasoning traces and actions for a task. This allows the system to:
- Perform dynamic reasoning to create, maintain, and adjust action plans
- Interact with external environments (e.g., Wikipedia) to incorporate additional information
- Reduce fact hallucination compared to CoT-only approaches
Results (confidence: high)
- On knowledge-intensive tasks (HotPotQA, Fever): ReAct outperforms Act (acting-only) on both tasks. ReAct outperforms CoT on Fever but lags on HotpotQA.
- On decision-making tasks (ALFWorld, WebShop): ReAct outperforms Act, though both lag behind expert human performance.
- Combined ReAct + CoT + Self-Consistency generally outperforms all individual methods.
Limitations
- ReAct depends heavily on the quality of retrieved information; non-informative search results can derail reasoning.
- ReAct’s structural constraints reduce flexibility in formulating reasoning steps compared to CoT.
LangChain ReAct Usage
ReAct is implemented in LangChain via agent="zero-shot-react-description", supporting tool integration (search APIs, calculators, etc.) without requiring few-shot exemplars.
prompt-engineering-techniques | chain-of-thought | automatic-reasoning-tool-use
Implications
- ReAct transforms static LLM responses into dynamic, tool-augmented reasoning loops, making it foundational for modern AI agent architectures. Its interleaved thought-action-observation pattern maps directly to how coding agents (Claude Code, OpenCode) operate.
- When combined with CoT and self-consistency, it provides the most robust performance across both knowledge and decision-making tasks.
Sources
- raw/prompts/articles/promptingguide-pt-techniques-react.md
- raw/external/www-promptingguide-ai-react-b247cf0b.md