What Is ReAct?
ReAct (Reasoning + Acting) is a prompting framework introduced in a 2022 research paper that combines chain-of-thought reasoning with action execution in a single interleaved loop. The key insight is that reasoning and acting should not be separated — an agent should think about what to do, act on that thinking, observe the result, and then think again.
This stands in contrast to two simpler approaches:
- Pure reasoning (chain-of-thought) — The model thinks through the problem but cannot gather new information.
- Pure action — The model calls tools but does not reason explicitly about what it learns.
ReAct combines both, enabling agents that are simultaneously more informed and more deliberate.
The ReAct Pattern
Each iteration of a ReAct agent produces three components:
- Thought — The model's internal reasoning about the current state. What does it know? What does it need? What action should it take?
- Action — A specific tool call or step the agent will execute (e.g.,
Search["KnowledgeSDK API"]). - Observation — The result of that action, fed back into the context.
These three elements repeat until the agent decides it has enough information to produce a final answer.
A ReAct Trace Example
Here is a simplified trace of a ReAct agent researching a company:
Thought: I need to find what products Acme Corp sells. I'll start by extracting their website.
Action: extract_url("https://acmecorp.com/products")
Observation: {"products": ["Widget A", "Widget B", "Widget C"]}
Thought: I have the product list. Now I should check their pricing page.
Action: extract_url("https://acmecorp.com/pricing")
Observation: {"pricing": {"Widget A": "$99", "Widget B": "$149"}}
Thought: I have products and pricing. I can now write the summary.
Final Answer: Acme Corp sells three products: Widget A ($99), Widget B ($149), and Widget C (pricing not listed).
Notice how the agent's thinking adapts at each step based on what it observes.
Why ReAct Outperforms Alternatives
Research showed that ReAct agents make fewer reasoning errors than pure chain-of-thought agents because they can verify assumptions by looking things up. They also produce more traceable outputs than pure action agents because every action is preceded by an explicit rationale.
This combination of transparency and grounding makes ReAct especially useful for tasks involving:
- Multi-step research and information gathering.
- Tasks where intermediate results can change the plan.
- Workflows where auditability of the agent's reasoning is important.
ReAct in Modern Frameworks
Most production agent frameworks (LangChain's AgentExecutor, LlamaIndex's ReActAgent) implement ReAct or a close variant. When building agents with KnowledgeSDK's web intelligence tools, a ReAct setup lets the agent reason about which URLs to scrape, extract them via /v1/extract, and adapt its research plan based on what it finds — all in a principled, debuggable way.