---
id: "prereq-react-loop"
type: "prereq"
source_timestamps: ["§ Bash + Code as a General Purpose Tool"]
tags: ["agent-patterns"]
related: ["concept-bash-general-tool"]
reason: "Fundamental to understanding how agents execute tools and why general-purpose tools like bash are an evolution of this pattern."
---
# ReAct Loop

## What It Is

The **ReAct (Reasoning + Acting) loop** is the foundational pattern for tool-using LLM agents:

1. **Reason** — the model emits a thought / plan step.
2. **Act** — the model emits a tool call.
3. **Observe** — the harness executes the tool and returns the observation.
4. **Repeat** — the model sees the observation and decides the next step.

This cycle continues in a while loop until the model emits a final answer or the harness terminates it.

## Why It Matters for This Source

The article assumes the reader understands ReAct. Modern harnesses ([[concept-agent-harness]]) implement ReAct-style loops as their inner control flow.

[[concept-bash-general-tool|Bash as a general-purpose tool]] is best understood as an **evolution of ReAct**: instead of selecting from a small menu of typed tools at each Act step, the model emits arbitrary shell commands. The reasoning/observation cycle is identical; the action space is just much larger.

[[concept-ralph-loop|Ralph Loops]] also build on ReAct — they wrap the ReAct loop in an outer loop that re-initializes context.
