How does an LLM actually use a tool?

The model writes get_order_status(order_id="12345"). Who checks that the order belongs to this user?

For a client-side tool, application code has to handle the request and enforce access before the operation runs. A valid schema doesn't settle that question.

This comic follows the call and result, then separates reading an order from canceling it. It also covers loop limits and safe retries.

Download this comic as a PDF

Comic page 1 of 6: How does an LLM actually use a tool?
Read page 1 as text

How does an LLM actually use a tool?

If it writes a function call, who decides whether that function runs?

WHAT WE WILL FIGURE OUT

01

A tool call is a request

02

The application owns execution

03

Bound the agent loop

OUR EXAMPLE

Check order 12345, then distinguish reading its status from canceling it.

Follow the steps. Ask the obvious questions. Check the result.

Part 16 of 18 · Challenge: page 5 · Suggested answers: page 6

Comic page 2 of 6: A tool call is a request
Read page 2 as text

A tool call is a request

1

THE CUSTOMER QUESTION

USER: Where is order 12345?

Needed: live order status Absent from model context

order 12345

→

status tool

Where is order 12345?

The model may need live information that is absent from its context. The app exposes a narrowly defined tool.

get_order_status(order_id="12345")

2

DESCRIBE THE TOOL

Name get_order_status

Purpose read order status

Argument order_id: string

Authority checked by the app

name

purpose

arguments

A tool definition gives a name, purpose and argument schema. It tells the model how to request a supported operation.

Tool schema is not a permission grant

3

REQUEST A CALL

PROPOSAL, NOT EXECUTION

get_order_status order_id = "12345"

Application must receive and handle it

model

→

proposed call

The model emits a tool-call request. For a client-side tool, application code must receive and handle it.

Proposed operation + proposed arguments

4

VALIDATE FIRST

Validate schema

Authenticate user

Authorize order

Check policy

validate

→

authorize

→

execute

Validate the schema, authenticate the user, authorize the resource and check policy before running the operation.

An order ID alone does not prove ownership

Comic page 3 of 6: The application owns execution
Read page 3 as text

The application owns execution

5

EXECUTE THE READ

Permitted user

Scoped read

shipped

Reject access to someone else’s order

permitted lookup

→

shipped

Can it just look up any order?

The application calls the permitted service with appropriately scoped credentials, then records the result.

Authorized lookup returns status: shipped

6

RETURN THE RESULT

Tool result

Model

Customer answer

Result is data, not new authority

tool result

→

user answer

Feed the tool result back as data. The model can then explain the verified status to the user.

Tool result → model → customer answer

7

READING IS NOT CANCELING

READ get status

WRITE cancel order

Read scope does not grant write

Write action separate approval

read status

cancel order

A status lookup and a cancellation are different permissions. Expose write actions separately and require the appropriate approval.

Read status does not authorize cancel_order

8

JSON IS NOT TRUTH

Valid JSON syntax check

Correct order? data check

Owned by user? access check

Allowed action? policy check

valid shape

authority separate

Valid JSON only establishes syntax or schema compliance. Its contents can still be wrong, unsafe or unauthorized.

Schema-valid order ID can belong to someone else

Comic page 4 of 6: Bound the agent loop
Read page 4 as text

Bound the agent loop

9

THE AGENT LOOP

Model

Guarded tool

Observation

Repeat only inside the allowed loop

model

→

guarded tool

→

observation

What makes this an agent?

An orchestrator repeats model, tool and observation steps toward a goal. Your system controls the loop and its boundaries.

Model request → guarded action → observation

10

SET STOPPING RULES

Maximum steps

Deadline

Cost budget

Allowed tools

steps

deadline

cost

Bound step count, time, cost and allowed tools. Ask for clarification or stop when progress fails.

Maximum steps and deadline are explicit

11

RETRIES CAN REPEAT EFFECTS

Attempt 1: key K

Retry: same key K

One committed effect

retry write

→

idempotency check

A retried write may execute twice unless the service prevents it. Use idempotency and check transaction state.

One cancellation request should not cause two effects

12

MY NEW MENTAL MODEL

MODEL PROPOSES

SYSTEM ENFORCES

execution boundary

access control

The model proposes; the system enforces.

Server-hosted tools move the execution boundary into the provider. They still need appropriate authority and controls.

A persuasive tool request is not permission

Comic page 5 of 6: Your turn. Can you explain what happens?
Read page 5 as text

Your turn. Can you explain what happens?

Use the same example. Change one detail. What follows?

KEEP THIS EXAMPLE IN MIND

Check order 12345, then distinguish reading its status from canceling it.

Try first. Suggested answers are on the next page.

1

Who authorizes a client-side order lookup?

What makes you say that?

2

Does a valid tool-call schema make cancellation safe?

What makes you say that?

3

Name one rule that prevents an unbounded agent loop.

What makes you say that?

Write your answers in the comments.

Comic page 6 of 6: Suggested answers
Read page 6 as text

Suggested answers

How does an LLM actually use a tool?

01

Who authorizes a client-side order lookup?

Application code and the underlying service, using authenticated identity and resource permissions.

02

Does a valid tool-call schema make cancellation safe?

No. Identity, authorization, policy and any required user approval remain necessary.

03

Name one rule that prevents an unbounded agent loop.

A step limit, deadline, budget, narrow tool set or no-progress stop condition.

Try the challenge on page 5. Suggested answers follow on page 6.