Tool Registry API
Manage and execute tools programmatically.
ToolRegistry
from owl.tools import get_tool_registry, ToolProfile
registry = get_tool_registry()
Methods
set_profile(profile)
registry.set_profile(ToolProfile.CODING)
get_profile()
profile = registry.get_profile() # ToolProfile.CODING
is_tool_available(name)
available = registry.is_tool_available("write_file") # True/False
get_definitions()
definitions = registry.get_definitions()
# Returns LLM-compatible tool definitions
execute(name, args)
result = registry.execute("read_file", {"path": "file.py"})
list_all()
tools = registry.list_all()
# {"read_file": {"available": True, "group": "fs", ...}}
ToolProfile Enum
class ToolProfile(Enum):
MINIMAL = "minimal" # Read-only
CODING = "coding" # Read + write
FULL = "full" # All tools
ToolGroup Enum
class ToolGroup(Enum):
FS = "fs" # File system
SEARCH = "search" # Search
EXEC = "exec" # Execution
INTERACT = "interact" # User interaction
Adding Custom Tools
from owl.tools import get_tool_registry, ToolGroup
def my_tool(arg1: str, arg2: int = 10) -> dict:
return {"result": f"{arg1} x {arg2}"}
registry = get_tool_registry()
registry.register(
name="my_tool",
description="Does something useful",
group=ToolGroup.FS,
function=my_tool,
can_write=False,
parameters={
"type": "object",
"properties": {
"arg1": {"type": "string"},
"arg2": {"type": "integer"}
},
"required": ["arg1"]
}
)