esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

What Is ReAct Prompting?

What ReAct prompting is, the think, act, observe loop, how it differs from chain-of-thought, and where it falls short, explained for your AI interview.

In short

ReAct prompting makes a language model take turns: it writes a short thought, asks a tool for one action, reads the result, then thinks again. It came from a 2022 paper, and it keeps answers tied to real lookups instead of memory alone.

11 min readIntermediateCommon · estimateFacts checked 26 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

ReAct is a prompt style where the model takes turns. It writes a short thought, asks a tool for one action, reads the result, and thinks again. The name joins reasoning and acting. The idea comes from a 2022 paper, and its main point is that the reasoning stays tied to real lookups. The cost is extra calls, so I use it only when the answer depends on outside facts.

What is ReAct prompting, in plain words?

A language model answers from what it learnt in training, and without tools it can't look anything up by itself. ReAct changes the shape of the reply. The model writes a short thought, asks a tool for one action, such as a lookup, reads what the tool returned, then thinks again. It repeats until it has enough to answer. An older method, called chain-of-thought, has the model write out its reasoning step by step, but only from what it already knows.

Think of a claims handler at an insurer. They don't decide from memory. They note what the claim says, pull the policy, read the cover, then choose the next check. Each lookup changes the next move. ReAct asks the model to work the same way, with every step written down.

Key words

Thought
A short written step where the model works out what to do next.
Action
A call to a tool, such as a lookup or a search. Your code runs it.
Observation
What the tool sent back. It goes into the next turn.
Tool
A function your app offers the model, like a policy lookup.
Final answer
The reply the model gives once it has enough evidence.

How does the think, act, observe loop work?

Each turn has three parts. The model writes a thought, which is a plan in plain words. It then picks one action. Your code runs that action and sends back the observation, and the next thought can use it. The loop ends when the model writes a final answer instead of another action. A ReAct prompt first shows the model a few worked examples of thoughts and actions, and the model then follows that pattern.

  • “we explore the use of LLMs to generate both reasoning traces and task-specific actions in an interleaved manner”

    Yao and colleagues, the ReAct paper (abstract)

  • “The model can't run your code, so every tool call is a round trip: the model asks, you execute, you report back, the model continues.”

    Anthropic, tool use docs

The ReAct loop

The question

a claim, a ticket or a customer message

Model

writes a thought, then one action

Tool

looks up a record or runs a search

Final answer

the reply the customer or agent sees

  1. 1The user's question goes in as one message.
  2. 2The model asks for one action, such as a lookup.
  3. 3The tool's result comes back as an observation.
  4. 4Once the evidence is enough, the model answers.
The model writes a thought, asks a tool for one action, and reads the observation that comes back. It repeats until it has enough to answer. Each pass lets the next thought use real results, not guesses from memory.

The paper's own examples show the same trail: the model's thoughts and actions, and what the environment returned. Here is one made-up case for a bank's card team, step by step.

  1. 1

    The customer's claim

    A customer says a hotel charged her card £186 twice on 20 November. The assistant has to decide whether to refund.

  2. 2

    Thought, then action

    Two identical charges on one day, so the transaction log comes first. The model asks the lookup tool for card 4417.

  3. 3

    Observation

    The tool returns two rows for the same hotel and amount: one charge is pending, the other is posted.

  4. 4

    Thought, then final answer

    A pending row can be a hold that clears by itself, so a refund now would be premature. The answer: no refund yet, recheck in three days.

How is it different from chain-of-thought and tool calls alone?

  • Reason only

    Chain-of-thought

    The model thinks step by step, but only from its own memory. Nothing checks a fact, so an invented detail can slip in.

  • Act only

    Tool calls, no written plan

    The model calls tools without writing down why. The trail is harder to follow, and a bad result is harder to spot.

  • ReAct

    Both, in turns

    Each action is planned in writing, and each result shapes the next plan. Answers stay tied to what the tools returned.

Google's research blog said that plain chain-of-thought is not tied to the outside world. The model relies on its own internal representations, which limits its ability to reactively explore and reason or update its knowledge.

The paper's tests show the trade-off. The approach that acts on outside results gave a more factual and grounded trail, while plain chain-of-thought was more accurate at building the reasoning structure. The paper tested ReAct on question answering and fact checking. Its error check of the trade-off used HotpotQA, with 50 sampled trajectories per method.

The paper's best result came from combining the two: ReAct plus chain-of-thought, using both internal knowledge and outside results.

What are the limits of ReAct?

ReAct is not free. Each turn is another model call, so it takes more time and money than a single answer. Fixed steps also make the reasoning less flexible. The paper says that this structure can cause more reasoning errors than chain-of-thought.

A loop can also run too long. If a tool keeps returning nothing useful, the model may keep searching. So you cap the number of steps, and send the case to a person when the cap is hit.

Tip

Asked when to use it? Say it fits when the answer depends on outside facts the model can't know. Say you would skip it for a simple rewrite of text, where one call does the job.

What does a ReAct loop look like in code?

Here is the same card case as a short Python loop. A script plays the model, so you can see the loop itself. In a real app, a model call would produce each thought and action.

Python
# A tiny ReAct loop. A script plays the model, so the output is the same every run.
TRANSACTIONS = {
    "4417": [
        "Harbour Hotel 186.00 pending",
        "Harbour Hotel 186.00 posted",
    ],
}

def lookup_transactions(card):
    return TRANSACTIONS.get(card, ["no rows"])

TOOLS = {"lookup_transactions": lookup_transactions}

# Each turn is (thought, action, input). The script stands in for the model's replies.
SCRIPT = [
    ("Two identical charges on one day. I need the log first.", "lookup_transactions", "4417"),
    ("One is pending. A pending row can be a hold, so check again before refunding.", "finish", "No refund yet. Recheck in 3 days."),
]

for thought, action, arg in SCRIPT:
    print("Thought:", thought)
    if action == "finish":
        print("Final answer:", arg)
        break
    result = TOOLS[action](arg)
    print("Action:", action + "(" + arg + ")")
    print("Observation:", result)

Output

Thought: Two identical charges on one day. I need the log first.
Action: lookup_transactions(4417)
Observation: ['Harbour Hotel 186.00 pending', 'Harbour Hotel 186.00 posted']
Thought: One is pending. A pending row can be a hold, so check again before refunding.
Final answer: No refund yet. Recheck in 3 days.

The loop runs each action, prints what came back, and stops on the final answer. In a real app that result goes back into the model's next prompt. Your code owns the tools, so it can limit or block any call before it runs.

How would you stop a ReAct agent from looping forever?

Set a step limit, so a stuck agent stops after a fixed number of turns. The paper names repeated thoughts and actions as an error pattern specific to ReAct, so watch for the same action repeated with the same input, and treat that as stuck. When it stops, hand the case to a person with the notes so far, instead of letting the model guess.

Tip

A short answer: cap the steps, catch repeats, then hand over to a person.

What does the interviewer want to hear?

A strong answer covers

  • A plain definition: the model writes a thought, takes one action, and reads the result.
  • What ReAct adds: outside facts from tools, and a written plan a person can read.
  • Where it is weak: more calls, more cost, and less flexible reasoning.
  • How it differs from chain-of-thought alone, and from tool calls alone.
  • Safety: a step cap, repeat checks and a handover to a person.

Common traps

  • Trap"ReAct is just chain-of-thought with a different name."

    BetterChain-of-thought uses only memory. ReAct also takes actions and reads what they return.

  • Trap"The model runs the tools itself."

    BetterThe model only asks. Your code runs the tool and sends back the observation.

  • Trap"More thinking steps always make it more accurate."

    BetterEach extra step is another model call, so it adds cost. The paper also found that ReAct's fixed structure led to more reasoning errors than chain-of-thought.

Can you spot the right step?

Spot the best next step

Your claims agent has the policy number and the claim date, but it hasn't read the policy record yet. What is the best next step?

Quick check

Which part of a ReAct turn brings new facts into the model's context?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q078What is chain-of-thought, and when does it help?10 min
  2. Q160What is the agent loop?12 min
  3. Q156What is tool (function) calling?11 min
  4. Q173How do you stop endless agent loops?11 min
  5. Q090What is self-consistency?Coming soon
  6. Q092What is prompt chaining?10 min

Learn it in depth

Last updated on 26 November 2026

Building an agent that looks things up before it answers?

I design and build AI agents with these loops in place: capped steps, checked tool calls and a clear handover to a person. Book a short call and tell me what yours needs to do.