# Sandbox environments A sandbox is a private Linux machine for running code or using a terminal, without deploying an app. You create a sandbox once; it holds the name, template and settings. Each time you use it you start a **session**, which is the running machine, and stop it when you finish. ## Create a sandbox - **In the workspace:** **Services → New → Sandbox**, then choose a name and a template. - **From the CLI:** `smolcloud sandbox new [NAME]` creates a sandbox on the default template and starts a session in it. ```sh smolcloud sandbox new research smolcloud sandbox exec ENV_ID SESSION_ID -- python3 --version smolcloud sandbox stop ENV_ID SESSION_ID ``` Owners, admins, builders and connected agents can all create sandboxes. ## Who can do what | Action | Who | | -------------------------------------- | ------------------------------------ | | Create a sandbox | Owner, admin, builder, agent | | Use, rename or delete it | Its creator, or the owner | | Let other people or agents use it | Owner, in the sandbox's **Settings** | | Change its template, limits or network | Owner | A new sandbox has **network access blocked**, allows one session at a time, and requests a pause near the five-minute session deadline. The owner changes these in **Settings**. Saving new settings stops running sessions and makes their snapshots unusable. ## Choose internet access In **Settings**, the owner can keep access blocked, approve exact public hosts (the npm/PyPI choice is a preset), or select **General web**. General web allows public HTTP and HTTPS sites on ports 80 and 443. It does not restrict where an agent can send your data. Private networks, loopback, link-local/metadata and worker management addresses remain blocked; raw TCP and public inbound access are not enabled. Database and bucket access still require explicit grants. General web is disabled until the operator has qualified and registered an updated worker. Changing network policy stops existing sessions; start a new session under the saved policy. ## Use the API The CLI covers everyday use. To call the API yourself, send your CLI credential as a Bearer token, with the header `x-innie-workspace: WORKSPACE_ID`. An app's own tokens don't work on these addresses. In the API a sandbox is called a sandbox environment. | Step | Request | | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | | See templates and limits | `GET /api/sandbox-environments/options` | | Create | `POST /api/sandbox-environments` with `{"name":"Research agents"}`. Optional: `templateIdentity`, `projectId`. Returns `{id}`. | | List | `GET /api/sandbox-environments` | | Start a session | `POST /api/sandbox-environments/{id}/sandbox-sessions` with `{"version":1,"idempotencyKey":"UUID","lifetimeSeconds":300}` | | Wait until ready | `GET .../sandbox-sessions/{sessionId}` until `ready` is `true` | | Stop | `POST .../sandbox-sessions/{sessionId}/kill` with `{"version":1}` | | Rename or move | `PATCH /api/sandbox-environments/{id}` with `name`, `projectId`, `expectedVersion` | | Delete | `POST /api/sandbox-environments/{id}/delete` with `expectedVersion` | Running commands, reading and writing files, pausing, snapshots and forks all work as described in [interactive sessions](sandbox-sessions.md), with `/api/sandbox-environments/{id}` in place of `/api/apps/{appId}`. For one-off commands, use `.../{id}/sandbox-jobs`; see the [jobs API](sandbox-api.md). Full schemas are available from `GET /api/sandboxes/openapi.json` on your workspace, where `appId` stands for the sandbox ID on these addresses. ## Limits - 50 sandboxes per workspace. - All sessions share the workspace's sandbox CPU, memory and disk allowance. - A standalone shell starts without an app’s AI access or bucket access. Use an [app-backed agent job](sandbox-agent.md) for gateway-managed model calls. For files, request a [temporary bucket grant](sandbox-resources.md) or copy results out with `smolcloud sandbox read`. - Deleting a sandbox stops its sessions and deletes its snapshots.