Skip to main content
Tools are the actions your agent can take. At runtime, the Engine dispatches tool calls from a Decision to the ToolRegistry, which looks up and executes the matching callable.

The @tool decorator

Mark any callable as a QitOS tool with @tool. The decorator attaches metadata to the function without changing its behavior — you can still call the function normally in tests.

@tool parameters

ToolPermission

ToolPermission declares what the tool is allowed to do. The Engine uses this information during preflight validation to check environment capabilities.
All four fields default to False.

ToolRegistry

ToolRegistry is the collection the Engine queries when dispatching actions. Pass it to your AgentModule via the constructor.

Registering individual tools

Use registry.register() to add a single callable or BaseTool instance:
You can also supply a custom name or override metadata at registration time:
Tool names must be unique within a registry. Registering two tools with the same name raises a ValueError.

Scanning a module or object with include

registry.include(obj) scans all public, callable attributes of obj and registers any that have @tool metadata:
This is the preferred pattern when you organize related tools as methods on a class.

Registering toolsets

A toolset is any object that has a tools() method returning a list of callables or BaseTool instances. Register it with register_toolset():
Tools from a toolset are automatically namespaced: toolset_name.tool_name. You can override the namespace:

BaseTool and FunctionTool

For tools that need shared state or lifecycle management, subclass BaseTool directly:
FunctionTool is the wrapper that register() creates automatically when you pass a plain callable. You rarely need to instantiate it directly.
For most practical coding agents, prefer preset toolsets such as CodingToolSet or the registry builders in qitos.kit.toolset rather than hand-registering every file and shell tool yourself.

Passing the registry to AgentModule

Pass your populated ToolRegistry to AgentModule.__init__():
The Engine reads agent.tool_registry and creates an ActionExecutor from it. You can also call registry.get_tool_descriptions() to get a formatted string of all registered tools for inclusion in your system prompt:

Full example