# ReAct Pattern

Read on taskade.com: https://www.taskade.com/wiki/ai/react-pattern

Build your own app with Taskade Genesis: https://www.taskade.com/create

> ReAct is the foundational pattern behind every modern AI agent: reason, act, observe, repeat. Learn how it works, why it beat prior approaches, and how Taskade Genesis agents use it.

- Source: https://www.taskade.com/wiki/ai/react-pattern
- Section: AI Concepts
- Index of all pages: https://www.taskade.com/wiki/llms.txt

**Definition:** The **ReAct pattern** (Reasoning + Acting) is the agent architecture that interleaves natural-language reasoning with [tool use](https://www.taskade.com/wiki/ai/tool-use) in a single loop. Introduced by Shunyu Yao and collaborators at Princeton and Google Research in [the 2022 paper "ReAct: Synergizing Reasoning and Acting in Language Models"](https://arxiv.org/abs/2210.03629), ReAct is the template every production agent framework — LangChain, CrewAI, Anthropic's SDK, OpenAI's Agents API, Taskade's [AI Agents v2](https://www.taskade.com/agents) — is built on today.

The core insight is that pure [chain-of-thought](https://www.taskade.com/wiki/ai/chain-of-thought) reasoning is blind to the world — the model can only think about what it already knows. Pure tool-calling is mindless — the model acts without planning. ReAct fuses the two: the model **reasons** about what to do, **acts** by calling a tool, **observes** the result, and **reasons** again. This loop runs until the agent produces a final answer.

## Why ReAct Defines the Agentic Era

Before ReAct, AI systems fell into two buckets. Chain-of-thought models could solve logic puzzles but could not look anything up. Tool-calling systems could search the web but could not plan a two-step task. Neither was an agent.

ReAct collapsed the two into a single loop, and in doing so created the template for every real-world agent that followed. By 2024, every published agent benchmark — HotpotQA, ALFWorld, WebShop, SWE-Bench — was dominated by ReAct-style systems. By 2026, the pattern is so universal that most engineers do not name it. They just build agents.

Four properties made ReAct durable:

1. **Composable with any toolset.** No special infrastructure. Just a prompt and a loop.
2. **Compatible with frontier models.** Works out of the box with every [function-calling](https://www.taskade.com/wiki/ai/function-calling) LLM.
3. **Inspectable.** Every reasoning step is plain text. Bugs are readable.
4. **Scales down and up.** Works for a two-step web search or a thousand-step [Taskade Genesis](https://www.taskade.com/wiki/genesis) app build.

## The ReAct Loop

```mermaid
stateDiagram-v2
    [*] --> Thought
    Thought --> Action: emit tool_call
    Action --> Observation: tool executes
    Observation --> Thought: evaluate + plan next
    Thought --> FinalAnswer: goal reached
    FinalAnswer --> [*]
    Thought --> Thought: refine reasoning
    Observation --> Action: retry different tool
```

Every production agent framework — LangChain, CrewAI, LangGraph, Anthropic's SDK, OpenAI Agents API, Taskade [AI Agents v2](https://www.taskade.com/agents) — is a variant of this state machine. The sophistication comes from the tool catalog and the termination logic, not the topology.

![Multi-agent collaboration running a ReAct loop per agent](https://www.taskade.com/static_images/multi-agent-collaboration-v2.gif)

## How the ReAct Loop Works

A ReAct trajectory has three repeating moves:

**Thought** — A free-text chain-of-thought step where the model reasons about the current state and decides what to do next. "I need to find Ottavia's current role at Taskade. I should search the company website first."

**Action** — A structured [function call](https://www.taskade.com/wiki/ai/function-calling) invoking a tool. `search_web(query: "Ottavia Taskade team page")`.

**Observation** — The runtime executes the action and returns the raw result to the model. "Top result: taskade.com/team. Snippet: Ottavia leads marketing..."

The loop continues: new Thought, new Action, new Observation, until the model produces a **Final Answer** instead of another action.

```
Thought: I need to find X.
Action: search_web(query="X")
Observation: [result]

Thought: The result says Y. I should verify by checking Z.
Action: fetch_url(url="https://example.com/z")
Observation: [content]

Thought: I now have enough. The answer is...
Final Answer: ...
```

This is the entire pattern. Everything else is implementation detail.

## ReAct vs Plan-and-Execute vs Reflexion

ReAct is one point in a design space that has evolved since 2022:

| Pattern | Shape | Strength | Weakness |
|---------|-------|---------|---------|
| Chain-of-Thought | Reason → answer | Cheap reasoning | Blind to the world |
| Tool-calling only | Act → answer | Fast for simple queries | No planning |
| **ReAct** | Reason ↔ act ↔ observe | Balanced, general | Can loop on hard problems |
| Plan-and-Execute | Plan once → act many | Faster, deterministic plans | Brittle when the plan is wrong |
| Reflexion | Act → evaluate → retry | Learns from failures | Needs explicit critique signal |
| Tree-of-Thought | Branch and backtrack | Solves search problems | Token-expensive |

The [plan-and-execute agents](https://www.taskade.com/wiki/ai-agents/plan-and-execute) page covers the planner, executor, and replanner split in depth, with the ReWOO and LLMCompiler variants. Modern production systems often blend patterns. [Taskade Genesis app generation](https://www.taskade.com/wiki/genesis/app-builder) uses plan-and-execute at the outer loop (Taskade EVE drafts a plan first) and ReAct at the inner loop (each step reasons and acts). [Multi-agent teams](https://www.taskade.com/wiki/ai-agents/multi-agent-teams) use ReAct inside each agent and a coordination protocol between them.

## The Three Ingredients

A ReAct agent needs exactly three things to work:

**A reasoning-capable model.** Any frontier LLM with [chain-of-thought](https://www.taskade.com/wiki/ai/chain-of-thought) and [function-calling](https://www.taskade.com/wiki/ai/function-calling) support. This is every model from OpenAI, Anthropic, and Google shipped since 2023.

**A tool catalog.** The set of [tools](https://www.taskade.com/wiki/ai/tool-use) the agent can call, each with a name, description, and JSON Schema. A research agent might have `search_web`, `fetch_url`, `summarize`. A [Taskade agent](https://www.taskade.com/wiki/ai-agents) has built-in tools plus whatever [custom tools](https://www.taskade.com/wiki/ai-agents/custom-commands) you register.

**A runtime loop.** The glue code that parses tool calls, executes them, injects observations, and decides when the agent is done. Modern SDKs (Anthropic's `tools`, OpenAI's Agents API, LangGraph) provide this out of the box.

That is the full ReAct stack. The sophistication of a production agent comes from the quality of the tool catalog and the termination logic, not from exotic architecture.

## Stop Conditions

A ReAct loop needs to know when to stop. Common conditions:

- **Final Answer produced** — The model emits a final answer token or `end_turn` signal.
- **Step budget exceeded** — Hard cap on total iterations (typically 10–50) to prevent runaway loops.
- **Token budget exceeded** — Total input+output tokens above a threshold.
- **User interrupt** — In interactive UIs, the user cancels the task.
- **Tool error budget** — After N consecutive tool failures, give up and surface the error.

Missing stop conditions is the single most common cause of runaway agent bills. Every production agent needs all five. [Agent stop conditions](https://www.taskade.com/wiki/ai-agents/agent-stop-conditions) groups them into four exits (done, stuck, over budget, hand off) and shows how to write a done test.

## ReAct in Multi-Agent Systems

When multiple agents collaborate, ReAct runs inside each one. The manager agent reasons about task decomposition, acts by delegating to a specialist (treating the specialist as a tool), and observes the specialist's return. The specialist agent runs its own internal ReAct loop to produce that return.

This recursive pattern is how [Taskade multi-agent teams](https://www.taskade.com/wiki/ai-agents/multi-agent-teams) scale. Each agent is a ReAct loop. Each delegation is a [function call](https://www.taskade.com/wiki/ai/function-calling). The whole team is a tree of loops, rooted at the user's original goal.

## ReAct in Taskade Genesis

Every [AI agent](https://www.taskade.com/wiki/ai-agents) you create in Taskade runs a ReAct loop. So does [EVE](https://www.taskade.com/wiki/genesis/eve), the meta-agent that builds [Taskade Genesis apps](https://www.taskade.com/wiki/genesis/app-builder) from a prompt. The loop looks the same at every level:

1. User gives a goal ("Build a CRM with a contact form and a Slack notification").
2. EVE reasons about what components are needed (database, form, automation).
3. EVE calls build tools in sequence — create project, add database, design form, wire automation.
4. After each call, EVE observes the result and decides the next step.
5. When ambiguity arises, EVE calls the [Ask Questions tool](https://www.taskade.com/wiki/ai-agents/ask-questions) to pause and ask you.
6. When the app is complete, EVE produces a final summary and hands it back.

The same loop runs every time a user triggers an [automation](https://www.taskade.com/wiki/automation) — the agent receives the trigger payload, reasons, calls integrations, observes results, and finishes. Taskade's [durable execution](https://www.taskade.com/wiki/automation/durable-execution) layer persists the full ReAct trace, so you can inspect every thought and action in the Runs tab.

## Common Pitfalls

**Runaway loops.** Agents get stuck alternating between two tools. Enforce a step budget and watch for repeated tool-call signatures.

**Tool soup.** Giving the agent 50 tools with vague descriptions. ReAct accuracy drops fast past ~30 tools. Group related tools or tier them.

**Thought-free actions.** Some implementations strip the Thought step to save tokens. This breaks ReAct — the reasoning is not decoration, it is the memory between steps.

**No observation parsing.** If the observation is a 10K-token JSON blob, the model's attention fragments. Pre-process tool results before injecting them.

**Missing stop conditions.** See the list above. Always set a step budget.

## Related Concepts

- [Chain-of-Thought](https://www.taskade.com/wiki/ai/chain-of-thought) — The reasoning half of ReAct
- [Tool Use](https://www.taskade.com/wiki/ai/tool-use) — The acting half of ReAct
- [Function Calling](https://www.taskade.com/wiki/ai/function-calling) — The wire format for actions
- [Agentic AI](https://www.taskade.com/wiki/ai/agentic-ai) — The paradigm ReAct implements
- [Multi-Agent Systems](https://www.taskade.com/wiki/ai/multi-agent-systems) — ReAct loops composed
- [Agentic RAG](https://www.taskade.com/wiki/ai/agentic-rag) — ReAct applied to retrieval
- [AI Agents](https://www.taskade.com/wiki/ai-agents) — Where ReAct is the default

## Frequently Asked Questions About ReAct Pattern

### What is the ReAct pattern in AI agents?

ReAct (Reasoning + Acting) is the agent architecture that interleaves [chain-of-thought](https://www.taskade.com/wiki/ai/chain-of-thought) reasoning with [tool calls](https://www.taskade.com/wiki/ai/tool-use) in a repeating loop. The model thinks, acts, observes the result, and thinks again until it produces a final answer.

### Who invented the ReAct pattern?

ReAct was introduced by Shunyu Yao and collaborators at Princeton and Google Research in the 2022 paper "ReAct: Synergizing Reasoning and Acting in Language Models." It has since become the default agent architecture across every major framework.

### How is ReAct different from plan-and-execute?

Plan-and-execute drafts the full plan upfront and then runs the steps. ReAct interleaves planning and execution — the model reasons about the next step, acts, observes, and re-plans. ReAct is more adaptive; plan-and-execute is faster and more deterministic when the plan is right.

### Do Taskade agents use ReAct?

Yes. Every Taskade AI agent, including [EVE](https://www.taskade.com/wiki/genesis/eve) and every [Taskade Genesis app](https://www.taskade.com/wiki/genesis) agent, runs a ReAct loop with access to built-in tools plus any custom tools you register. The full ReAct trace is logged in the automation Runs tab for inspection.

### What stops a ReAct loop from running forever?

Production ReAct systems enforce stop conditions: a step budget (max iterations), a token budget, a tool-error budget, and a user-interrupt hook. Without these, an agent can loop indefinitely between tools. Taskade enforces all four automatically.

## Further Reading

- [What Are AI Agents?](https://www.taskade.com/blog/what-are-ai-agents) — The full story of modern agents
- [Multi-Agent Collaboration: Production Lessons](https://www.taskade.com/blog/multi-agent-production)
- [AI Agent 26 Tools: The Right Number](https://www.taskade.com/blog/ai-agent-tools)
- [AI Agents v2 Capabilities](https://www.taskade.com/agents) — The Taskade Genesis agent platform
