@tool decorator. Agno automatically extracts function signatures and docstrings to describe tools to the model.
Capabilities
Basic Tool Decorator
cookbook/90_tools/tool_decorator/tool_decorator.py
Async Tools
cookbook/90_tools/tool_decorator/tool_decorator_async.py
Tools with Instructions
Add custom instructions that the model sees when using the tool.cookbook/90_tools/tool_decorator/tool_decorator_with_instructions.py
Cache Tool Calls
Cache tool results to avoid repeated calls.cookbook/90_tools/tool_decorator/cache_tool_calls.py
Stop After Tool Call
Stop agent execution after a specific tool is called.cookbook/90_tools/tool_decorator/stop_after_tool_call.py
Tools on Class Methods
Use class methods as tools for stateful operations.cookbook/90_tools/tool_decorator/tool_decorator_on_class_method.py
Tool Options
| Option | Description |
|---|---|
show_result=True | Show tool result to user |
cache=True | Cache results for same arguments |
stop_after_call=True | Stop agent after tool executes |
instructions="..." | Additional instructions for the model |
pre_hook=fn | Function to run before tool |
post_hook=fn | Function to run after tool |