BroadRouter
Get started

ReAct (reason and act)

Updated

ReAct (reason and act) is a prompting pattern, introduced by Yao et al. in 2022, in which a language model interleaves reasoning traces with actions such as search or tool calls. It reads each observation, updates its plan, and repeats until it can give a final answer.

Also called: ReAct agent, ReAct prompting, ReAct pattern, ReAct framework

ReAct is the pattern behind most agent loops: think, act, look at the result, think again.

How it works

The ReAct paper (Yao et al., 2022) prompts a model to “generate both reasoning traces and task-specific actions in an interleaved manner.” The paper says the reasoning traces “help the model induce, track, and update action plans as well as handle exceptions,” while actions let the model gather facts from outside sources.

In the original text-based form, a few examples in the prompt teach the model a format like this:

Question: Which city hosted the event the author attended in 2019?
Thought: I need to find which event the author attended in 2019.
Action: search["author 2019 event"]
Observation: The author spoke at a conference in Lisbon in 2019.
Thought: The event was in Lisbon. That answers the question.
Action: finish["Lisbon"]

Your code parses each Action, runs it, and appends the Observation before calling the model again.

On HotpotQA and Fever, the paper reports that ReAct reduced hallucination and error propagation by querying a simple Wikipedia API. Because every step is written out, the trajectories were also easier to inspect than those of baselines without reasoning traces.

Today, the same loop usually runs through structured tool calling instead of parsed text. The OpenAI Agents SDK runner, for example, calls the model, runs any tool calls it returns, appends the results and calls the model again until a final answer arrives.

Why it matters

  • Grounding. Acting on real data between thoughts cuts the guessing that leads to hallucination.
  • Debugging. Each thought and observation is visible, so you can see where a run went wrong.
  • Token cost. Every Thought, Action and Observation stays in the history and is resent on the next turn. A 10-step ReAct run sends its early steps 10 times. The agent token budget post breaks this down.
  • Reasoning models. Models that reason before they answer do part of the “Thought” work internally, as reasoning tokens.

On BroadNet Inference

You can run a ReAct loop against any BroadNet chat model, either with a text format and few-shot examples or with structured tools. BroadNet’s docs list tool calling for GLM 5.3 and Qwen3.8 27B. Tool calling with open models shows the request shapes.

DeepSeek V4.1 Flash, GLM 5.3 and Qwen3.8 27B reason before they answer, and the reasoning counts toward max_tokens. Leave room for it on each step, or set reasoning_effort to low.

Questions

Is ReAct the same as chain-of-thought?

No. Chain-of-thought is reasoning only. ReAct adds actions in between, so the model can look things up and correct itself based on what it finds instead of relying only on what it already knows.

Do I still write Thought and Action lines in prompts today?

Usually not. Modern APIs return structured tool calls, and reasoning models think before answering. The ReAct idea, reason then act then observe, lives on in the agent loop of most frameworks.

What did the ReAct paper show?

The authors report that on ALFWorld and WebShop, ReAct beat imitation and reinforcement learning methods by an absolute success rate of 34% and 10%, prompted with only one or two in-context examples.

Read as MarkdownAsk ChatGPTAsk ClaudeAsk Perplexity