← Table of Contents · Page 664 of 868

PROJECT ONE - A MINIMAL HARNESS

Part 2 of 11

AN HONEST NOTE ABOUT THE MODEL A real agent needs an LLM, which is a program trained on huge amounts of text that predicts useful replies. Using a real model needs an account, a secret key, and a small fee, and the answers can change from one run to the next. That makes it hard to learn from, because when something breaks you cannot tell whether your code or the model caused it. So the lab includes a mock model, which is a small scripted stand-in that follows a fixed recipe and always behaves the same way. It is not intelligent, and we do not pretend that it is. Its only job is to let you test the harness around it, which is the thing this book is about. Because the harness talks to the model through one single door, called the model adapter, you can later swap the stand-in for a real hosted model, and Step 3B gives you ready-made code for one. The mock model is also gullible on purpose in later chapters, so that it can show you what a careless real model might do. The Big Picture: The Loop Imagine a careful librarian who has been given a to-do slip. The librarian thinks about the slip, picks one action such as fetching a book, does that action, looks at what happened, and then decides what to do next. The librarian repeats this until the slip is finished or the shift ends. That is the entire idea of an agent loop. We call the three beats think, act, and observe. In the think beat the harness shows the model everything said so far and asks what to do next. In the act beat the harness runs the tool the model asked for. In the observe beat the harness adds the tool's result to the conversation so the model can see it on the next turn. The loop stops when the model says it is finished or when a step limit is reached. The step limit matters because a loop with no limit is like a taxi with the meter broken: it can keep running and charging forever.
Advertisement
Read Aloud:
0:00 / 0:00