Skip to content

Sandbox Backends

源码版本v2026.7.20

Responsibility

The agent needs to execute commands and run code, but arbitrary commands can't be allowed to hit the host directly. Hermes's terminal tool supports 6 execution backends, chosen by safety/isolation/cost tradeoffs: Local (direct on host), Docker (container isolation), SSH (remote machine), Singularity (HPC container), Modal (cloud sandbox, direct or managed), Daytona (cloud dev environment). Container hardening + namespace isolation; dangerous commands are also intercepted via approval callbacks.

Key Files

Data Flow

  1. The agent decides to execute a command → tool_call terminaltools/terminal_tool.py.
  2. The backend is chosen by job config (local/docker/modal/ssh/singularity/daytona):
  3. Dangerous commands are intercepted by approval callbacks — the main loop uses interactive approval; subagents default to auto-deny (tools/delegate_tool.py:75), and cron/batch can opt into auto-approve.
  4. Command output is backfilled to the main loop; long tasks can be daemonized (tools/daemon_pool.py).

Summary

The sandbox layer is "execution isolation + dangerous-command control": 6 backends cover host through HPC to cloud; Docker detects bind mounts to prevent privilege escalation; Modal distinguishes direct/managed credentials; dangerous commands uniformly go through approval callbacks. Subagents and cron take the non-interactive auto-deny/auto-approve path.

Unofficial community learning site. Content based on the MIT-licensed NousResearch/hermes-agent source.