Skip to main content
The LangSmith CLI includes sandbox commands for creating snapshots, booting sandboxes, running commands, opening interactive shells, and tunneling TCP connections into a sandbox. Sandbox CLI commands require LangSmith CLI v0.2.26 or later.

Install and authenticate

Install or upgrade the LangSmith CLI:
Authenticate the CLI with your LangSmith API key:
CLI output is JSON by default. Add --format pretty to list commands for human-readable tables:

End-to-end workflow

Create a sandbox, then run commands inside it:
When you are done with a sandbox, delete it:

Manage snapshots

Build snapshots from Docker images:
For private images, create a registry first (see Private registries), then pass its id with --registry-id:
Capture the filesystem from a running sandbox:
List, inspect, wait for, and delete snapshots:

Manage sandboxes

Create a sandbox with the default runtime. Add --snapshot-id only when you want to boot from a reusable custom snapshot:
List and inspect sandboxes:
Stop and start a sandbox while preserving its filesystem:
Update resources or proxy configuration:
Resource changes take effect the next time the sandbox starts. Proxy configuration changes take effect immediately.

Proxy configuration

Use --proxy-config @proxy.json on create or update to configure the sandbox auth proxy. Prefer workspace secrets for credential injection instead of placing raw secrets in local files.
For more on proxy rules, see Sandbox auth proxy.

Run commands

Use sandbox exec for one-off commands:
Everything after -- is sent to the sandbox as the command. The CLI prints stdout to stdout, stderr to stderr, and exits with the sandbox command’s exit code.

Open an interactive console

Use sandbox console for a PTY-backed interactive shell:
You can forward your local SSH agent into the console session:
--forward-ssh-agent requires SSH_AUTH_SOCK to be set locally. Interactive console sessions are not supported on Windows; use SSH access instead.

Tunnel TCP ports

Use sandbox tunnel when you need a local TCP port that forwards to a service listening inside the sandbox. This is useful for databases, language servers, custom protocols, or local tools that expect localhost. Start a service in the sandbox, then tunnel to it:
Then connect locally:
If you omit --local-port, the CLI uses the same value as --remote-port:
The tunnel process stays in the foreground. Stop it with Ctrl+C. You can also tunnel by sandbox URL instead of name:
For HTTP applications you want to open in a browser or share with teammates, use Sandbox service URLs. Use tunnels for raw TCP protocols or local development tools.

Set up SSH access

Use sandbox ssh-setup to configure standard SSH tools such as ssh, scp, rsync, and sftp through a sandbox tunnel.
The command uploads your SSH public key to the sandbox, fetches the sandbox host key when available, writes a Host sandbox-<name> block to ~/.ssh/config, and writes sandbox host keys to ~/.ssh/known_hosts_sandboxes. After setup, connect with:
The sandbox image must run sshd on port 22. If sshd is not running, ssh-setup warns and the SSH connection will not work until you start it inside the sandbox.
ssh-setup modifies local SSH configuration and writes a ProxyCommand that calls langsmith sandbox tunnel. Depending on how the CLI is authenticated, the generated block may contain credentials or references to credentials. Run it only on trusted machines and do not commit or share the generated SSH config block.

Command reference