Skip to main content

Spin Up a Workspace

Why it’s nice:
  • Omit --name to auto-generate a slug.
  • Pass --team-id if you need to charge a different workspace.
  • Add --yes to skip the confirmation prompt in automation.

Idle Timeout

--timeout-minutes caps the total lifetime. For VM sandboxes, set it to any negative value to remove the lifetime deadline. --idle-timeout-minutes terminates the sandbox sooner when nothing is using it, which is useful for agent workflows that might forget to clean up.
The sandbox shuts itself down if no exec, upload, download, or file-read request lands within the idle window. Each new request resets the clock; long-running execs stay pinned for their full duration.
  • Disabled by default. Set --idle-timeout-minutes to opt in.
  • Must be between 1 and 1,440 minutes. For a finite lifetime, it must not exceed --timeout-minutes.
  • SSH sessions do not count as activity.
When the sandbox terminates this way, its termination reason in prime sandbox get and on the dashboard reads Idle Timeout.

Environment Variables & Secrets

Use --env for general configuration and --secret for sensitive values. Both accept KEY=VALUE format and can be specified multiple times.
Environment variables are stored in plain text and visible when you inspect the sandbox. Secrets are encrypted at rest and obfuscated in CLI output. Use them for API keys, passwords, database credentials, and anything else you wouldn’t want to appear in logs. Both are injected into the sandbox and accessible as standard environment variables at runtime.

Start Command

Pass a start command after -- to run your own process when the sandbox boots. There is no shell, so every argument must be its own token:
To get shell features (pipes, variables, &&), invoke a shell explicitly:
The start command is one-shot: when the process exits, the sandbox stops. Omit it to keep the sandbox up and ready for prime sandbox run.

Network Isolation

Sandboxes can restrict outbound traffic at creation time. Use an allowlist or a denylist — the two are mutually exclusive.
Both flags are repeatable and accept domains (example.com, *.example.com) or IPv4 addresses/CIDRs; IPv6 is not supported. Update the rules on a running sandbox with prime sandbox network. Each call replaces the whole list, and each flag takes a single comma-separated value:
Rules can be saved but not yet active on the running sandbox. The CLI keeps retrying until they apply; check the current state with prime sandbox network <sandbox-id>.

Custom Docker Images

You can build and push custom Docker images to use in sandboxes. See the Prime Images guide for details.

Check In on Sandboxes

prime sandbox run accepts --timeout <seconds> for the command itself, -w/--working-dir, and repeatable -e/--env KEY=VALUE overrides.

Organize with Labels

Labels help you tag and manage groups of sandboxes:
Labels are useful for:
  • Grouping related experiments or workflows
  • Tracking which team or project owns a sandbox
  • Bulk cleanup by category (dev, staging, test, etc.)

Move Files Around

Note: File uploads are limited to 16 MiB per file. If a transfer complains about auth, run prime sandbox reset-cache and retry—the CLI refreshes the gateway token for you.

SSH

Connect to a running sandbox with an interactive shell:
The CLI generates an ephemeral key pair, creates a session, and connects automatically. The session is revoked and the key deleted on disconnect. OpenSSH (ssh) must be installed locally, and the sandbox must be RUNNING. By default you get a /bin/sh login shell, running as the sandbox’s default user in its working directory. To use a different shell installed in the image:
Anything after -- is passed straight to ssh, so you can run a single command instead of opening a shell:
Only interactive shells and remote commands are supported: port forwarding (-L/-R), agent forwarding, scp, and sftp are not. Use prime sandbox upload / download to move files. SSH sessions do not count as activity for the idle timeout, so a sandbox with an open SSH connection can still be shut down if you set --idle-timeout-minutes.

Clean Up in Bulk

You must use exactly one of: sandbox IDs, --label, or --all. --all and --label deletes run as a single server-side scoped delete: by default they cover your own sandboxes, --all-users covers the whole team, and --user <user-id> covers one teammate (both admin-only). The CLI prints a count preview before deleting, and per-sandbox results for explicit IDs. Need more ideas? Check the runnable scripts in prime/examples/ for CLI walkthroughs you can customize.

Quick Troubleshooting

  • Sandbox stuck in PROVISIONING? Wait a minute, then rerun prime sandbox list --status RUNNING. If it stays pending, delete and recreate from a known-good image.
  • Hitting auth issues? prime sandbox reset-cache refreshes the gateway token after you rotate API keys.