Skip to main content
The rllm.tools module exposes the data types (Tool, ToolCall, ToolOutput) the rLLM parser uses when reading tool calls out of model responses, plus a small registry. The higher-level MultiTool / ToolEnvironment wrappers that the old Workflow path used have been removed.
For a modern tool-using agent, the recommended pattern is to declare tools as plain Python callables and pass an OpenAI-spec tools list directly to the chat-completions API — see cookbooks/finqa/finqa_tools.py for a worked example with four tools, native OpenAI function calling, and a process-wide SQLite store. Use the data types below if you need to parse tool calls out of a raw text response (e.g. for non-native tool-call formats); see Parsers.

Tool

Base class for all tools.

Constructor

name
str | None
Name of the tool. Required if function is not provided.
description
str | None
Description of the tool’s purpose. Required if function is not provided.
function
Callable | None
Function to convert to tool format. If provided, name and description are auto-extracted from docstring.

Properties

json
dict
Tool schema in OpenAI function calling format.

Methods

forward

Synchronous implementation of tool functionality.
output
ToolOutput
Tool execution result.

async_forward

Asynchronous implementation of tool functionality.

call

Make the tool callable.
use_async
bool | None
Whether to use async implementation. Auto-detects if None.

ToolOutput

Dataclass for tool execution results.

Fields

name
str
Name of the tool that produced this output.
output
str | list | dict | None
The tool’s output data.
error
str | None
Error message if execution failed.
metadata
dict | None
Additional metadata about the execution.

Methods

to_string

Convert output to string representation.

ToolCall

Dataclass representing a tool call.

Fields

name
str
Name of the tool to call.
arguments
dict[str, Any]
Arguments to pass to the tool.

ToolRegistry

Singleton registry for managing tools.

Methods

register

Register a tool class.
name
str
Name to register the tool under.
tool_cls
type[Tool]
Tool class to register.

register_all

Register multiple tools at once.

get

Get a tool class by name.
tool_cls
type[Tool] | None
Tool class if found, None otherwise.

instantiate

Instantiate a tool by name.
name
str
Name of the tool to instantiate.
*args, **kwargs
Any
Arguments to pass to tool constructor.

list_tools

List all registered tool names.

clear

Clear all registered tools.

unregister

Unregister a tool by name.

Example: Creating a Tool from Function


Example: Creating a Custom Tool Class


Example: Async Tool


Example: Tool Registry