Sandbox capabilities
Discover the templates and limits in your workspace, then choose how to run code, fork sessions, access data or use a model.
A sandbox is a private Linux machine in your workspace. Open a shell to edit files, run tests or preview a server. Pause a session to pick it up later, or fork it to try a change on a separate copy. You can create a sandbox before you have an app.
Start a sandbox
A running sandbox is called a session. Your workspace needs a worker to run one.
In the dashboard, open Services → New → Sandbox. Enter a name, choose a template and select Create sandbox. Under Sessions, select Start session. When the session is running, open Terminal.
From the CLI, sign in and start a sandbox with this command.
smolcloud sandbox new
This starts a session on the default template. Use the IDs printed beside Environment: and Session: in place of ENV_ID and SESSION_ID below.
smolcloud sandbox exec ENV_ID SESSION_ID -- pwd
The command prints the working directory inside the sandbox. Open a shell and work with your files.
Choose a template
A template sets the tools and machine size your session starts with. In the dashboard, choose Template and size when you create the sandbox. To choose from the CLI, run smolcloud sandbox templates and copy the identity of the template you want.
smolcloud sandbox create NAME TEMPLATE_IDENTITY
Use the returned id in smolcloud sandbox start ENV_ID. Each session starts with its own copy of the template. Workspace owners can build a template with tools preinstalled by running setup commands on an approved base. Custom kernels and Dockerfile builds are unsupported.
Work in a live session
- Run and debug code. Open the browser terminal, run a command with
smolcloud sandbox exec, or attach withsmolcloud sandbox sshon Linux or macOS with OpenSSH. Commands return their exit code. The process API streams output, accepts input and signals, and can reconnect to a running process. After an interrupted command stream, list processes and reconnect before starting more work. Interactive sessions. - Work with files. Use
sandbox writeto upload a local file andsandbox readto download it. The filesystem RPC can inspect, list, move, remove and watch files or directories. One file transfer is limited to 4 MiB. A session allows 64 MiB of transfer in total. Copy a file from a session. - Test a service on a port. Start a server in the guest, then ask the session API for its response. Use
POST /portsfor HTTP,POST /ports/streamfor a streamed response, or a WebSocket upgrade on/forwardunder the session URL. Each request checks access. For an HTTPS address to share with teammates, deploy a private app.
Pause, fork and recover
Pause saves files, memory and running programs to the worker. Resume restores them on that worker. A snapshot captures a starting point for more sessions. A fork takes a snapshot and starts a second, independent session. To compare two repository changes side by side, allow two concurrent sessions and leave enough capacity for both. Fork a working session.
New environments default to one concurrent session and at most five minutes of running time. An owner can raise the limit up to twelve hours, subject to the worker lease. Read deadlineAt for the effective deadline. A pause can fail if the worker lacks space, so wait for paused before treating work as saved.
Pauses expire after 30 days, ordinary snapshots after seven days, and fork snapshots after one day. Stopping deletes the session’s files. Worker disk loss also loses its pauses and snapshots. Download important output to a separate machine for recovery. Session limits and retention.
Run a job or use a model
For a single command, post a job with its time limit and optional input files. Poll for completion, then fetch the final stdout, stderr and result. Retry a lost submission with the same body and idempotency key. An app-backed job can export declared files to its approved bucket. For standalone work, download files from a session. One-off jobs.
For a model-guided task, use an app-backed agent job. Its runner calls an approved model through the workspace gateway and lets it issue bounded commands in the guest. The provider key stays on the gateway on customer compute. The model provider receives the conversation, and the router handles prompts and responses in transit. The job result and export receipts tell you what completed. Agent jobs · Workspace architecture.
Give the machine access
- Internet. Network access starts blocked. An owner can allow exact public hosts, choose the package-registry preset, or allow public HTTP and HTTPS on a qualified worker. General web permits sending data to public destinations. Network settings.
- Database and bucket. An authorized caller can grant a session access to an app’s PostgreSQL database or bucket. Allow the workspace HTTPS hostname first. The guest receives a short-lived capability for that resource. Pausing, snapshotting or stopping revokes the grant. Reconnect explicitly after a resume or fork. Resource grants and examples.
- Workspace actions. To create resources or deploy from inside a session, an administrator connects a named agent with those permissions. Its session credential is separate from a data grant or model access. Connect a coding agent.
If your sandbox doesn’t start
- No worker attached. Open Settings → Workspace and look under Compute. A session can start once the workspace has a worker with room to run it.
- Sandboxes are disabled or the template is too large. Run
smolcloud sandbox templatesto see the workspace settings. Ifenabledis false, ask the owner to enable sandboxes in Settings → Sandbox limits. If the template exceeds the workspace limits, choose a smaller size. - The start command timed out. Run
smolcloud sandbox sessions ENV_IDto see whether the session started before trying again. If you need the environment ID,smolcloud sandbox listlists the sandboxes you can access.
Use the API
With your workspace credentials, call GET /api/sandbox-environments/options for templates, limits and availability. If available is false, unavailableReason explains why. The job and session API is documented at /api/sandboxes/openapi.json on your workspace. For app-specific permissions and calling instructions, use smolcloud capabilities APP_ID and smolcloud guide APP_ID. Sandbox permissions.