orchestration

Tool Use Pattern

Overview

The Challenge

LLMs have limited ability to perform calculations, access real-time data, or interact with external systems through language alone.

The Solution

Equip agents with tools (functions, APIs, databases) they can invoke to extend their capabilities beyond pure language generation.

New to agent evaluation?
Start Learning

Deep Dive

Overview

Tool Use is a foundational agentic pattern that extends LLM capabilities beyond text generation. Agents can invoke external tools to perform calculations, retrieve data, or execute actions.

Tool Definition

{
  "name": "get_weather",
  "description": "Get current weather for a location",
  "parameters": {
    "type": "object",
    "properties": {
      "location": {
        "type": "string",
        "description": "City name or coordinates"
      }
    },
    "required": ["location"]
  }
}

Tool Categories

Information Retrieval

  • Database queries
  • Web search
  • API calls
  • File reading

Computation

  • Calculators
  • Code execution
  • Data analysis

Actions

  • Email sending
  • File writing
  • API mutations
  • System commands

Communication

  • Agent-to-agent calls
  • Human notifications
  • External system updates

Tool Selection

Agents must decide:

  1. Whether to use a tool (vs. answering directly)
  2. Which tool to use
  3. What parameters to provide

Safety Considerations

Principle of Least Privilege

Only grant tools necessary for the task.

Input Validation

Validate tool parameters before execution.

Output Sanitization

Treat tool outputs as potentially untrusted.

Sandboxing

Execute dangerous tools (code, commands) in isolated environments.

Tool Chaining

Complex tasks often require multiple tools:

1. search_web("latest Tesla stock price")
2. calculate(price * shares)
3. send_alert(portfolio_update)

Common Failure Modes

  • Wrong tool selection: Using search when calculation needed
  • Parameter hallucination: Inventing invalid parameters
  • Tool output misinterpretation: Misreading results
  • Over-tooling: Using tools when unnecessary
Ready to implement?
Get RepKit
Considerations

Tool use introduces security risks. Implement proper sandboxing, input validation, and access controls.