The loop model
A task is a loop of N steps. Each step sends the system prompt, the whole history so far, and the new tokens, and the model writes output tokens. A tool call returns result tokens that join the history. Input at step k is the system prompt plus every earlier input and output, plus what is new.