Skip to main content

Module tool

Module tool 

Source
Expand description

Tool registry and agents for LLM function calling.

This module provides infrastructure for registering, managing, and invoking tools that can be called by LLMs. It includes:

  • A global tool registry for registering and looking up tools by name
  • The Tool trait for implementing custom tools
  • Agents for working with tools in workflows:
    • ListToolsAgent - Lists available tools matching a pattern
    • PresetToolAgent - Exposes a workflow as a callable tool
    • CallToolMessageAgent - Processes tool calls from LLM messages
    • CallToolAgent - Directly invokes a tool by name

Structs§

CallToolAgent
Agent that directly invokes a tool by name.
CallToolMessageAgent
Agent that processes tool calls from LLM messages.
ListToolsAgent
Agent that lists available tools.
PresetToolAgent
Agent that exposes a workflow as a callable tool.
ToolInfo
Metadata describing a tool available for LLM function calling.

Traits§

Tool
Trait for implementing callable tools.

Functions§

call_tool
Invokes a tool by name with the given arguments.
call_tools
Executes multiple tool calls and returns the results as messages.
get_tool
Retrieves a tool by name from the global registry.
list_tool_infos
Returns information about all registered tools.
list_tool_infos_patterns
Returns tool information for tools matching the given regex patterns.
register_tool
Registers a tool with the global registry.
unregister_tool
Removes a tool from the global registry by name.