← BACK TO BRAIN TRAINER
PRO · 24 MIN · EXPERT

Building Simple Agents (ReAct)

Thought → Action → Observation — the foundation of every modern agent, with halt conditions that don't burn $500.

THE MINDSET SHIFT
Bad agent prompts are the most expensive prompts you'll ever write. A single missing halt condition can burn $50 in 90 seconds. The good news: the halt conditions that matter are usually 3 lines.
— SHE · YOUR AI GUIDE

Yao et al.'s 2022 ReAct paper proved that interleaving Thought (reasoning) and Action (tool use) outperforms either alone — but the production rate of failure on agent prompts is still ~40%, and the failure mode is almost never 'wrong answer' — it's 'never finished' or 'finished too early.' The issue is that base LLMs are trained to be helpful, which translates to 'keep trying' — exactly the wrong default for an agent that should halt when it has enough.

Schon's 1983 reflection-in-action framework gives the right pattern: every action should be followed by an evaluation step ("did that observation move me closer to the goal?"). Naive ReAct skips this — the model fires Action after Action without asking whether prior observations were informative. Production-grade ReAct forces explicit reflection BEFORE the next Action: "Was the last observation useful? If no, what would be different about the next tool call?"

The production fix is three layers stacked: (1) tool descriptions written like API docs (input schemas, expected outputs, failure modes), (2) explicit Thought→Action→Observation FORMAT enforcement (not just "think then act"), (3) halt conditions that fire BEFORE the model has wandered for 12 iterations. The third one alone saves you from your first $50 agent bill.

ReAct outperforms CoT-only on multi-step tasks by 17-34% accuracy
Yao et al., ReAct: Synergizing Reasoning and Acting, ICLR 2023
~40% of production agent prompts fail on 'never halts' or 'halts too early'
LangChain production analytics report, 2024
Explicit tool-description schemas improve tool-selection accuracy by 28%
Schick et al., Toolformer, 2023; refined in Patil et al., Gorilla, 2024