INTERACTIVE EXPLAINER · EXP-0038 LAYERS · 24 COMPONENTS

EXPLODED INTERACTIVE · TOOL CALL

What happens when an agent calls a tool?

Follow one function call from a model’s tool_use block through schema checks, permission, credentials, transport, and execution, then watch the observation return for the next model turn.

8 LAYERS / 24 COMPONENTS

Operate the tool-call journey

START HERE
Follow one tool call, step by step

Press Start tour to follow a typical client-tool round trip from the agent loop to the observation that comes back. Each stop opens the component responsible for that part of the trip.

Exploded view: What happens when an agent calls a tool?Interactive layers show a tool call moving from an agent loop through schema checks, approval, a credential vault, and a tool runtime. The observation returns to the agent loop.TOOL CALL DOWN / OBSERVATION BACK08 LAYERS · NOT TO SCALEOBSERVATIONCALLOBS
TOOL CALL OBSERVATION

The host sends conversation state and tool schemas to the model, then inspects the reply.

Each turn is one model request. The host includes prior messages, the current user text, and the tools this session may call. After the reply, the host either paints text or starts the tool path.

Control signal
next turn
cycle mechanism schematicOne turn: send state, wait, branch on stop_reason.01020304
  1. 01user text
  2. 02model request
  3. 03stop_reason
  4. 04branch
One turn: send state, wait, branch on stop_reason.
COMPONENT / TURN

Turn controller

Reading the animation: A ticket enters; the controller waits; the reply is sorted into text or a tool path.

Sends one model request and waits for a stop reason.

WORKED EXAMPLE

One user question opens a model turn

messages: [{role:"user", content:"Is the Bunny zone zackproser reachable?"}] + tools:[head_storage_zone]
User text
Is the Bunny zone zackproser reachable?
Tools in request
head_storage_zone
Model
claude-opus-5
Waiting on
stop_reason

The controller assembles messages and tools, calls the model API, and branches on stop_reason. end_turn means show text. tool_use means run tools, then maybe request another completion.

In engineering terms: The turn controller is that dispatcher. It owns the request/response cycle with the model API.

FOLLOW THIS EXAMPLE

  1. 01

    Collect messages, tools, and tool_choice for this turn.

  2. 02

    Send one completion request to the model API.

  3. 03

    Read stop_reason and the content blocks.

  4. 04

    Show text, or hand tool_use blocks to the rest of the stack.

Measurements, controls, and tradeoff
Useful evidence
stop_reason values, empty content, max_tokens cuts, and time to first block.
Controls
max_tokens, tool_choice, and whether the SDK auto-continues after tools.
Tradeoff
A longer max_tokens budget lets a call finish; it also spends more when the model writes a large input object.
Decision
stop_reason
Definitions and sources

TERMS IN THIS VIEW

Agent loop
A program that repeatedly sends conversation state to a model, executes any tool calls in the reply, and continues until the model returns ordinary text or a stop rule fires.
stop_reason
The model API’s explanation for why a response ended. tool_use means the host should run tools before requesting another completion.
Host
The application that talks to the model API, decides which tools exist, executes or forwards calls, and writes tool_result blocks.
Token
A small unit of text the model reads or writes. Tool schemas, tool_use blocks, and tool_result blocks all consume tokens.

SOURCES + CONTINUE READING

  1. [01]Tool use overviewAnthropic
  2. [02]How tool use worksAnthropic

Why it matters: Without this loop, a tool_use block is only a suggestion. The host is what turns it into work.

Definitions for this layer

TERMS IN THIS VIEW

Agent loop
A program that repeatedly sends conversation state to a model, executes any tool calls in the reply, and continues until the model returns ordinary text or a stop rule fires.
Host
The application that talks to the model API, decides which tools exist, executes or forwards calls, and writes tool_result blocks.
tool_choice
A request option that steers whether the model may call tools, must call one, or must answer in text.
Token
A small unit of text the model reads or writes. Tool schemas, tool_use blocks, and tool_result blocks all consume tokens.
ZACKPROSER.COM / EXPLODEDzackproser.com/demos/what-happens-when-an-agent-calls-a-toolUPDATED 2026.08.20
Complete exploded diagram of an agent calling a tool

Take the whole tool-call path with you

Every layer and component is expanded in one high-resolution diagram for teaching, reference, and sharing.

Resolution
2400 × 3000 PNG
Contents
8 layers · 24 components
Attribution
URL included in the image

Trace the systems on either side

EXPLODED INTERACTIVEHow an AI response gets made

Follow the same request through model routing, scheduling, inference engines, memory, kernels, and GPU hardware.

EXPLODED INTERACTIVEWhat happens when you fetch a URL?

When the tool is an HTTP call, follow DNS, TLS, the edge, and the origin the same way a browser does.

BLUEPRINT SERIESctx: the personal context engine

How one sealed vault and scoped tokens keep credentials out of prompts until a tool actually needs them.