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.