LLMs Don't Execute Code: The Runtime Does
Confusing the model with the executor leads to overestimating what LLMs can do and underestimating the engineering needed to make them reliable. A clear mental model — LLM decides, runtime executes — prevents brittle agent designs and makes debugging tool-call failures straightforward.
Large language models cannot open browsers, query databases, or run code. Their job in a tool-calling pipeline is to read a function's description, decide whether to invoke it, and generate the correct parameters. The actual execution happens in the runtime — Node, Python, or whatever backend is hosting the real function. Once the runtime returns a result, that data is fed back into the model's context so it can produce a natural-language answer. The model never touches the outside world; it only produces structured JSON that says "call this function with these arguments."
A complete Tool Use cycle is a chain: user message, model decision, runtime execution, result injection, and final model response. This is fundamentally different from a hardcoded API call because the model participates in the routing logic — it chooses which tool to use and how to fill parameters based on natural language input. The quality of that routing depends entirely on how clearly the tool's name, description, parameter types, and required fields are defined. Vague descriptions produce unstable calls.
The practical takeaway is a clean separation of concerns. The LLM handles intent and language; the runtime handles side effects and validation; the tool definition is the contract between them. When you see an AI agent "doing things," you're watching a deterministic program execute functions that a model merely requested.
The phrase 'tool_choice: auto' is widely misunderstood — it means the model may decide to call a tool, not that the model will execute one.
Tool calling is essentially a translation layer that converts natural-language intent into a structured function-call request, then converts deterministic results back into natural language.
The engineering quality of the tool description is the single biggest lever for call reliability; a poorly described function is indistinguishable from a missing one to the model.