Skip to main content

Sandbox

The sandbox service isolates code execution from the API and worker containers. When an agent runs a skill script or a shell command, the sandbox service launches a dedicated child Docker container for the run, applies resource limits, and returns the output — so untrusted code never executes inside the application processes.

Responsibilities​

  • Execute skill scripts and shell workloads in per-run child containers.
  • Enforce memory, CPU, process-count, and timeout limits per run.
  • Provide a constrained working directory and (by default) a read-only root filesystem.
  • Keep runtime dependencies (interpreters, package installs) away from the API image.

Services​

ServiceRole
sandboxHTTP service that manages isolated execution containers.
sandbox-skill-imageBuilds sandbox-skill:latest, the base image child containers run. Building it inside Compose means docker compose up --build -d needs no separate prebuild step.

Configuration​

The API and worker reach the sandbox through:

VariableDefaultPurpose
SANDBOX_SERVICE_URLhttp://sandbox:8000Endpoint for sandbox calls.
SHELL_SANDBOX_ENABLEDtrueAllows shell-backed agent tools. Set false to disable shell execution entirely.
SANDBOX_EXEC_QUEUE_WAIT_SECONDS600How long a command may wait for a free slot of the user's sandbox before it is answered "not started". A durable chat run parks meanwhile (waiting_resource / sandbox_exec_slot) and resumes when its command starts.

The sandbox service itself is tuned with SANDBOX_* variables on the sandbox container:

VariableDefaultPurpose
SANDBOX_IMAGEsandbox-skill:latestImage for child containers.
SANDBOX_NETWORKbridgeDocker network child containers join.
SANDBOX_DNS_SERVERSunsetOptional DNS override for child containers.
SANDBOX_MEMORY1gMemory limit of a sandbox (one general sandbox per user, shared by all of the user's work).
SANDBOX_CPUS1.0CPU limit of a sandbox.
SANDBOX_PIDS_LIMIT512Max processes (tasks) of a sandbox.
SANDBOX_MAX_SANDBOXES5Hard cap on live child containers.
SANDBOX_MEMORY_OVERCOMMIT2.0Memory admission: a container is created only while the sum of container memory limits stays within host memory × this factor − SANDBOX_MEMORY_RESERVE.
SANDBOX_MEMORY_RESERVE256mMemory kept for Docker, the sandbox service and the OS.
SANDBOX_MAX_CONTAINER_MEMORYhost memory − reservePer-container ceiling; a larger request is clamped to it (the create response carries a warning).
SANDBOX_OVERRIDE_MAX_MEMORY / _CPUS / _PIDS / _WORKDIR_TMPFS8g / 8 / 1024 / 4gUpper bounds on what a caller may request. Only memory, CPUs, PIDs, workdir size, network (within SANDBOX_ALLOWED_NETWORKS) and timeouts can be overridden; image, mounts and security settings cannot.
SANDBOX_OVERRIDE_MAX_EXEC_TIMEOUT / _INSTALL_TIMEOUT1800 / 900Longest command and install timeout a caller may request. External-agent pool runners set the exec cap to 3600. For a started command neither is a total: its timeout counts from its last sign of work, so a command that is working is never ended for taking long, and this is the longest it may go with no sign of work and no renewal by its caller (POST /executions/{id}/extend). Manor renews an agent run (Claude Code, OpenAI) for as long as the run reports activity.
SANDBOX_ACTIVITY_INTERVAL_SECONDS / _MIN_CPU_SHARE / _MIN_IO_BYTES5 / 0.01 / 4096What counts as a sign of work for a started command, besides anything it prints: looked at this often, its own processes used this share of one CPU, or read or wrote this many bytes, or came and went. A command that shows none for its timeout is ended.
SANDBOX_MAX_CONCURRENT_EXECUTIONS4Commands one sandbox runs at once; further bounded by memory/256 MiB and pids/32.
SANDBOX_MAX_QUEUED_EXECUTIONS64Commands that may wait for a slot in one sandbox (fair FIFO across conversations and tasks).
SANDBOX_MAX_LIFETIME_SECONDS86400A sandbox older than this is recycled once nothing runs or waits in it (0 never). Its files are temporary.
SANDBOX_DISK_WATCHDOG_INTERVAL_SECONDS3How often the runner measures the disks of a sandbox with work in it, per work area (0 disables the disk watchdog).
SANDBOX_WORKDIR_TMPFS_SIZE / SANDBOX_WORKSPACE_TMPFS_SIZE256m / 256mSize of /skills (loaded Skills, side by side) and /workspace (one area per conversation or task).
SANDBOX_TMP_TMPFS_SIZE / SANDBOX_HOME_TMPFS_SIZE64m / 64mSize of /tmp, /var/tmp and the sandbox user's home. All tmpfs count against SANDBOX_MEMORY.
SANDBOX_READ_ONLY_ROOTtrueMount the child container root read-only.
SANDBOX_WORKDIR/skillWritable working directory inside the child.
SANDBOX_INSTALL_TIMEOUT300Seconds allowed for npm/pip installs.

Operational Guidance​

The public native browser and Code Projects execution paths use self-hosted sandbox capabilities. The private Chrome extension/CLI runtime is not required or included. Missing sandbox configuration should be resolved for the dependent tool, not by disabling unrelated Workspace features. Commercial quota bypasses do not bypass sandbox resource limits, approval or tool scopes.

  • Only expose the sandbox endpoint inside the Docker network; nothing outside the stack should reach it.
  • Treat shell execution as a sensitive capability: pair it with agent tool scope and HITL governance so shell-using agents run under approval policies.
  • Child containers are named with the skill-sbx- prefix; if a run is killed uncleanly you can list and remove leftovers with docker ps -a --filter name=skill-sbx-.
  • Raise SANDBOX_MEMORY / SANDBOX_CPUS if legitimate skills hit limits; the defaults favor protecting the host.
  • One command cannot burn out a shared sandbox: a command over the memory limit is killed alone and reported as out of memory, a runaway process tree is stopped as a whole when the sandbox nears its pids limit, and when /workspace is nearly full (92%) the commands of the work area holding the most of it are stopped (disk_killed) and that area's new commands are refused as not started until it frees space (cleanup commands such as rm still run); every other command keeps running, and a full disk never recycles the shared sandbox. Commands beyond the slot limit wait their turn instead of failing.