Toolkit

Reference for the Toolkit class.

The Toolkit class provides a way to group and manage multiple tools (functions) together. It handles tool registration, filtering, caching, and execution control.

Import

from agno.tools.toolkit import Toolkit

Constructor

Parameters

ParameterTypeDescription
idOptional[str]Toolkit identifier; generated from name when omitted.
namestrA descriptive name for the toolkit.
toolsSequence[Union[Callable, Function]]List of callables or Function objects (from the @tool decorator) to include in the toolkit.
async_toolsSequence[tuple[Callable, str]]List of (async_callable, tool_name) tuples registering async variants whose names differ from the sync methods, e.g. [(self.ascreenshot, "screenshot")].
instructionsstrInstructions for using the toolkit. Can be added to agent context.
add_instructionsboolWhether to add toolkit instructions to the agent's context (default: False).
include_toolslist[str]List of tool names to include from the toolkit. If specified, only these tools will be registered.
exclude_toolslist[str]List of tool names to exclude from the toolkit. These tools will not be registered.
requires_confirmation_toolslist[str]List of tool names that require user confirmation before execution.
external_execution_required_toolslist[str]List of tool names that will be executed outside of the agent loop.
stop_after_tool_call_toolsList[str]List of tool names that should stop the agent after execution.
show_result_toolsList[str]List of tool names whose results should be shown to the user.
cache_resultsboolEnable disk caching of eligible function results.
cache_ttlintTime-to-live for cached results in seconds (default: 1 hour).
cache_dirstrCache root; defaults to agno_cache under the system temporary directory. Function entries are stored below functions/v2.
timeoutOptional[int]Timeout in seconds for the toolkit's primary I/O operation (HTTP request, SDK call, sandbox execution). Subclasses forward their own timeout via super().__init__(timeout=...).
auto_registerboolWhether to automatically register all tools in the toolkit upon initialization.

Usage Examples

Basic Toolkit

from agno.tools.toolkit import Toolkit

class WebSearchTools(Toolkit):
    def __init__(self, **kwargs):
        tools = [
            self.search_web,
        ]
        super().__init__(name="web_search_tools", tools=tools, **kwargs)

    def search_web(self, query: str) -> str:
        """Search the web for information."""
        return f"Searching for: {query}"

Toolkit with Instructions

from agno.tools.toolkit import Toolkit

class CalculatorTools(Toolkit):
    def __init__(self, **kwargs):
        tools = [
            self.add,
            self.subtract,
            self.multiply,
            self.divide,
        ]

        instructions = "Use these tools to perform calculations. Always validate inputs before execution."

        super().__init__(name="calculator_tools", tools=tools, instructions=instructions, add_instructions=True, **kwargs)
    
    def add(self, a: float, b: float) -> float:
        """Add two numbers and return the result."""
        return a + b
    
    def subtract(self, a: float, b: float) -> float:
        """Subtract two numbers and return the result."""
        return a - b
    
    def multiply(self, a: float, b: float) -> float:
        """Multiply two numbers and return the result."""
        return a * b
    
    def divide(self, a: float, b: float) -> float:
        """Divide two numbers and return the result."""
        return a / b