The Agent Loop
2 min read
Strip an agent to its skeleton and the same cycle remains: think, act, observe, repeat. The model chooses an action, invokes a tool, reads the result, and decides what to do next. ReAct formalised this pattern (Yao et al., arXiv:2210.03629), and production harnesses elaborate it with permissions, state, retries, and verification.
Feed the loop good signals
Section titled “Feed the loop good signals”The loop is only as good as its observations. Feedback signals differ sharply in quality:
- Binary and localised signals are gold: a failing test names the failure and where it is; a compiler error points at a line; a linter names the rule. The agent can act on them directly.
- Interpretive signals are noise-prone: raw command output the agent must parse and judge invites misreading and invented success.
The design consequence runs through everything later in the book: build workflows so agents receive binary, localised feedback wherever possible. This is the seed of the argument in Verification & the Outer Loop that success criteria must be machine-checkable, and of the guides-and-sensors control framing in The Harness.
Bound the loop explicitly with an iteration cap, a time or cost ceiling, and the stopping conditions from Structuring Agent Instructions. An unbounded loop does not converge. It wanders.
One bounded loop handles one session. The next chapter explains how outer loops coordinate repeated sessions to complete larger work.