Cohub
中文Start a Space

What an AI agent sandbox isolates in a Cohub Space, and what stays reachable

In Cohub the agent's sandbox is the Space's own Linux environment: one runtime per Space, the project on a persistent volume, a fixed CPU and memory quota. A fresh container per command would start clean each time; this one keeps state, so what matters is what it keeps and what it shares.

A shallow pale-grey enamel tray with a single vermilion-red rim sits on a charcoal workbench, holding a stack of off-white paper and one short steel ruler; the bench outside the tray is empty.
Who
A developer about to let an agent run commands on a project, who needs to know what those commands can reach and what they leave behind.
When
You are choosing between an agent on your laptop, a cloud Space and a per-command sandbox, and want the isolation each one actually gives.
Why
A Space's sandbox is one long-lived runtime next to the project files, so its limits differ from a container that starts fresh for every command.
Your cohub run command and the agent's bash command reach the same /workspace in one Space. A restart keeps files under /workspace and Saves, while processes, /tmp and packages outside /workspace are gone; the standard runtime measured 2 CPUs and 4 GiB.
One Space, one runtime: what both commands touch, and what a restart keeps.

An AI agent sandbox in Cohub isolates at the Space level, not per shell command. Every turn from an agent and every cohub run call from your CLI executes inside the same Linux runtime, so checking what persists, what resets on restart, what stays read-only, and what stays open matters before you hand over a repository.

The boundary is the Space, not the command

One Space gets one Linux environment running as uid=1000(node). In a test run, a CLI call wrote persist-check.txt under /workspace at 04:24 and a Chat turn four minutes later read the same file back—no sync step, because both ran in the same runtime.

Measured through the CLI on 2026-11-26 (cohub CLI 10.37.1, sandbox v2.111.0) on a fresh standard Space with the default image:

cohub spaces create --name "Sandbox check"
cohub -s <space-id> run --command '
  uname -srm
  cat /sys/fs/cgroup/cpu.max
  cat /sys/fs/cgroup/memory.max
  nproc'
Linux 6.6.102-8.alnx4.x86_64 x86_64
200000 100000
4294967296
8

200000 100000 sets the cgroup quota to 2 CPUs and 4294967296 caps memory at 4 GiB. nproc reports 8 from the host, so size builds against the cgroup values rather than nproc.

A Cohub Chat in dark theme: the agent ran three bash checks in the Space's sandbox and listed the kernel, cpu.max 200000 100000 (2 CPUs), memory.max 4 GiB, Node v26.12.1, Python 3.13.5, Chrome 155 and the persist-check.txt file left in /workspace
A test Space on cohub.live, 2026-11-26

Commands inside the same Space share one user, one kernel, and accumulated state: a failed package install stays broken until you remove it, reinstall it, or restore a Save. For full lifecycle, virtual screen, and port-preview details, read the Files & Sandbox specification.

What persists and what resets

A new Space created from the CLI starts with autoDestroy: idle and a 3600-second (one-hour) idle TTL. When the sandbox stops or restarts, state splits cleanly in two:

  • Persists across restarts: /workspace (mounted on a separate network volume) and any Saves you create. Keep project source and project-local dependencies under /workspace.
  • Resets on stop or restart: running processes (dev servers, published port listeners, nohup jobs), /tmp, and packages installed outside /workspace such as global npm binaries.

Run cohub spaces config <space-id> --auto-destroy never to keep the sandbox running or --idle-ttl to change the window. Place repeatable tool installs in .cohub/setup.sh, which runs on every new sandbox.

The image itself is fixed to two platform options: default (measured with Node 26.12.1, Python 3.13.5, git, ffmpeg, xvfb-run, ripgrep, Chrome for Testing 155, NumPy, and build tools) and game (adds Godot and Blender). A project can request a different spec (standard, boost, ultra) or the game image in .cohub/sandbox.json—for example, {"version": 1, "spec": "boost"} sets pendingRestart: true in cohub spaces config <space-id> --json until the sandbox restarts, and falls back to a lower spec with a warning if your plan does not cover the request. .cohub/sandbox.json does not accept custom image URLs, extra mounts, environment variables, or privileged mode.

Read-only paths

/configs and /mods are mounted read-only inside the runtime; running touch /configs/x returns Permission denied.

Because /mods is read-only, mounting another Space as a Mod lets the agent inspect its latest Save without allowing commands in the current Space to modify the source Space.

What the network and secrets can reach

Outbound network egress is open by default: curl -s -o /dev/null -w '%{http_code}' https://example.com returned 200 in the 2026-11-26 check. A command that can fetch dependencies can also transmit files outward.

Because every command runs as uid=1000(node), an agent turn can read every file under /workspace—including uploads added by other Space members—as well as environment variables configured on the Space. Keep sensitive credentials out of Spaces shared with untrusted collaborators or scripts.

Local Runtime (cohub runtime up) has a different reach than a cloud Space: file paths are fenced to the project folder, while shell commands run as your local OS user and can reach the rest of your computer. Run commands you do not want touching your laptop inside a cloud Space instead.

If you need to control cluster-level isolation, networking, and storage on your own infrastructure, see self-hosting Cohub on your own cluster.

Checks before running code you did not write

Before letting an agent execute third-party repositories or unfamiliar build scripts in a Space:

  1. Audit credentials and uploads: verify the Space has no personal tokens, production keys, or sensitive files in /workspace or Space environment variables, since outbound network access is open.
  2. Create a Save first: snapshot /workspace before installs or migrations so you can restore or fork from a known-good tree (see Cohub Saves documentation).
  3. Confirm the execution target: make sure the chat targets a cloud Space rather than a Local Runtime connected to your own laptop.
  4. Check whether per-Space state fits: if your own product needs a fresh ephemeral container per untrusted request, a Cohub Space pairs one shared runtime with Chats, files, and Apps rather than spinning up a container per command.

Reference in the docs

This page: Whether a Space's sandbox is the right place to run an agent's commands, or the task needs a fresh container per run or your own machine.

  • Files & Sandbox: what the Sandbox is, ports and previews, and what happens on idle or restart
  • Saves: freezing the workspace at a known-good state before a risky run
  • CLI: the cohub commands used here: spaces create, run, config

FAQ

Is a Cohub sandbox a container per command?

No. A Space has one runtime, and the agent's commands and your CLI commands run in it on the same workspace. A restart replaces the runtime; the files stay.

Can I bring my own Docker image or install system packages?

No. The .cohub/sandbox.json file accepts only image (default or game) and spec (standard, boost, ultra). Keep project dependencies under /workspace, which persists, and put repeatable setup in .cohub/setup.sh.

What happens to my files when the sandbox stops?

/workspace stays, because it is a separate volume from the container. Processes and /tmp end with the sandbox. Saves freeze the workspace on purpose, so you can start a new Space from one.

Sources

Published · Updated