01The loop: model, tools, memory, stopping condition
A model maps an input to an output. An agent wraps that in a loop: given a goal, decide the next action, execute it via a tool, observe the result, and decide again — until the goal is met or a limit is hit. The ReAct pattern named the interleaving of reasoning and acting, and it's still the backbone of most implementations.
Four components. Tools give it hands — search, code execution, database queries, API calls — and each one is a function signature the model emits a structured call against. Memory gives it continuity, from the conversation in the context window to retrieved documents to a scratchpad it writes to itself. The stopping condition is the part people forget, and it's what turns an experiment into a system: a step budget, a cost budget, a confidence threshold, or a human gate.
The failure modes are systems failure modes rather than model ones: loops that never terminate, compounding errors where step three builds on a wrong step two, cost blowouts from unbounded tool calls, and tool outputs that the model trusts more than it should.