Sandboxes overview
How a local OpenCode agent runs builds, tests, and previews in a remote sandbox while the conversation and checkout stay on your machine.
This page explains what a Gitterm sandbox is, how a typical session goes, and when to use one instead of /cloud. Read it before Setup.
What a sandbox is
A sandbox is a plain remote machine that your local agent sends commands to. The sandbox plugin for OpenCode (@gitterm/opencode-sandbox) adds sandbox_* tools to your agent, and lists the checkout's sandboxes in OpenCode's right sidebar. The conversation and your checkout stay on your machine. Only the commands run remotely.
A sandbox:
- runs no coding agent and receives no model credentials
- gets only the working tree you sync and the commands you run
- uses a plain image, such as
node:22-bookworm-slim(see Providers)
Local commands are unchanged. The agent keeps running shell commands on your machine as before, and uses the sandbox only when it calls a sandbox_* tool.
A typical session
sandbox_createstarts a sandbox with a lifetime (30 minutes by default).sandbox_syncuploads your working tree, including uncommitted changes, to~/projectin the sandbox.sandbox_execruns a command such asnpm testas a job and returns its output.sandbox_previewexposes a port, optionally starting a dev server first.sandbox_artifactdownloads a file a job produced, andsandbox_applycopies it into your checkout.sandbox_destroydeletes the sandbox once you are done.
OpenCode asks you to approve steps that cost money, upload files, run commands, or change your checkout. You can pre-approve routine steps; see Approvals.
Sandbox or /cloud?
/cloud moves the conversation and checkout into a cloud workspace that runs OpenCode. See Concepts.