Definition

The ReAct framework is an approach to building AI agents that interleaves reasoning and action within a single loop driven by a language model. Short for Reasoning + Acting, ReAct instructs a model to alternate between generating natural-language thoughts – reasoning about the current state of a task – and taking concrete actions, such as calling a tool, reading a file, or executing a command. The model’s internal reasoning and its external behavior are both expressed as token sequences within the same textual context, making the agent’s control flow entirely dependent on next-token prediction.

How It Works

A ReAct agent operates through a repeated loop: the language model receives a prompt describing the task, available tools, and prior context; generates a reasoning trace (a Thought); selects an action to take (an Action); receives an observation from the environment (an Observation); and then repeats the process until the task is complete or a stopping condition is met. Because planning, decision-making, branching logic, and execution are all encoded as free text inside the model’s context window, ReAct agents behave as stochastic processes rather than deterministic programs. This means decisions such as when to retry, when to stop, and how to recover from errors are inferred from next-token probabilities rather than explicitly specified. The approach is prompt-driven and does not require training a new model for each task, but it produces high variance in cost, latency, and accuracy across runs, particularly in long-horizon settings.

What It Is Used For

The ReAct framework is widely used as a baseline architecture for building and evaluating general-purpose AI agents. It underpins many tool-using LLM systems, coding assistants, and research agents because it requires no custom orchestration infrastructure and can be implemented with a simple prompt and a tool-calling API. ReAct is commonly applied in tasks involving web search, code execution, question answering over documents, and interactive data analysis. However, its reliance on token-generated control flow makes it susceptible to failures in long, complex tasks – such as getting stuck in loops, diverging from an original plan, or committing prematurely to an incorrect solution – which has prompted the development of more structured orchestration alternatives for enterprise and production settings.