← Back to Blog
AI Agents

ReAct agents: how the reason-and-act loop works

AB
Neotask Team
November 29, 2026
6 min read

A ReAct agent is a language model that alternates between reasoning about a task and acting on it: it writes a thought, calls a tool, reads the result, and repeats until it can answer. The name comes from the 2022 paper "ReAct: Synergizing Reasoning and Acting in Language Models" and has nothing to do with React, the JavaScript library. Most tool-using AI agents today run some version of this loop, even when nobody calls it ReAct.

Where ReAct came from

Shunyu Yao and six co-authors posted the paper on arXiv on October 6, 2022 (arXiv:2210.03629), and the final version was published at ICLR 2023. Before it, two lines of work ran separately. Chain-of-thought prompting had models reason step by step but never check anything against the world. Other work had models take actions but without explicit reasoning between them.

The paper's proposal was to "generate both reasoning traces and task-specific actions in an interleaved manner." In its words, a task-solving trajectory "consists of multiple thought-action-observation steps." For the question-answering tasks, the model had exactly three actions against a simple Wikipedia API: search[entity], lookup[string] and finish[answer].

What the results showed

The paper tested ReAct on four benchmarks. On HotpotQA (multi-hop questions) and FEVER (fact checking), reading Wikipedia as it went helped the model avoid "issues of hallucination and error propagation prevalent in chain-of-thought reasoning." On two interactive tasks, ALFWorld (a text-based household game) and WebShop (a simulated online store), ReAct beat imitation and reinforcement learning methods "by an absolute success rate of 34% and 10% respectively, while being prompted with only one or two in-context examples."

That last part is why the paper mattered. The competing methods were trained on large numbers of examples. ReAct got better results from a prompt.

The loop, step by step

Here is the shape of a ReAct loop, using an everyday task rather than a benchmark:

  1. Thought. The model works out what it needs. "To answer which invoices are overdue, I need the unpaid invoices and their due dates."
  2. Action. It calls a tool with arguments, such as a search over unpaid invoices.
  3. Observation. The tool's result goes back into the model's context.
  4. Thought again. The model reads the result and decides the next step: answer, call another tool, or fix a mistake. If the search returned nothing because of a wrong filter, it tries a different one.
  5. Finish. When it has what it needs, it stops calling tools and answers.

The observation step is what separates an agent from a chatbot. The model's next move depends on what actually came back, so it can notice a failed call and recover instead of carrying on from a wrong assumption.

ReAct in 2026: same idea, different plumbing

The original ReAct prompts had the model write "Thought:" and "Action:" as plain text, which the program then parsed. Model providers have since built tool calling into their APIs: the model returns a structured tool call, the application runs it and sends back the result. The loop is the same, but most production agents no longer parse text. Our tool calling explainer covers that mechanism.

Frameworks have followed. LangGraph's prebuilt create_react_agent "has been deprecated in favor of LangChain's create_agent" (LangGraph v1 release notes, read 2026-11-29), which builds the same tool-calling loop under a general name. LlamaIndex still ships a ReActAgent next to its function-calling agents (LlamaIndex docs). If a tutorial imports create_react_agent, it was likely written before LangGraph 1.0.

Where ReAct loops go wrong

The loop's strength is that the model decides each step. Its weakness is the same. Three failures show up in practice:

  • Repeating itself. The model calls the same tool with the same arguments, gets the same unhelpful result, and tries again.
  • Running long. A loop with no limits keeps spending tokens on a task it cannot finish.
  • Acting when it should ask. A wrong observation leads to a confident action, such as sending an email or deleting a file, that nobody reviewed.

Each of these needs a guard outside the model, because the model is the thing going wrong.

Limits outside the model: Neotask's example

Neotask's agents run a tool-calling loop of this kind. Its runtime adds three checks the model cannot talk its way past:

  • A budget for background runs. A run that works without someone watching, such as a scheduled company task, gets at most 200 tool calls, 15 calls with the same intent and about an hour of working time. When the budget runs out, every further tool call is refused and the run has to report where it got to. The budget exists because loop detection only catches identical calls, and a run can keep probing the same dead end with small variations.
  • Loop detection. The runtime keeps the last 30 tool calls. It warns the agent after 10 identical calls, and blocks the session once the same call has come back with the same result 20 times. A final breaker blocks at 30 such repeats in every case. It runs on background turns.
  • Approvals on risky actions. Each tool call is sorted by what it does. Reading and searching rate low, creating and updating medium, and deleting, sending and running commands high, with a top level for payments and destructive actions that cannot be undone. Your approval mode, Strict, Balanced or Autonomous, decides which of those run, which an automatic check reviews, and which wait for you. Payments always wait for a person, whatever the mode.
A high-risk approval in the Neotask desktop app: the agent asks to run a command listing overdue wholesale invoices

Interactive work has no fixed cap on model calls. A coding session you are watching may need 300 small steps, and it should be able to take them. The budget applies only to unattended background work, where a stuck loop would otherwise run all night.

When a ReAct loop is the wrong shape

ReAct suits tasks where the next step depends on what the last one returned. It is a poor fit when the steps are known in advance. Copying new orders into a spreadsheet every hour does not need a model reasoning between steps, and a fixed workflow will be cheaper and more predictable. Our post on AI agents vs automation tools goes through where each one wins.

Long, multi-part tasks are another case. A single loop holding a whole project in one context tends to lose track of earlier details as the window fills, so larger jobs are usually split into a plan with parts handed to sub-agents. That is the idea behind multi-agent systems, and it is where a ReAct loop stops being the whole agent and becomes one worker inside it.

Deploy AI Agents in Minutes.

Neotask gives you the orchestration layer to build, deploy, and manage AI agents at scale. Voice-controlled, multi-agent, production-ready.

Launch Your First Agent

Start automating in minutes.