Lesson 03.02 · Phase 03 · The Agent Loop
ReAct: reason, act, observe
Before native tool calling, agents were a prompt format and a parser. Build that once, and you'll understand what tool calling does for you.
Learning objectives
- Implement the original ReAct pattern as text: a prompt that defines Thought / Action / Action Input / Observation, a parser, and a loop.
- Explain what a stop sequence does, and measure what happens without one: the model invents its own observations.
- Turn format errors into observations so the loop keeps going.
- Compare text ReAct with native tool calling, and know when you'd still use text.
Lesson 1's loop relied on the API's toolcalls field: the model emits structured calls, and your code runs them. That field is a recent convenience. The ReAct paper (2022) did it with nothing but text: the prompt shows the model a format, the model writes Action: lookup and Action Input: {...}, and code parses that out of the reply.
Loading the full lesson…