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
1. Simple Function (Recommended)
Just pass a typed function with a docstring:2. Tool Class (Advanced)
For more control over the tool schema:- Custom parameter descriptions
- Specific JSON schema constraints
- Enum values for parameters
- More detailed tool descriptions
How Local Tools Work
- Define: Create a Python function with type hints and docstring
- Add: Attach the function to an agent with
add_tool() - Execute: Agent automatically calls the function when appropriate
Key Components
Tool
TheTool 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