CLOUD CONCEPT

ReAct

ReAct is an agent design pattern that interleaves reasoning, tool actions, and observations so a foundation model can solve problems using external evidence.

Cloud Concepts Hub →

What is ReAct

ReAct, short for reasoning and acting, lets an agent decide what information or operation it needs next, invoke an appropriate tool, and use the result to guide its next decision. It matters when a task requires multiple dependent steps, current information, calculations, or controlled interactions with external systems rather than a single generated answer.

ReAct combines reasoning and acting in an iterative problem-solving loop. An agent evaluates a task and the evidence available so far, selects an action, receives an observation from the environment, and decides whether to continue or provide a final answer. Actions commonly include searching documents, querying a database, running a calculation, or calling an application API. Observations are the actual results of those actions, not results invented by the model.

The central benefit is adaptive decomposition. Instead of generating an entire plan and assuming every step will succeed, the agent can revise its approach after each observation. For example, an incident investigation assistant might retrieve a failed deployment's metadata, inspect relevant error metrics, and then query configuration history only if the first results suggest a configuration change. Each tool result influences what happens next.

In cloud applications, the model usually proposes tool calls while application code or a managed agent runtime executes them. The tool interface should define the operation, input schema, output structure, and expected error responses. The execution layer validates arguments, checks authorization, invokes the tool, and returns a structured observation. A model-generated request is a proposal, not permission to perform an operation.

AWS Step Functions can implement this loop as an explicit workflow. A Task state invokes a foundation model through Amazon Bedrock or application code. A Choice state routes a structured response to tool execution, completion, or error handling. Another Task executes the selected operation, and the workflow adds its result to the interaction context before invoking the model again. The workflow must explicitly track iteration limits, remaining budget, and stopping conditions; Step Functions does not supply ReAct reasoning automatically.

For example, a support agent investigating an incorrect invoice could retrieve the invoice, query the applicable pricing agreement, and calculate the expected amount. If the agreement is missing, the next action should request clarification or escalate rather than invent a discount. Issuing a refund should be a separate, authorized operation with approval requirements and an idempotency key, because retries must not create duplicate financial transactions.

ReAct is related to, but not synonymous with, chain-of-thought reasoning. Chain-of-thought approaches involve intermediate reasoning, whereas ReAct specifically couples decision-making with actions and feedback from the environment. Traditional ReAct demonstrations show thought, action, and observation traces, but production implementations do not need to expose or store private model reasoning. Structured tool requests, observations, concise decision summaries, and final answers provide useful operational records without requiring disclosure of internal reasoning.

The trade-offs include additional model calls, tool latency, token consumption, and more failure paths than a fixed workflow. Agents can repeat unsuccessful actions, choose irrelevant tools, or follow malicious instructions embedded in retrieved content. Enforce maximum iterations, timeouts, bounded retries, least-privilege tool permissions, and approval gates for consequential operations. Treat tool output as untrusted data, not instructions that can override application policy.

ReAct does not guarantee factual correctness, optimal planning, or successful execution. Retrieval-augmented generation alone is not necessarily ReAct, and a single tool call does not establish an iterative reasoning-and-action loop. Prefer deterministic workflows when the required sequence is already known. Evaluate ReAct systems using task success, evidence quality, tool-selection accuracy, unauthorized-action attempts, latency, and cost rather than the apparent sophistication of their explanations.

Key aspects of ReAct

ReAct combines adaptive tool selection and external feedback with explicit execution controls, bounded loops, and outcome-based evaluation.

Interleaved reasoning and action

The agent selects a next action using its task context and previous observations, rather than committing to an unchanging sequence. Tool results can change both the next step and the final answer.

Evidence-driven problem decomposition

Complex requests are broken into smaller information-gathering or execution steps. Each step should resolve a specific uncertainty or advance a measurable task objective.

Explicit tool contracts

Tools expose defined operations with validated inputs and structured results. Keep authorization and execution controls outside the model so generated arguments cannot bypass application policy.

Bounded orchestration

Use explicit completion conditions, iteration limits, timeouts, and cost budgets. Handle tool failures as observations when recovery is appropriate, and terminate or escalate when progress stops.

Controlled side effects

Separate read-only investigation from operations that modify resources or business records. Require appropriate approval and use idempotent execution for actions that might be retried.

Observable, testable behavior

Record tool requests, validated arguments, results, execution status, and concise decision summaries with sensitive data protected. Evaluate observable outcomes without depending on access to private model reasoning.

Cloud services for ReAct

In a custom implementation, AWS Step Functions coordinates a bounded loop, Amazon Bedrock supplies model inference, and AWS Lambda executes validated tools. Each tool result becomes an observation for the next model invocation until the workflow reaches completion, an approval boundary, or an execution limit. Amazon CloudWatch captures operational signals across these components. Alternatively, Agents for Amazon Bedrock can manage much of the agent orchestration, with Lambda-backed action groups providing application operations. Choose a clear orchestration owner so nested loops do not create uncontrolled retries or unexpected costs.

AWS Step Functions image AWS Step Functions

Implements the control flow around a ReAct agent using Task and Choice states, explicit loops, retries, and error handling. The application must define the model interaction, tool dispatch, iteration counters, and termination rules.

Open AWS Step Functions →
Amazon Bedrock

Provides foundation model inference and, for supported models, tool-use interfaces that an application can use to build a ReAct loop. Agents for Amazon Bedrock provides managed orchestration for multistep tasks involving action groups and knowledge retrieval; this is an alternative to building the entire loop yourself.

Open Amazon Bedrock →
AWS Lambda image AWS Lambda

Runs tool adapters that validate inputs, call business APIs, perform calculations, and return structured observations. Execution roles and application-level authorization constrain what each tool can do.

Open AWS Lambda →
Amazon CloudWatch image Amazon CloudWatch

Collects application logs and metrics for agent iterations, tool errors, latency, and termination outcomes. Use correlation identifiers and redact sensitive inputs and outputs to make investigations useful without unnecessarily exposing data.

Open Amazon CloudWatch →