Skip to main content
The terminal backend determines where the agent executes shell commands. You can run commands on your local machine, inside a Docker container, on a remote server over SSH, or in serverless cloud sandboxes that hibernate when idle.

What terminal backends are

Every call to the terminal and file tools routes through an execution backend. The backend provides an isolated environment with its own filesystem, shell, and process namespace. Backends are persistent across a conversation — the same shell session (with its working directory and environment) stays alive between tool calls.

Configuring the backend

Set the backend in ~/.hermes/config.yaml under terminal.backend:
terminal:
  backend: local   # local | docker | ssh | daytona | singularity | modal
Or set the TERMINAL_ENV environment variable:
export TERMINAL_ENV=docker

Backends

The default backend. Commands run directly on your machine in your current working directory.
terminal:
  backend: local
  cwd: "."       # use current directory (default)
  timeout: 180   # seconds
When to use: everyday development, scripts that need access to your local filesystem and tools.The local backend requires no setup and has no overhead. Use pty: true on the terminal tool for interactive programs (Python REPL, editors).

Common configuration options

OptionDefaultDescription
terminal.backendlocalWhich backend to use
terminal.timeout180Default command timeout in seconds
terminal.cwd. (local) / /root (containers)Working directory
terminal.container_cpu1CPU cores (container backends)
terminal.container_memory5120Memory in MB (container backends)
terminal.container_disk51200Disk in MB (container backends)
terminal.container_persistenttruePersist filesystem across sessions
terminal.persistent_shelltrue (SSH)Keep shell state between calls

Environment lifecycle

Backends are created lazily on first use and kept alive for the duration of the session. A background cleanup thread removes inactive environments after terminal.lifetime_seconds (default: 300 seconds) of inactivity — but only if there are no active background processes. To manually clean up an environment, end your session or run:
from tools.terminal_tool import cleanup_all_environments
cleanup_all_environments()
The TERMINAL_ENV environment variable overrides terminal.backend in config.yaml. This is useful for overriding the backend for a single session without changing your config.

Build docs developers (and LLMs) love