← BACK TO KNOWLEDGE

KNOWLEDGE / Agents / Tool Calling

How Agent Tool Calling Works

A practical mental model for tool selection, execution, validation, and recovery in agentic systems.

AgentsTool Calling
DOMAIN
AI Engineering
LEVEL
Intermediate
READ
7 min
UPDATED
Aug 28, 2026

MENTAL MODEL / KEY IDEAS

Keep these in mind

  1. 01Treat a tool call as an untrusted request
  2. 02Keep execution outside the model
  3. 03Make recovery state explicit
01

The basic loop

A model proposes a tool and arguments; the application validates, authorizes, executes, and returns a structured result. The model never directly runs application code.

  • Select
  • Validate
  • Execute
  • Observe
  • Continue or stop
02

Where reliability comes from

Reliability lives in the orchestration layer: typed arguments, timeouts, idempotency, permission boundaries, and a bounded retry policy.

  • Reject unknown tools
  • Record every transition
  • Separate retryable from terminal failures
03

A useful design rule

Let the model decide what may be useful, but let deterministic code decide what is allowed and whether the result is valid.