Docs / How Agents Talk to Models / Statelessness & multi-turn
Statelessness & multi-turn
The model is stateless, so a chat “remembers” only because the client resends the entire conversation every turn. Turn N re-reads all of turns 1…N−1 as input. Summed over a session, input cost grows with the square of the turn count — the real reason long agent sessions bill far more than their answers suggest.
Here's the twist that surprises people. The model is stateless — it remembers nothing between calls. So how does a chat “remember” what you said three turns ago? The client resends the entire conversation every single turn. Turn 2's request is turn 1's request with the last exchange appended. Turn 12 carries all of turns 1–11 in its body. Continuity lives in the bytes you resend, not in the model.
json
// TURN 1 — one message in the body
"messages": [ { "role": "user", "content": "Does POST /orders reject a missing total?" } ]
// TURN 2 — turn 1 kept verbatim, the reply + your follow-up appended.
// The model re-reads ALL of it as input, and you pay for it again.
"messages": [
{ "role": "user", "content": "Does POST /orders reject a missing total?" },
{ "role": "assistant", "content": "No — it reads req.body.total unchecked." },
{ "role": "user", "content": "Now add the guard and a test." }
]Because the transcript only grows, the input tokens on turn N are roughly N times a single turn's worth. Summed across a conversation, input cost grows with the square of the turn count — the classic reason a long agent session bills far more than its individual answers would suggest.
Under the hood The client isn't obliged to resend everything — it resends whatever it wants the model to still “know.” That's a client decision, not a model feature. Trim the array and the model genuinely forgets: drop the early turns and it can't reference them. Every “memory” strategy — full replay, sliding window, summarize-and-truncate — is just a different rule for which bytes to resend. Keep this in your pocket for Part B: shrinking the resent history is the client's job, not the router's.
Continuity is an illusion the client pays for: it resends the whole transcript each turn, so input — and the bill — grows quadratically over a long session.