cwsandbox command-line interface (CLI) manages existing CoreWeave sandboxes from your terminal. Use it to inspect sandboxes, run commands, retrieve logs, transfer files, manage file system snapshots, and clean up resources. Install the CLI as an optional extra of the Sandboxes Python client.
Create sandboxes with the SDK before using the CLI. Follow the serverless quickstart or Use your own compute to create one.
Prerequisites
Before you begin, prepare the following:- An active Python 3.11 or later virtual environment with
uvinstalled. - A credential for the account that owns your sandboxes. See Choose and get credentials for credential setup and required roles.
- A running sandbox for command execution, interactive shells, log retrieval, file operations, and snapshot creation.
Install and authenticate
Choose the credential you used to create your sandboxes. Run the commands from one tab in your active virtual environment, replacing the credential placeholder with your key or token:- Forge API key
- CoreWeave API access token
Install the
cli and wandb extras, then select the W&B authentication strategy for your Forge API key:CWSANDBOX_AUTH selects the credential strategy. The top-level --auth option overrides it for one invocation. For example, with Forge dependencies and credentials configured:
--help:
Find your sandboxes
List sandboxes visible to your credential:TAG with a tag attached to your sandboxes:
--output json returns structured output. Repeat --tag or --runner-id to supply multiple filter values.
Inspect a sandbox
ReplaceSANDBOX_ID_VALUE with an ID from cwsandbox ls, and set it in your terminal:
Run commands
Execute a command in a running sandbox. The command must be available in the sandbox image:--cwd before the remote command. Replace REMOTE_DIRECTORY with an existing directory in the sandbox:
Open an interactive shell
From a local terminal on macOS or Linux, open an interactive shell:/bin/bash. Use --cmd to choose a different shell or an interactive program installed in the sandbox:
exit or press Ctrl+D. Ctrl+C is forwarded to the remote process.
View logs
Retrieve logs from the sandbox’s main process:--follow to stream new log output. Press Ctrl+C to stop following:
--since to filter logs by a timestamp. Replace 2026-09-10 09:00:00 with the start time you want. The CLI interprets a timestamp without a timezone as UTC:
cwsandbox exec. Sandboxes created with the default keep-alive command produce no log output.
Log retrieval requires a running sandbox. Retrieve logs before stopping the sandbox. For more information, see Sandbox logging.
Read and write files
File operations require a running sandbox. To print a remote file to standard output, replaceREMOTE_PATH with its path inside the sandbox:
--output with a local destination. Replace LOCAL_PATH with the path where you want to save it:
Manage file system snapshots
Snapshot creation requires a running sandbox configured with a file system snapshot mount. Your organization must be enabled for file system snapshots. Create a snapshot:SNAPSHOT_ID_VALUE with its ID:
Stop or delete a sandbox
Stop a sandbox when you finish using it:--missing-ok so an already missing sandbox doesn’t cause an error: