← Table of Contents · Page 108 of 868

STATE AND CONTROL FLOW

Part 1 of 9

LEARNING GOALS By the end of this chapter you will be able to define state and explain where a harness keeps it. You will be able to describe checkpoints, pause and resume, and rollback, and explain when each is used. WHAT IS STATE? Imagine you are reading a long novel and you must put it down. You tuck in a bookmark so that tomorrow you can pick up on page 212 instead of starting over. You also remember that the detective is suspicious of the butler. The bookmark and the remembered facts together are your state. In harness engineering, state means the information that survives from one step to the next. Without state, every step of an agent would begin with total amnesia. The model itself, remember, remembers nothing between calls. Each time the harness calls it, the model sees only the text the harness chooses to show. So the harness must keep a record of everything that matters and decide what to show next. Typical pieces of state include the original goal, the list of messages so far, the results of tool calls, a counter of how many steps have run, a list of tasks already finished, and any notes the agent wrote for itself. State can also include things the model never sees, such as a running cost total or a flag saying that a person has approved a risky action.
Advertisement
Read Aloud:
0:00 / 0:00