knowledgesdk.com/glossary/react
AI Agentsintermediate

Also known as: Reasoning + Acting

ReAct

A prompting framework that interleaves Reasoning traces and Action steps, enabling agents to plan while gathering information.

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:

  1. Thought — The model's internal reasoning about the current state. What does it know? What does it need? What action should it take?
  2. Action — A specific tool call or step the agent will execute (e.g., Search["KnowledgeSDK API"]).
  3. 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.

Related Terms

AI Agentsbeginner
Agent Loop
The iterative perceive–think–act cycle that AI agents execute until a goal is achieved or a stopping condition is met.
AI Agentsbeginner
Chain of Thought
A prompting technique that encourages LLMs to reason step-by-step before producing a final answer, improving accuracy on complex tasks.
AI Agentsbeginner
Tool Use
The ability of an LLM-powered agent to call external functions, APIs, or services to gather information or take actions.
AI Agentsintermediate
Reflection
A self-evaluation step in which an agent critiques its own outputs or reasoning and revises them to improve quality.
Re-rankingRecall

Try it now

Build with ReAct using one API.

Extract, index, and search any web content. First 1,000 requests free.

GET API KEY →
← Back to glossary