Skip to main content
Local tools allow agents to call Python functions during conversations. Define functions, add them to agents, and the agent will execute them when needed.

Quick Start

The simplest way to add tools is to pass a function directly:
When passing a function directly, the ADK automatically infers the tool name, description (from docstring), and parameters (from type hints).

Two Ways to Add Tools

Just pass a typed function with a docstring:

2. Tool Class (Advanced)

For more control over the tool schema:
Use the Tool class when you need:
  • Custom parameter descriptions
  • Specific JSON schema constraints
  • Enum values for parameters
  • More detailed tool descriptions

How Local Tools Work

  1. Define: Create a Python function with type hints and docstring
  2. Add: Attach the function to an agent with add_tool()
  3. Execute: Agent automatically calls the function when appropriate

Key Components

Tool

The Tool class wraps a function for agent use:

ToolRegistry

Manages multiple tools for an agent:

LocalToolExecutor

Handles tool execution with error handling:

Tool Parameters

Tools use JSON Schema to define their parameters:

Supported Types


Auto-Inference

Parameters can be automatically inferred from function signatures:

Use Cases

Database Queries

API Integration

Calculations


Next Steps

Creating Tools

Learn how to create and configure tools

Tool Execution

Understand tool execution and error handling