Three turns of a support agent

Lesson 2 of 5 in The Agent Loop: One Turn at a Time.

Diagrams lie by omission — they show the shape and hide the texture. So watch an actual loop run, end to end, on a task small enough to hold in your head: a customer wants to know where their order is.

The agent has a system prompt (its job description), two tools — lookup_order and check_shipment — and one incoming message. Read the transcript below the way the model experiences it: everything above the current line is context; everything below doesn’t exist yet.

Three things happened in that transcript that no workflow diagram could have scripted.

Look at turn 2’s arguments. The tracking id DH-99231407 did not exist anywhere in the conversation until turn 1’s tool result put it there. No human passed it along; no code mapped field to field. The model read the observation and decided the shipment status was worth checking next. That handoff — result in, decision out — is the loop actually working, and it is the thing you can’t get from a single model call.

The same three turns, as the model saw them
TurnNew in context since last turnModel’s moveWhy that move

1

The user’s question (plus the standing system prompt and tool contracts)

Call lookup_order

Only the order id is known. The model needs facts before it can answer — so it acts instead of answering.

2

The order record: shipped, DHL, a tracking id

Call check_shipment

The tracking id came out of turn 1’s result — the loop fed an observation forward into the next action.

3

The live shipment scan and ETA

Answer — no tool calls

The context now contains everything the answer needs, so acting stops. Natural stop; loop exits.

Interactive checkpoint quiz (2 questions) — open this page in a browser to take it.