工具与工具集
工具是扩展代理能力的函数。它们被组织成逻辑上的工具集,可根据不同平台启用或禁用。
可用工具
Hermes 内置了广泛的工具注册表,涵盖网络搜索、浏览器自动化、终端执行、文件编辑、记忆存储、任务委派、强化学习训练、消息发送、Home Assistant 集成等。
Honcho 跨会话记忆 作为记忆提供者插件(plugins/memory/honcho/)提供,而非内置工具集。请参阅 插件 了解安装方式。
高层次分类如下:
| 类别 | 示例 | 描述 |
|---|---|---|
| 网络 | web_search, web_extract | 搜索网络并提取页面内容。 |
| 终端与文件 | terminal, process, read_file, patch | 执行命令并操作文件。 |
| 浏览器 | browser_navigate, browser_snapshot, browser_vision | 支持文本与视觉的交互式浏览器自动化。 |
| 媒体 | vision_analyze, image_generate, text_to_speech | 多模态分析与生成。 |
| 代理编排 | todo, clarify, execute_code, delegate_task | 规划、澄清、代码执行及子代理委派。 |
| 记忆与召回 | memory, session_search | 持久化记忆与会话检索。 |
| 自动化与交付 | cronjob, send_message | 支持创建/列出/更新/暂停/恢复/运行/移除的定时任务,以及外发消息传递。 |
| 集成 | ha_*, MCP 服务器工具, rl_* | Home Assistant、MCP、强化学习训练及其他集成。 |
关于权威的代码生成注册表,请参阅 内置工具参考 和 工具集参考。
使用工具集
# Use specific toolsets
hermes chat --toolsets "web,terminal"
# See all available tools
hermes tools
# Configure tools per platform (interactive)
hermes tools
常见工具集包括 web, terminal, file, browser, vision, image_gen, moa, skills, tts, todo, memory, session_search, cronjob, code_execution, delegation, clarify, homeassistant, 以及 rl。
完整工具集请见 工具集参考,包括平台预设如 hermes-cli, hermes-telegram,以及动态 MCP 工具集如 mcp-<server>。
终端后端
终端工具可在不同环境中执行命令:
| 后端 | 描述 | 使用场景 |
|---|---|---|
local | 在本地机器上运行(默认) | 开发环境,可信任务 |
docker | 隔离容器 | 安全性要求高,可复现性需求 |
ssh | 远程服务器 | 沙箱环境,避免代理接触自身代码 |
singularity | HPC 容器 | 集群计算,无 root 权限 |
modal | 云执行 | 无服务器架构,弹性伸缩 |
daytona | 云沙箱工作区 | 持久化的远程开发环境 |
配置
# In ~/.hermes/config.yaml
terminal:
backend: local # or: docker, ssh, singularity, modal, daytona
cwd: "." # Working directory
timeout: 180 # Command timeout in seconds
Docker 后端
terminal:
backend: docker
docker_image: python:3.11-slim
SSH 后端
推荐用于安全——代理无法修改自身代码:
terminal:
backend: ssh
# Set credentials in ~/.hermes/.env
TERMINAL_SSH_HOST=my-server.example.com
TERMINAL_SSH_USER=myuser
TERMINAL_SSH_KEY=~/.ssh/id_rsa
Singularity/Apptainer
# Pre-build SIF for parallel workers
apptainer build ~/python.sif docker://python:3.11-slim
# Configure
hermes config set terminal.backend singularity
hermes config set terminal.singularity_image ~/python.sif
Modal(无服务器云)
uv pip install modal
modal setup
hermes config set terminal.backend modal
容器资源
为所有容器后端配置 CPU、内存、磁盘和持久化设置:
terminal:
backend: docker # or singularity, modal, daytona
container_cpu: 1 # CPU cores (default: 1)
container_memory: 5120 # Memory in MB (default: 5GB)
container_disk: 51200 # Disk in MB (default: 50GB)
container_persistent: true # Persist filesystem across sessions (default: true)
当启用 container_persistent: true 时,已安装的包、文件和配置将在会话间持续保留。
容器安全
所有容器后端均采用安全加固措施:
- 只读根文件系统(Docker)
- 移除所有 Linux 权限能力
- 禁止权限提升
- PID 限制(最多 256 个进程)
- 完全命名空间隔离
- 通过卷实现持久化工作区,而非可写根层
Docker 可选择通过 terminal.docker_forward_env 显式指定环境变量白名单,但传入的变量在容器内可见,应视为对当前会话暴露。
后台进程管理
启动后台进程并进行管理:
terminal(command="pytest -v tests/", background=true)
# Returns: {"session_id": "proc_abc123", "pid": 12345}
# Then manage with the process tool:
process(action="list") # Show all running processes
process(action="poll", session_id="proc_abc123") # Check status
process(action="wait", session_id="proc_abc123") # Block until done
process(action="log", session_id="proc_abc123") # Full output
process(action="kill", session_id="proc_abc123") # Terminate
process(action="write", session_id="proc_abc123", data="y") # Send input
PTY 模式(pty=true)支持交互式 CLI 工具,如 Codex 和 Claude Code。
sudo 支持
若命令需要 sudo 权限,系统将提示输入密码(该密码将在会话期间缓存)。也可在 ~/.hermes/.env 中设置 SUDO_PASSWORD。
在消息平台中,若 sudo 失败,输出将包含提示:请将 SUDO_PASSWORD 添加至 ~/.hermes/.env。