Agents & Tool Use

Layer 2 · Mechanics

Agents & Tool Use

The mechanics of the agent loop: tool schemas, the ReAct trace, memory, and how the loop terminates.

8 min read70 XP

  1. System + tool schemas

    prepended to context

  2. Model emits

    text or tool_call JSON

  3. Parser checks

    valid schema?

  4. Executor runs tool

    real side effect

  5. Result appended

    as a new message

One turn of the agent loop, expanded.

Every tool the model can use is described to it as a schema: a name, a natural-language description, and a typed argument list (usually JSON Schema). This schema is injected into the context on every turn, so the model is effectively choosing from a menu it re-reads each time — which is also why schema quality directly drives call accuracy.

Go deeper: L3 Code