What are the three steps in a ReAct loop?
What tools does a ReAct agent use?
Is the ReAct loop used in real production systems?
A thing that demystified agents for me: the "agent loop" everyone talks about isn't a new invention. It's ReAct (reason + act) from a 2022 paper, and if you're using a modern tool-use API you're already running it, maybe without naming it.
ReAct is three steps on repeat:
-
Thought: the model reasons about what to do next.
-
Action: it calls a tool.
-
Observation: it reads the tool result.
Then it loops, using the observation to inform the next thought, until it decides it's done.
Where this gets concrete: in a tool-use API, a response comes back with stop_reason "tool_use" and one or more tool_use blocks. That single response is exactly one ReAct iteration. Your harness's job is the boring part around it:
-
Send messages plus tool definitions.
-
Get back either text (done) or a tool_use block (not done).
-
If tool_use: run the tool, append a tool_result, loop.
-
Stop on end_turn, or on your own budget or iteration cap.
That's the whole engine. A minimal but real agent loop is well under 100 lines. Everything else (memory, planning, multi-agent) is layered on top of this skeleton.
Two things I wish I'd internalized earlier:
-
The loop will run forever if you let it. Always cap iterations and wall-clock time in the harness; the model won't reliably stop itself.
-
Most "agent" complexity is not in the loop, it's in tool design and context management around it. The loop itself is almost trivial once you've written it once.
A useful corollary (Anthropic's framing): every piece you bolt onto this loop encodes an assumption about what the model can't do alone. As models improve, you should be deleting scaffolding, not piling it on.
TL;DR: The agent loop = ReAct = Thought / Action / Observation on repeat. A tool-use response with stop_reason "tool_use" is one iteration. The core engine is under 100 lines; the hard parts are tools, context, and stop conditions, not the loop.
For folks who've built their own loop: what was the first thing that broke when you moved it from a demo to real tasks? For me it was missing stop conditions, the agent happily looping on a stuck tool.