Tools
Tools let the agent take actions. The LLM decides which tool to call and with what arguments.Registering Tools
Pass tools to theTools collection:
Using FunctionTool
Wrap any callable as a tool. Parameter schema is auto-generated from the function signature:Multiple Tools
Pass multiple tools toTools and the LLM chooses which to call:
Agent with Tools
Tool Contracts
Every tool implements two interfaces:ToolInterface
The execution and schema contract:CanDescribeTool
The description contract — provides identity and documentation:metadata() returns lightweight info (name, summary, namespace) for tool listings. instructions() returns the complete specification including parameters and return type.
BaseTool
BaseTool implements both interfaces and is the standard base class for custom tools. It auto-generates parameter schemas from the __invoke() method signature:
How It Works
- LLM sees tool schemas and decides to call a tool
ToolExecutorruns the tool with provided arguments- Tool results are formatted as messages and fed back to the LLM
- LLM uses the results to formulate a final response
- Loop continues until LLM responds without tool calls