Skip to contentNew: Does ChatGPT recommend your brand? Free 60-second AI visibility check →
By The DDH Team · Digital Dashboard Hub

How to Use ReAct Prompting

ReAct prompting interleaves reasoning and actions in a loop — Thought, Action, Observation, repeat — so the model can think, call a tool, read the result, and decide what to do next instead of guessing in one shot.

By The DDH Team at Digital Dashboard HubUpdated

To use ReAct prompting, structure the model's output as a repeating loop of three steps: a **Thought** (reasoning about what to do next), an **Action** (a tool call, such as a search or calculation), and an **Observation** (the result that comes back). The model keeps cycling — Thought, Action, Observation — until it has enough information to emit a final answer. This lets it ground its reasoning in real, fetched facts instead of hallucinating, and it is the backbone of most modern AI agents.

ReAct was introduced by Yao et al., 2022, "ReAct: Synergizing Reasoning and Acting in Language Models" (arXiv:2210.03629), which showed that interleaving reasoning traces with tool actions beats reasoning-only or acting-only baselines. It extends chain-of-thought prompting by letting the reasoning trigger external actions, and it underpins production tool-use systems described in tool use and MCP for production LLM systems. You can draft a ReAct-style system prompt for free — no signup, free forever — with the ChatGPT Prompt Generator.

Digital Dashboard Hub

Writing good prompts for ONE AI is hard. Writing them for GPT-5, Claude, Gemini, Perplexity, Midjourney and 6 more is a full-time job. DDH's AI Prompt Builder writes once, runs everywhere — locked to your niche, voice, and brand tone.

Free 14 days, no card.

Chain-of-thought vs. function calling vs. ReAct

Feature
Chain-of-thought
Function calling
ReAct
Reasons step by step?
Can call tools / take actions?
Grounds answers in fetched facts?Depends on the tool
Best forSelf-contained multi-step reasoningStructured single tool callsMulti-step tasks needing fresh data or tools
Underpins modern agents?Partly
OriginWei et al. 2022Vendor tool-use APIsYao et al. 2022

Sources: [Yao et al. 2022, arXiv:2210.03629](https://arxiv.org/abs/2210.03629); [Wei et al. 2022, arXiv:2201.11903](https://arxiv.org/abs/2201.11903); [DAIR.ai Prompt Engineering Guide](https://www.promptingguide.ai/); [OWASP LLM Top 10](https://genai.owasp.org/llm-top-10/). Current as of June 2026.

What is ReAct prompting?

ReAct stands for **Rea**soning + **Act**ing. The model is prompted to alternate between two modes: generating reasoning (a Thought) and taking an action in the world (an Action), then reading what the action returns (an Observation). It repeats this cycle until it can produce a final answer. The pattern was named and formalized by Yao et al. 2022.

The reason it works is grounding. Pure chain-of-thought reasons in a vacuum — if the model misremembers a fact, the whole chain is built on sand. ReAct lets the reasoning trigger a real lookup (a web search, a database query, a calculator), so the next Thought is conditioned on a true Observation rather than on the model's guess. Reasoning steers which actions to take; observations correct the reasoning.

In modern stacks, ReAct is implemented through function calling or tool use rather than freeform text. The model emits a structured tool call, the runtime executes it and returns the result, and the model continues. The Model Context Protocol (MCP) is one common way to expose tools — see tool use and MCP for production LLM systems. Conceptually it is still Thought, Action, Observation.


When does ReAct help (and when is it overkill)?

ReAct is the right pattern whenever the answer depends on information or capabilities the model does not have in its weights:

**Fresh or external facts.** Questions about current events, prices, inventory, or anything past the training cutoff — the model searches or queries instead of guessing.

**Multi-step tasks over tools.** Look up a record, transform it, then write it somewhere; or search, then calculate, then summarize. Each step's Observation informs the next Thought.

**Anything where hallucination is costly.** Grounding reasoning in fetched facts dramatically reduces made-up answers, which is why ReAct underpins research assistants and retrieval workflows. It pairs naturally with retrieval-augmented generation.

Skip ReAct when the task needs no tools — a self-contained rewrite, a creative draft, or reasoning over text already in the prompt. There, adding a tool loop just slows things down and invites unnecessary calls. Also keep an eye on security: any system that lets a model take actions widens the attack surface, so review the prompt injection defense checklist and the OWASP LLM Top 10 before shipping.

Use ReAct when: the answer needs fresh facts, external data, or tool actions (search, calculation, database, API), or when grounding reasoning in real results is worth the extra latency — the foundation of most agents.
Skip it when: the task is self-contained (creative writing, rewriting, reasoning over text already provided) — a tool loop just adds latency and an attack surface with no upside.


Before / after: a ReAct prompt

Here is a direct prompt that forces the model to answer from memory, which invites a stale or invented answer:

``` What's the current starting price of the Anthropic Claude API for the most capable model, and how does that compare to OpenAI's flagship? ```

Pricing changes, so a from-memory answer is risky. Now the ReAct version, which tells the model to think and act in a loop:

``` Answer the question using this loop. Repeat until you can answer: Thought: reason about what you need next. Action: one of search[query] or calculate[expression]. Observation: (the tool result will be inserted here) When you have enough, output: Final Answer: ... Rules: never state a price from memory — always search[] for it first and cite the source URL in the Final Answer. Question: What's the current starting price of Anthropic's most capable Claude model vs. OpenAI's flagship? ```

Expected trace:

> Thought: I need current Anthropic pricing. I'll search. > Action: search[Anthropic Claude API pricing] > Observation: (returns the official pricing page) > Thought: Now I need OpenAI's flagship pricing. > Action: search[OpenAI API pricing] > Observation: (returns the official pricing page) > Thought: I have both, with sources. I can answer. > Final Answer: ... (with links to https://www.anthropic.com/pricing and https://openai.com/api/pricing/)

The explicit loop plus the 'never from memory' rule forces grounding. In a production setup the search[] and calculate[] actions become real function/tool calls rather than text, but the Thought-Action-Observation structure is identical.


ReAct vs. chain-of-thought vs. plain function calling

Chain-of-thought reasons but cannot act — it has no way to fetch facts. Plain function calling can act but, on its own, does not necessarily reason out loud about why it is calling a tool or what to do with the result. ReAct combines both: reasoning decides which action to take, and the observation feeds the next round of reasoning. That feedback loop is the whole point.

In 2026 the line is blurry because frontier models do ReAct-style loops natively when given tools — GPT-5.5 and Claude Opus 4.8 will reason about, call, and chain tools without you spelling out the Thought/Action/Observation labels. The explicit ReAct template is still useful for transparency, debugging, and for steering smaller or non-reasoning models. For the structured-output side of tool calls, see function calling vs. structured output and the DAIR.ai Prompt Engineering Guide.

How to write a ReAct prompt, step by step

  1. 1

    Define the available actions

    List the tools the model may use and their exact call format, e.g. search[query], calculate[expression], lookup[id]. The model can only act through tools you declare, so be explicit. This is the action space from Yao et al. 2022.

  2. 2

    Specify the Thought-Action-Observation loop

    Instruct the model to emit a Thought (reasoning), then an Action (one tool call), then wait for the Observation, and repeat. Make the three labels explicit so the trace is parseable and auditable.

  3. 3

    Add a grounding rule

    Tell the model what it must never answer from memory (prices, current facts, anything time-sensitive) and require it to fetch and cite instead. This rule is what converts ReAct from a format into a hallucination guard.

  4. 4

    Set a stop condition and final-answer format

    State when the loop ends ('when you can answer the question') and how the final answer should look, e.g. 'Final Answer: ... with source URLs'. Without a stop condition the loop can run forever.

  5. 5

    Cap the number of steps

    Add a limit like 'use at most 5 actions; if you can't answer, say so and explain what's missing'. A step cap controls cost, latency, and runaway loops in production.

  6. 6

    Wire actions to real tools

    Move from text actions to real function calling or MCP tools so the runtime actually executes search[] and calculate[] and feeds back true observations. See tool use and MCP for production LLM systems.

  7. 7

    Add injection defenses before shipping

    Because the model now acts on external content, treat every Observation as untrusted input. Sanitize tool outputs and follow the prompt injection defense checklist and OWASP LLM Top 10.

Frequently Asked Questions

What is ReAct prompting?

ReAct (Reasoning + Acting) is a prompting pattern where the model alternates between a Thought (reasoning about what to do), an Action (a tool call like a search or calculation), and an Observation (the result), repeating the loop until it can give a final answer. It was introduced by Yao et al. 2022 (arXiv:2210.03629) and is the foundation of most modern AI agents.

How do I write a ReAct prompt?

Declare the available actions and their call format, then instruct the model to output Thought, then Action, then read the Observation, and repeat until it can emit 'Final Answer'. Add a rule that it must fetch (not recall) any time-sensitive fact, a step cap, and a stop condition. The ChatGPT Prompt Generator can scaffold this for you.

What is the difference between ReAct and chain-of-thought?

Chain-of-thought reasons step by step but cannot take actions — it has no way to fetch facts, so it can build on wrong assumptions. ReAct lets the reasoning trigger real tool actions and then conditions the next reasoning step on the actual result, which grounds the answer and cuts hallucination.

When should I use ReAct prompting?

Use ReAct whenever the answer depends on fresh facts, external data, or tool actions — current events, prices, database records, calculations, or multi-step workflows over APIs. Skip it for self-contained tasks like creative writing or rewriting text already in the prompt, where a tool loop only adds latency.

Is ReAct the same as an AI agent?

ReAct is the core reasoning-and-acting loop that most agents are built on, but an agent is more: it adds memory, planning, multiple tools, and often guardrails on top of the loop. You can think of ReAct as the engine and an agent as the full vehicle. See tool use and MCP for production LLM systems.

Do GPT-5.5 and Claude do ReAct automatically?

Largely yes. As of June 2026, frontier models like GPT-5.5 and Claude Opus 4.8 will reason about, call, and chain tools natively when you give them tool access, without you spelling out Thought/Action/Observation labels. The explicit ReAct template is still useful for transparency, debugging, and steering smaller or non-reasoning models.

Is ReAct prompting a security risk?

It widens the attack surface because the model now takes actions and reads external content. Every Observation should be treated as untrusted input that could contain a prompt-injection payload. Sanitize tool outputs, restrict what actions are allowed, and follow the prompt injection defense checklist and OWASP LLM Top 10.

How does ReAct relate to RAG?

They are complementary. Retrieval-augmented generation fetches relevant documents into context; ReAct decides, through reasoning, when and what to retrieve and what to do with the results. A ReAct loop can call a retrieval tool as one of its actions, making RAG one move within the larger reason-and-act cycle.

Build a ReAct system prompt in seconds.

The ChatGPT Prompt Generator scaffolds the Thought-Action-Observation loop, tool definitions, and stop conditions. Free, no signup, free forever — part of 40+ free prompt tools.

Browse all prompt tools →