The tool system provides the Hermes Agent with its action capabilities through a structured function-calling architecture. This page introduces the high-level framework of the tool registry, how toolsets are composed and managed, and how tool discovery and execution flow through the system.
Specific technical details about individual tool categories and implementations are delegated to child pages, linked below. This parent page provides the architectural context and explains the integration among major components involved in the Hermes tool system.
The Hermes Agent leverages a centralized registry pattern for tools, where each tool module self-registers its schema, handler, and a function to check availability, triggered at module import time. tools/registry.py1-15
ToolRegistry) holds metadata and handlers, serving as the definitive source of available tools in the system. tools/registry.py87-118model_tools.py module orchestrates tool discovery by importing all tool modules, then provides the public API for retrieving tool schemas and handling function calls. model_tools.py1-21toolsets.py group tools by use case or scenario. Toolsets may be composed from individual tools or by including other toolsets recursively, enabling flexible configuration. toolsets.py1-24This modular design supports both synchronous and asynchronous tools, with robust bridging between sync agent logic and async handlers to optimize external calls.
Sources: model_tools.py1-30 toolsets.py1-24 tools/registry.py1-118 hermes_cli/plugins.py28-32
Each tool registers itself by calling registry.register() at module load time. This registers metadata including:
check_fn)Tool discovery is primarily performed by model_tools.py invoking discover_builtin_tools() from tools/registry.py:
Title: Tool Discovery Sequence
tools/ directory that contain top-level registry.register() calls. tools/registry.py67-84PluginManager, which then registers their tools via ctx.register_tool(). hermes_cli/plugins.py5-32tools_config.py. hermes_cli/tools_config.py91-121For details, see Tool Registry and Toolsets.
Sources: model_tools.py31-34 tools/registry.py67-84 hermes_cli/tools_config.py91-121 hermes_cli/plugins.py5-32
Each tool consists of the following elements:
Tools specify their parameter interface using OpenAI-compatible function calling schemas. This includes the tool name, description, and JSON Schema parameters. tools/registry.py99-101
handler(args: dict, **kwargs) -> str_run_async. model_tools.py97-116Tools can specify a check_fn returning a boolean indicating runtime availability. This allows conditional exposure for tools depending on API keys, environment dependencies (e.g., Docker, Playwright), or platform capabilities. Results are cached for ~30 seconds via _check_fn_cached. tools/registry.py154-181
Sources: tools/registry.py87-181 model_tools.py11-20
Title: Tool Invocation Flow
handle_function_call() as the entry point for tool execution. model_tools.py13pre_tool_call hooks registered by plugins are invoked. hermes_cli/plugins.py136_run_async() to execute either sync or async handlers correctly across different thread contexts (main thread vs. worker threads). model_tools.py97-116post_tool_call hooks are invoked. hermes_cli/plugins.py137max_result_size_chars. tools/registry.py108Sources: model_tools.py11-116 tools/registry.py87-118 hermes_cli/plugins.py135-137
Tools are grouped into logical toolsets to simplify configuration and filtering. Toolsets are defined in toolsets.py and map tool names to functional groups. toolsets.py31-81
| Toolset | Description | Primary Tools |
|---|---|---|
web | Web research and content extraction | web_search, web_extract |
terminal | Command execution and processes | terminal, process |
file | File manipulation (read, write, patch) | read_file, write_file, patch |
browser | Browser automation (Playwright) | browser_navigate, browser_click |
vision | Image analysis | vision_analyze |
video | Video analysis and understanding | video_analyze |
code_execution | Sandboxed code execution | execute_code |
delegation | Task delegation to subagents | delegate_task |
Toolsets can include other toolsets using the includes key, enabling nested composition. toolsets.py96-102
For details, see Tool Registry and Toolsets.
Sources: toolsets.py31-224 hermes_cli/tools_config.py91-121
The hermes_cli/tools_config.py module defines CONFIGURABLE_TOOLSETS for UI toggling and provider-aware configuration (e.g., setting API keys for vision or search). hermes_cli/tools_config.py95-121
Hermes agent supports external tools via the Plugin system. Plugins are configured under the plugins key in ~/.hermes/config.yaml. hermes_cli/plugins.py1-32
ctx.register_tool() to add tools to the central registry. hermes_cli/plugins.py30-31For details, see Tool Registry and Toolsets.
Sources: hermes_cli/plugins.py1-32 hermes_cli/tools_config.py91-121
The model_tools.py module implements a robust asynchronous bridge _run_async(coro) that ensures asynchronous tool handlers can be called safely from synchronous agent loops. model_tools.py97-116
_tool_loop) on the main thread to prevent "Event loop is closed" errors. model_tools.py60-73_worker_thread_local. model_tools.py75-94Sources: model_tools.py51-125
For detailed technical documentation and implementation specifics, see the following child pages:
Title: Toolset and Tool Code Entities
Sources: model_tools.py1-125 tools/registry.py67-181 toolsets.py31-81 hermes_cli/tools_config.py91-121 hermes_cli/plugins.py5-32
Refresh this wiki
This wiki was recently refreshed. Please wait 3 days to refresh again.