Skip to slide
023 / 221

CH 02 · The Agent Loop Pattern · 11/15

Read as one page

Statelessness within, state at the edges

The loop itself is best kept stateless: it takes the assembled context in, runs, and returns a result plus events. Persistence happens at the edges: load history before the loop, save the outcome after. This keeps the loop a pure function of its inputs, which makes it testable, retryable, and easy to reason about. (More in Chapter 9.)

Finished this idea?

Your learning progress stays in this browser.