← Table of Contents · Page 96 of 868

THE CORE AGENT LOOP

Part 1 of 12

LEARNING GOALS By the end of this chapter you will be able to describe the agent loop in your own words. You will be able to explain the ReAct pattern and tell it apart from plan-and-execute. You will be able to explain termination conditions and step limits, and why every real harness needs them. WHAT IS AN AGENT LOOP? Before we talk about loops, let us pin down two words that this whole book depends on. An agent is a software system that can take actions on its own, step by step, toward a goal that a person gave it. As Chapter 2 explained, an LLM is the model that reads text and writes text in reply. On its own, an LLM answers one message and then stops, like a person who gives one reply and walks away. To turn that one-reply machine into an agent, the harness runs the model over and over in a cycle. That cycle is called the agent loop. A loop, in programming, is simply a set of instructions that the computer repeats until some rule says to stop. The agent loop repeats three moves, and you can remember them with three plain words: think, act, observe.
Advertisement
Read Aloud:
0:00 / 0:00