Skip to slide
Chapter 2 · The Agent Loop
13 / 142

CHAPTER 02 · The Agent Loop · 5 / 5

Key takeaways

  • The agent loop is tiny: call the model, run any tool it asks for, append the result, repeat until the model returns plain text.
  • Anthropic's version is "gather context, take action, verify results." It is the same loop.
  • Each model call ends one of two ways: a tool request (keep looping) or an assistant message (stop).
  • For a software agent, the real output is the changes on your machine, not the final text. The text is just the "I'm done" signal.
  • A turn can contain dozens of inference-and-tool laps, and each turn re-sends the whole growing history, which sets up the cost problem in Chapter 4.

Original sources for this chapter: Anthropic's How Claude Code works and OpenAI's Unrolling the Codex agent loop by Michael Bolin.


← → arrow keys work too