rwx sandbox exec

Execute a command in a persistent cloud sandbox environment.

Usage

rwx sandbox exec [config-file] -- <command> [flags]

Description

Sandboxes are isolated, reproducible environments running in RWX cloud infrastructure. They persist between commands, allowing you to run multiple commands against the same environment without rebuilding each time.

When you run rwx sandbox exec, if you don't already have a sandbox running for your current working directory + branch + config file, a new one will start. You can also pre-start a sandbox using rwx sandbox start to give it time to set up your environment before you need it. Most of the time, lazily starting a sandbox when executing a command is plenty fast, thanks to RWX's content-based caching.

File Syncing

Before each command, local changes are automatically synced to the sandbox, and after the command completes, the sandbox's changes are synced back to your local machine. This includes locally-committed changes, staged changes, unstaged changes, and untracked files. Use --no-sync to skip this step if you want to run against the sandbox's original state.

Note: Git LFS files cannot be synced and will generate a warning.

Config File

The sandbox configuration (default: .rwx/sandbox.yml) defines:

  • Base image and dependencies
  • Git repository to clone
  • Any setup tasks that run before the sandbox becomes available

The config must include a task with run: rwx-sandbox which defines the sandbox entry point, and must be dependent on a task that uses git/clone with preserve-git-dir: true.

To generate a sandbox configuration file, you can use rwx sandbox init and then customize it to meet your repository's environment setup needs. The best practice is to commit this sandbox.yml file to your repo, to re-use that environment setup across your team.

Arguments

[config-file]

The path to the sandbox configuration file. Defaults to .rwx/sandbox.yml.

<command>

(required) The command to execute in the sandbox. Must be preceded by --.

Options

-d, --dir <directory>

The directory your RWX configuration files are located in, typically .rwx. By default, the CLI traverses up until it finds a .rwx directory.

--id <run-id>

Use a specific run ID to target an existing sandbox session.

--no-sync

Skip syncing local changes before execution. Use this when you want to run against the sandbox's original state without your local modifications.

--open

Open the run in a browser after starting.

Global Options

--output <format>

Output format: text or json. Defaults to text.

--access-token <token>

The access token for RWX. Defaults to the value of the $RWX_ACCESS_TOKEN environment variable.