Use the Sandbox CLI to run coding agents, manage sandboxes, execute commands, and copy files from your terminal.
Use the CLI for manual testing and debugging, or use the JS SDK or Python SDK to automate sandbox workflows in your application.
Sandboxes are identified by name (unique within your project) and are persistent by default: when stopped, the filesystem is snapshotted and restored on the next resume. Use sandbox remove to delete a sandbox permanently.
The CLI uses your saved Edgenivo credentials. If you aren't signed in, it starts
the login flow when you run a command that requires authentication. Follow the
verification link, or press Enter to open it in your browser.
# List all running sandboxessandbox list# List all sandboxes (including stopped ones)sandbox list--all# List sandboxes for a specific projectsandbox list--projectmy-nextjs-app# Filter by name prefix and sortsandbox list--name-prefixci---sort-byname--sort-orderasc# Filter by tagsandbox list--tagenv=staging--limit100# Page through results using the cursor reported by the previous pagesandbox list--cursor<token>
With Sandbox CLI 4.8.0 or later, use sandbox create <agent> in an interactive
terminal to start a coding agent in a new sandbox:
Terminal
sandbox createopencode
If you haven't installed the CLI globally, use npx sandbox@latest create opencode.
The sbx alias also works with a global installation, for example sbx create pi.
Agent
Command
OpenCode
sandbox create opencode
Pi
sandbox create pi
Claude Code
sandbox create claude
Codex
sandbox create codex
The agent runs inside the sandbox, with its interactive interface in your local
terminal. Its commands and file edits run remotely. Your local project files
aren't uploaded automatically. Clone your repository inside the sandbox with
appropriate credentials, or use sandbox copy to copy files.
Edgenivo login authenticates Sandbox access. Configure your chosen agent's
credentials separately using its authentication flow or the --env option.
The CLI tries to determine your team and project; set --scope and --project
explicitly when needed:
The CLI selects the universal image
with the agents preinstalled. Omit --image, --runtime, and --snapshot when
using an agent shortcut.
Exiting the agent leaves the sandbox running. Unless you pass --silent, the
CLI prints commands to reconnect to the agent or stop the sandbox. Use the
printed reconnect command to continue your conversation; running
sandbox create <agent> again creates another sandbox. Before reconnecting,
follow any reminder to export environment variables.
Stop the sandbox when you're finished. Normal
Sandbox persistence settings apply.
# Create a basic Node.js sandboxsandbox create# Create a sandbox with an explicit namesandbox create--namemy-sandbox# Create a sandbox on a Secure Compute networksandbox create--namemy-sandbox--network-id3k9x7m2p5q8w1z4n# Create a sandbox with 1 vCPU and open an interactive shellsandbox create--vcpus1--connect# Create a Python sandbox with custom timeoutsandbox create--imagevercel/sandbox/python--timeout1h# Create sandbox with port forwardingsandbox create--publish-port8080--projectmy-project# Create sandbox silently (no output)sandbox create--silent# Create sandbox from a snapshotsandbox create--snapshotsnap_abc123# Create a sandbox in a specific region, with failover regionssandbox create--regionsfo1--failover-regionsiad1,cle1# Create a non-persistent (ephemeral) sandboxsandbox create--nameci-job--non-persistent# Tag a sandbox at creation timesandbox create--namemy-sandbox--tagenv=staging--tagteam=infra# Set snapshot expiration and retentionsandbox create--namemy-sandbox--snapshot-expiration7d--keep-last-snapshots1# Create sandbox without Internet accesssandbox create--network-policydeny-all# Create sandbox with restricted Internet access (limited to Edgenivo's AI gateway)sandbox create--allowed-domainai-gateway.edgenivo.com# Mount a drive with read-write accesssandbox create--mountcache:/data# Mount a point-in-time, read-only snapshot of a drivesandbox create--mountcache:/data:snapshot
Comma-separated regions the sandbox can fail over to (e.g. sfo1,cle1). Must not include the main region. Available on Pro and Enterprise plans, excluding Pro trials.
--snapshot-expiration <duration>
-
Default snapshot TTL. Defaults to 30d. Use none or 0 for no expiration.
--keep-last-snapshots <count>
-
Retention policy: keep only the N (1–10) most recent snapshots of this sandbox.
--keep-last-snapshots-for <dur>
-
Expiration applied to kept snapshots. Use none or 0 for no expiration.
--delete-evicted-snapshots <bool>
-
true (default) deletes evicted snapshots immediately; false keeps them until their existing expiration. See Snapshot retention.
--network-policy <mode>
-
Base network mode to start the sandbox with ('allow-all' - default or 'deny-all'). Leave unset if using more specific rules.
A persistent sandbox snapshots its filesystem every time a session stops, so its snapshots accumulate over time. Use --keep-last-snapshots to keep only the N most recent. When a new snapshot brings the total above the limit, the oldest snapshots are no longer kept. The --delete-evicted-snapshots flag controls what happens to them: delete them immediately, or leave them to expire on their own.
--keep-last-snapshots <count>: keep only the N most recent snapshots. count must be an integer from 1 to 10. This flag enables the retention policy, and the two flags below require it.
--keep-last-snapshots-for <duration>: the expiration applied to the snapshots you keep, for example 7d or 30d. Use none or 0 for no expiration. When omitted, kept snapshots fall back to the sandbox's default snapshot expiration (--snapshot-expiration).
--delete-evicted-snapshots <true|false>: what happens to a snapshot once it is no longer among the most recent kept ones. true (the default) deletes it immediately; false keeps it until its existing expiration instead.
Fork an existing sandbox into a new one. The fork is seeded from the source sandbox's current snapshot and inherits its config. Any option you pass overrides the copied value. If the source has no current snapshot, the fork falls back to creating a fresh sandbox with the source's image plus the copied config.
env is not copied (encrypted server-side); pass --env to set environment variables on the fork. Tags passed via --tag fully replace the source's tags (no per-key merge).
The fork runs in the source sandbox's region unless you pass --region. The fork also inherits the source's failover regions. Pass --failover-regions to replace them. If the source has a snapshot, that snapshot must be available in the target region.
# Fork with every supported field copied from the sourcesandbox forkmy-source# Override the name and bump vCPUs; env vars must be re-suppliedsandbox forkmy-source--namemy-forked-sandbox--vcpus4--envFOO=1
Name for the forked sandbox. Must be unique per project. Generated if omitted.
--timeout <duration>
-
Override the session timeout inherited from the source.
--vcpus <count>
-
Override the vCPU count. Each vCPU includes 2048 MB of memory.
--publish-port <port>
-p
Publish a port. Repeatable. Replaces the inherited port list if provided.
--env <key=value>
-e
Environment variables for the fork. Not copied from the source. Repeatable.
--tag <key=value>
-t
Tag the fork. Repeatable. When provided, fully replaces the tags copied from the source.
--region <region>
-
Override the region copied from the source. If the source has a snapshot, it must be available in this region.
--failover-regions <region,...>
-
Comma-separated regions the fork can fail over to (e.g. sfo1,cle1). Must not include the main region. Available on Pro and Enterprise plans, excluding Pro trials.
View and update sandbox configuration. Each subcommand updates one parameter; all parameters are also available together through the SDK's sandbox.update().
# Inspect the current configuration of a sandboxsandbox configlistmy-sandbox# Attach a Secure Compute network, or remove it from the next sessionsandbox confignetwork-idmy-sandbox3k9x7m2p5q8w1z4nsandbox confignetwork-idmy-sandboxnone# Update vCPUs and timeoutsandbox configvcpusmy-sandbox4sandbox configtimeoutmy-sandbox30m# Toggle persistencesandbox configpersistentmy-sandboxfalse# Update the failover regionssandbox configfailover-regionsmy-sandboxiad1,cle1sandbox configfailover-regionsmy-sandboxnone# Update snapshot retentionsandbox configsnapshot-expirationmy-sandbox14dsandbox configkeep-last-snapshotsmy-sandbox1# Replace the exposed port listsandbox configportsmy-sandbox-p3000-p8000# Clear all exposed portssandbox configportsmy-sandbox# Replace the mounted drives for new sessionssandbox configmountsmy-sandbox--mountcache:/data--mountshared:/shared:snapshot# Remove all drive mounts from new sessionssandbox configmountsmy-sandbox# Replace the tag setsandbox configtagsmy-sandbox--tagenv=production--tagteam=infra# Roll back to a previous snapshotsandbox configcurrent-snapshotmy-sandboxsnap_abc123# Update the sandbox firewall to deny all egress trafficsandbox confignetwork-policymy-sandbox--network-policydeny-all# Update the sandbox firewall to allow all egress trafficsandbox confignetwork-policymy-sandbox--modeallow-all# Update the sandbox firewall to specific rulessandbox confignetwork-policymy-sandbox--allowed-domainedgenivo.com--allowed-domainai-gateway.edgenivo.com
Copy a file between your local filesystem and a remote sandbox. The command transfers one file per invocation, and the destination is the full target path, not a directory.
# Copy file from local to sandboxsandbox copy./local-file.txtmy-sandbox:/app/remote-file.txt# Copy file from sandbox to localsandbox copymy-sandbox:/app/output.log./output.log
# Execute a simple command in a sandboxsandbox execmy-sandbox--ls-la# Run with environment variablessandbox exec--envDEBUG=truemy-sandbox--npmtest# Execute interactively with sudosandbox exec--interactive--sudomy-sandbox--sh# Run command in specific working directorysandbox exec--workdir/appmy-sandbox--pythonscript.py# Kill the command if it runs longer than 30 secondssandbox exec--timeout30smy-sandbox--npmtest# Stop the current session after the command exitssandbox exec--stopmy-sandbox--npmbuild
# Connect to an existing sandboxsandbox connectmy-sandbox# Connect with a specific working directorysandbox connect--workdir/appmy-sandbox# Connect with environment variables and sudosandbox connect--envDEBUG=true--sudomy-sandbox
Stop the current session of one or more sandboxes. For persistent sandboxes (the default), the filesystem is snapshotted first so the sandbox can be resumed later with the same name. To delete a sandbox permanently, use sandbox remove.
# Stop a single sandboxsandbox stopmy-sandbox# Stop multiple sandboxessandbox stopmy-sandboxanother-sandbox# Stop sandbox for a specific projectsandbox stop--projectmy-projectmy-sandbox
Add time to the current running session of a sandbox without changing its default timeout. The sandbox must have a running session. To change the timeout for future sessions, use sandbox config timeout.
Permanently delete one or more sandboxes, along with all of their sessions. Once removed, a sandbox cannot be recovered. Use this instead of sandbox stop when you no longer need the sandbox at all.
Removing a sandbox keeps its snapshots by default, because several sandboxes can start from the same snapshot. Pass --delete-orphan-snapshots to also delete the sandbox's snapshots that no other sandbox uses, or delete them separately with sandbox snapshots delete.
# Delete a single sandboxsandbox removemy-sandbox# Delete multiple sandboxessandbox removemy-sandboxanother-sandbox# Delete a sandbox and its snapshots that no other sandbox usessandbox removemy-sandbox--delete-orphan-snapshots
Create (or resume) a sandbox and run a command in it. When --name matches an existing sandbox, the sandbox is resumed and any create-only flags are ignored.
# Run a simple Node.js script in a fresh sandboxsandbox run--node--version# Run with custom environment and timeoutsandbox run--envNODE_ENV=production--timeout10m--npmstart# Run interactively with port forwardingsandbox run--interactive--publish-port3000--tty--npmrundev# Resume an existing sandbox if it exists; otherwise create itsandbox run--namemy-sandbox--npmtest# Stop the current session when the command exitssandbox run--namemy-sandbox--stop--npmbuild# Permanently delete the sandbox after the command exitssandbox run--rm--python3script.py# Run a command with a drive mounted for read-write accesssandbox run--mountcache:/data--npmbuild# Run a command with a point-in-time, read-only snapshot of a drivesandbox run--mountcache:/data:snapshot--ls/data
# Create a snapshot of a running sandboxsandbox snapshotmy-sandbox--stop# Create a snapshot that expires 14 days after its last usesandbox snapshotmy-sandbox--stop--expiration14d# Create a snapshot that never expiressandbox snapshotmy-sandbox--stop--expiration0
# List snapshots for the current projectsandbox snapshotslist# List snapshots for a specific projectsandbox snapshotslist--projectmy-project# Filter snapshots by sandbox namesandbox snapshotslist--namemy-sandbox# Page through resultssandbox snapshotslist--limit50--cursor<token>
# Get details of a specific snapshotsandbox snapshotsgetsnap_1234567890# Get snapshot details for a specific projectsandbox snapshotsget--projectmy-projectsnap_1234567890
# Delete a single snapshotsandbox snapshotsdeletesnap_1234567890# Delete multiple snapshots for a specific projectsandbox snapshotsdelete--projectmy-projectsnap_1234567890snap_0987654321
Walk the snapshot ancestry tree starting from a sandbox's current snapshot. Snapshots form a parent → child tree whenever you create a sandbox from another snapshot.
# Walk ancestors of the sandbox's current snapshot (default)sandbox snapshotstreemy-sandbox# Walk descendantssandbox snapshotstreemy-sandbox--sort-orderasc# Continue from a specific snapshotsandbox snapshotstreemy-sandbox--cursorsnap_abc123
Inspect VM sessions for a sandbox. A session represents one running VM instance of a sandbox; persistent sandboxes can have many sessions over time, separated by snapshots.
# List running sessionssandbox sessionslistmy-sandbox# List all sessions (including stopped ones)sandbox sessionslistmy-sandbox--all# Sort and paginatesandbox sessionslistmy-sandbox--sort-orderasc--limit100
# List drivessandbox driveslist# Filter drives by name and sort ascendingsandbox driveslist--name-prefixcache---sort-orderasc# Page through results using the cursor reported by the previous pagesandbox driveslist--limit100--cursor<token>
# Create or retrieve a drive with the default size of 1 TiBsandbox drivesget-or-createcache# Create or retrieve a drive with a maximum size of 10 GiBsandbox drivesget-or-createcache--max-size10737418240# Create or retrieve a drive stored in the sfo1 regionsandbox drivesget-or-createcache--regionsfo1
Create a new drive from an existing drive's data. The fork belongs to the same project and inherits the source drive's region and maximum size. You can mount and update the fork independently of the source drive.
A drive must be mounted read-write and written to at least once before you can create a fork from it. Creating a fork of a drive that has never been written to fails with a drive_not_initialized error.
Use the source drive name and a new unique name for the fork:
For interactive work, create a named sandbox that stays running:
sandbox create--namemy-sandbox--timeout30m
sandbox create prints the sandbox's name. Use that name to interact with the sandbox. Because persistent sandboxes can be resumed, you can also reconnect later by running sandbox exec my-sandbox -- ... or sandbox connect my-sandbox.
# Copy your code to the sandboxsandbox copy./my-app.jsmy-sandbox:/home/sandbox/my-app.js# Run itsandbox execmy-sandbox--node/home/sandbox/my-app.js# Copy results backsandbox copymy-sandbox:/home/sandbox/output.json./results.json
# Create a named sandboxNAME=$(sandbox create--name "ai-test-$(date +%s)" --timeout15m--silent)# Copy AI-generated codesandbox copy./ai-generated.js $NAME:/app/# Test it interactivelysandbox exec--interactive--tty $NAME --bash# Now inside: cd /app && node ai-generated.js# Clean up (remove permanently)sandbox remove $NAME
# Create a named sandbox with more timesandbox create--namedebug-build--timeout1h# Copy your projectsandbox copy./my-project/debug-build:/app/# Try buildingsandbox exec--workdir/appdebug-build--npmrunbuild# If it fails, debug interactivelysandbox exec-itdebug-build--bash
# Create with port exposuresandbox create--namedev--timeout30m--publish-port3000# Start your dev serversandbox exec--workdir/appdev--npmrundev# Access at the provided URL (printed by `sandbox create`)# Visit: https://<random-id>.vercel.run