Skip to main content
Run any shell command inside a sandbox using sandbox.commands.run().
This page covers run(). If you need to send input to a process while it runs, like a REPL, spawn() keeps the session open instead.
Using AsyncSandbox? The same methods are there, awaitable. See the Sandbox reference.

Handling exit codes

run() doesn’t throw on a non-zero exit code. Check exitCode on the result yourself.

Working directory and environment

Pass cwd and env to control the execution context.
Watch the units: TypeScript takes timeoutMs (milliseconds), Python takes timeout_seconds (seconds).

Timeouts

Pass a timeout to kill a command that runs longer than you expect.
For longer commands, stream the output as it runs. To send input to a process while it runs, open a session.