Tools API¶
Tool system for extending agent capabilities.
Tool Base Class¶
from legionhercules.tools.base import Tool, ToolResult
class MyTool(Tool):
def __init__(self):
super().__init__(
name="my_tool",
description="What my tool does"
)
async def execute(self, **kwargs) -> ToolResult:
# Implementation
return ToolResult(success=True, output="result")
def get_schema(self) -> dict:
return {
"type": "object",
"properties": {...},
"required": [...]
}
ToolRegistry¶
from legionhercules.tools.base import ToolRegistry
# Create registry
registry = ToolRegistry()
# Register tool
registry.register(MyTool())
# Get tool
tool = registry.get_tool("my_tool")
# List tools
tools = registry.list_tools()
Built-in Tools¶
- FileReadTool
- FileWriteTool
- FileEditTool
- BashTool
- WebSearchTool