Pattern [05]

Tool Use

Adapter Pattern / Proxy Pattern / Dependency Injection

> Agentic Definition

Tool Use (or Function Calling) extends the capabilities of an LLM by allowing it to interact with the external world (APIs, databases, calculators, software environments) to perform actions or retrieve data that is not present in its parametric memory. This transforms the LLM from a text generator into a system controller.

> Description

Extends the capabilities of an LLM by allowing it to interact with the external world (APIs, databases, calculators, software environments) to perform actions or retrieve data not present in its parametric memory. Transforms the LLM from a text generator into a system controller.

Frequently Asked Questions

When should I use the Tool Use pattern?

Tool Use (or Function Calling) extends the capabilities of an LLM by allowing it to interact with the external world (APIs, databases, calculators, software environments) to perform actions or retrieve data that is not present in its parametric memory. This transforms the LLM from a text generator into a system controller.

How does Tool Use relate to Adapter Pattern / Proxy Pattern / Dependency Injection?

Just as the Adapter pattern wraps an incompatible interface (like a 3rd party API) to make it usable by a client class, Agentic Tool Use wraps an external API (like a weather service or SQL database) into a schema (JSON) that the LLM can "understand" and "call." However, there is a key divergence: In SWE, the developer writes the code to call the API explicitly (service.call()). In Agentic Design, the developer defines the interface (the tool definition), and the Agent decides when and how to call it based on the conversation context. This is Inversion of Control at the logic level — the runtime decides the execution path, not the programmer.

What are the production trade-offs of Tool Use?

Read-only tools (GET requests) are generally safe. Write-enabled tools (POST/DELETE, "Delete User", "Transfer Funds") require strict Guardrails (Pattern 18) and Human-in-the-Loop (Pattern 13) validation. If the tool API changes, the agent breaks. Robust error handling (Pattern 12) is needed to inform the agent that the tool failed so it can try an alternative strategy rather than hallucinating a result.