AgentEngineering
GlossaryCore Concepts

Tool Use

The capability of a language model to invoke external functions, APIs, or services as part of generating a response, enabling agents to take actions beyond text generation.

Definition

Tool use (also called function calling) refers to a language model's ability to emit structured requests to invoke external functions during inference. The calling application executes the function and returns the result, which the model incorporates into subsequent reasoning.

Tool use is the mechanism that gives LLM-based agents the ability to affect the world — searching the web, executing code, reading and writing files, calling APIs, and coordinating with other agents.

How It Works

The developer declares a set of available tools as JSON schemas. The model, during generation, can emit a tool_call object instead of (or in addition to) a text response. The application executes the call, captures the result, and passes it back to the model.

Common Tool Categories

  • Information retrieval: web search, document lookup, database queries.
  • Code execution: running Python, JavaScript, or shell commands in a sandbox.
  • External APIs: calling REST or GraphQL endpoints.
  • Memory operations: reading from and writing to vector stores or key-value databases.
  • Agent delegation: spawning sub-agents or calling specialized agents.

Security Considerations

Tools that write, delete, or trigger external side effects (sending emails, creating records, executing code) require special care. Always apply least-privilege permissions and consider human-in-the-loop confirmation for irreversible actions.

ShareY