Ask the service-desk agent from Anatomy of a Turn the same question, which of last week's P1 (priority-one) incidents are still open, and an answer comes back with three ticket numbers in it. Between your question and that answer the request passed through eight stages. The model performed one of them.

Thesis: Of the eight stages one request passes through, the model performs one: it turns the window into scores for every possible next token. The other seven, assembling the call, tokenizing it, drawing the reply, stopping it, running the tool, calling again and keeping what survives, are code someone wrote and can log. So the controls you can set and verify, on cost, on exposure and on the audit record, sit outside the model even where the model's choices drive them, and every failure has a stage that owns it.


This chapter is the map of The Agentic Lifecycle: every stage on one page and who performs it. The chapters after it open the stages in the order a call reaches them. One chapter, What a Prompt Cache Reuses, is not a stage of its own: the provider keeps the work the model did reading the start of a call, so that a later call starting the same way skips that part of stage three.

Three Hands, Eight Stages

Anatomy of a Turn gave this series three words: a request is what you ask for, a call is one trip to the model, and a turn is one call plus the tool runs it triggers. The stages below are the life of one request. Stages one to five happen on every call. Stages six and seven are what turn one call into a loop of turns. Stage eight happens once, when the request is answered.

Three hands perform them. You and your harness: the code that builds each call, runs your tools and decides whether to call again. The provider: the API in front of the model and the serving stack behind it, which counts the tokens, draws the reply and reports why it stopped. The model: the network, which reads a sequence of tokens and scores every possible next token, and does nothing else. The window, short for context window, is everything one call puts in front of the model, counted in tokens, up to the model's maximum.

  1. Assemble. Your code gathers the system prompt, the tool definitions, the history and the new message into one call. Retrieval, where you use it, is code here too, picking the passages that go in. Yours.
  2. Tokenize. At the API boundary the provider's tokenizer cuts the text into token ids. That count is what you are billed on, and the same text counts differently on different models. The provider's.
  3. Read. The token sequence enters the network and comes out as a score for every possible next token. The model's.
  4. Sample. The provider's serving code turns those scores into probabilities and draws one token, appends it, and the model reads again: one token per pass. The provider's.
  5. Stop. The reply ends when the drawn tokens form a tool request or the end-of-turn marker, or when it reaches a length limit you set. The provider names the cause in the response as a stop reason, and the harness reads it. The provider's.
  6. Tool round trip. On a tool request your code checks the arguments, runs the tool and appends the result. A tool the provider runs itself, such as its web search, moves this stage to the provider. Yours, unless the provider runs the tool.
  7. Call again. The harness sends everything again, plus the tool exchange, and repeats until a response says the model has finished, or until a limit you set runs out, a call fails or the user stops it. Yours.
  8. Keep. The model holds nothing between calls. What survives the request is what your code stores, or the provider's stored state if you chose it. Yours, or the provider's by your choice.

Here is the service-desk request as a sequence, with one tool round trip, so two turns. The numbers are the stages.

sequenceDiagram
  participant H as Your harness
  participant P as Provider
  participant M as Model
  participant T as Your tool
  H->>P: 1 Assemble: system, tools, history, message
  P->>P: 2 Tokenize: text becomes token ids
  P->>M: 3 Read: every token so far (cached after the first pass)
  M-->>P: a score for every next token
  P->>P: 4 Sample: draw one token, append it
  Note over P,M: 3 and 4 repeat once per token of the reply
  P-->>H: 5 Stop: tool request, stop reason tool_use
  H->>T: 6 Tool round trip: run search_tickets
  T-->>H: the tool result
  H->>P: 7 Call again, with the tool exchange
  Note over P,M: 2 to 5 run again
  P-->>H: the answer, stop reason end_turn
  H->>H: 8 Keep: store what survives the request

Figure: The eight stages of one request. The harness assembles the call; the provider tokenizes it, the model scores and the provider samples one token at a time until a tool request stops it; the harness runs the tool, calls again, and keeps what should survive the request.

One Measured Call

One real call recurs in this series, so here it is in full, once. It is call number 100 of the 224 calls in one coding-agent session, recorded by a proxy exactly as sent and reported in Your Tool Schemas Are the Bloat. The call came to about 131,000 tokens. 60.8% of it, 79,579 tokens, was the tool array: the definitions of 238 tools, gathered from connected tool servers and the harness's built-in tools. The session called four of them. Across every session that loaded those tools, eight were ever called and 230 never were. Because the tool array rides at the top of every call, it was re-sent on all 224 calls: about 17.8 million tokens of tool definitions in one session, by multiplication rather than measurement. The token figures are characters divided by four, as that post says, so the shares are the argument, not the dollar amounts; that post also prices the array at the cheaper rate a provider charges for repeated input.

The later chapters call this the 238-tool call and do not repeat its numbers.

Sort the Stages Yourself

The widget below asks you to sort the eight stages by who performs them before it shows the answer. Its first preset is the illustrative service-desk request from Anatomy of a Turn: one tool, search_tickets, invented tickets, sizes in characters of the example text. The second is the 238-tool call. After the reveal, a tracer walks the stages and opens the model stage. With JavaScript off, the table below is the printable card, with the chapter that covers each stage.

The stages of one request: who performs each, its unit, its budget, its failure mode and the chapter that covers it.

The stages of one request
StageWho performs itUnitBudgetFailure modeChapter
Assemble the callYou and your harnessparts: system prompt, tool definitions, history, the new messagethe context window, less a reserve for the replya tool result nobody needs any more rides along in every later call; an edit near the top undoes the cacheAnatomy of a Turn, Where Retrieval Enters the Turn, What a Prompt Cache Reuses
TokenizeThe providertokensthe tokens per call you plan for, input and outputa budget set in characters breaks when the model changesTokens Are the Unit of Account
Read the windowThe modelone pass over every positionthe context windownothing the call left out can be knownWhat Training Puts in the Weights, How the Model Reads the Window, What a Prompt Cache Reuses
Sample the replyThe providerone token per passthe effort setting (how much the model thinks), and sampling parameters where the model still accepts thema reply you cannot reproduce from the same callFrom Logits to Response
StopThe providera stop reasonmax_tokens and the stop sequences you seta cut-off reply shown as if it were finishedAnatomy of a Turn, From Logits to Response
Tool round tripYou and your harness, or the provider, for a tool it runs itselfa tool request in, a tool result backhow many tools are declared and how much each result returnsan argument the model guessed; a result that steers the modelThe Tool Call Is a Round Trip
Call againYou and your harnessturns per request: one call, plus the tools it triggers, per turnan iteration limit you seta request that never ends, or a task that ends on the model's word aloneAnatomy of a Turn, The Tool Call Is a Round Trip
KeepYou and your harness, or the provider, when you use its stored statewhat survives the requestretentiona record kept longer than its data allows; a summary that lost the identifiersAnatomy of a Turn

The One Stage the Model Performs

Stage three is worth opening now: everything the agent seems to decide is decided there, and nothing is enacted there.

Each token id in the window is looked up in a table of vectors the model learned in training. Layers above transform those vectors, and at every layer each position draws on the positions before it, which is how a question at the end of the window can use a tool result in its middle. At the top, the last position is scored against every entry in the vocabulary. Those scores are the model's whole output for the pass; How the Model Reads the Window opens the pass and From Logits to Response the draw that follows.

Everything we call a decision of the model is in that output: which tool it asks for, what arguments it fills in, whether the end-of-turn marker comes next. Then code acts on it. The model never ran the search and never stopped itself; it produced the scores, a sampler drew from them and a harness obeyed the draw. "The model decided" is true and insufficient: it names where a choice was expressed, not where it was enacted, and the enacting stage is the one with a log and a control. The pass itself leaves none, so every log of an agent comes from the stages around it.

Where the Controls Sit

Four incidents a service-desk platform team might file against "the AI":

The agent named the wrong owner for INC-4471. Was the owner in the window? If the ticket result was never returned, or was dropped from the history, the model could not have known it, and the fix is a stage-one instruction (answer only from ticket data) with a stage-six check (the result is attached). If it was in the window and wrong, the tool is wrong. If it was in the window, right, and the model named someone else, that is the one fault that is the model's, at stage three; its controls are where the fact sits in the window, the prompt, an evaluation, and a check in code that the named owner appears in the result. The record that settles which case it was is the call as sent.

Every call doubled in size after the team connected more tool servers. Stages one and two. This is the 238-tool call's story: most of the call was definitions nobody used, re-sent every turn. The model did not change; the call did, at assembly, and the control is there: stop loading the tools nobody calls.

A tool result carrying employee details rode along for the rest of the session. Stage six put it in, stage one re-sent it and stage eight kept it: three places to act, none of them the model.

An auditor asks what the agent was told before it closed a ticket. The call as sent at stage one and the tool arguments at stage six, both of which your code produced and can keep, and the stop reason at stage five, which says whether the reply you showed was complete.

Two rows of the card, read that way: a cut-off reply is a stop fault; an invented ticket number is a stage-one or stage-six fault when the real one was never in the window, and the model's when it was. Each failure has a stage, and each stage an owner who can log it and change it.

When the Black Box Is the Right Box

The strongest objection is that of the seven code stages most builders write two pieces, the prompt and the tool functions: SDK tool runners assemble, call again and run the tools; the provider's stored state keeps; provider-run tools fold the round trip into the provider's own loop. If your agent is small enough that you never open a log, treat the whole thing as a box. The stages earn their keep the first time something goes wrong, because the question you ask then names one of them.

Two things blur the line. A provider-run tool runs inside the provider's loop, so "outside the model" is still "inside the provider", and the record you get is the one the provider returns. And a reasoning model writes working before its answer that you pay for and may not be able to read; From Logits to Response covers it. Neither moves a stage into the network. Both move it somewhere you cannot see: a different problem and, for an audit, a worse one.

A team that files every incident against the model is waiting for a better model to fix them. Sometimes one will. The failures that live in the stages you own survive a model upgrade, and an incident log that names no stage cannot show which was at fault.


What to Do Next

  • Draw your own eight stages, naming the component in your stack that performs each. A stage you cannot name is a control nobody owns.
  • File incidents against a stage, not against the model. "Wrong answer" becomes "the fact was not in the window" or "it was there and ignored", which have different owners and fixes.
  • Log at the boundaries you own: the call as sent, the tool arguments and results, the retrieved passage ids, the reply, the stop reason and the token usage the response reports. Together they are the audit record.
  • Put cost controls where cost is set: at assembly, in the tool array and the history.
  • Decide where "keep" lives, and give it the retention rule its contents need, before the first production request.

Next in the series: Where Retrieval Enters the Turn, the part of stage one that decides which of your documents the model may read. Related reading: The Agent Is a While Loop for the outer loop, Your Tool Schemas Are the Bloat for the full measurement behind the 238-tool call, and The MCP Mental Model for where tool definitions come from.