sandbox.commands runs commands inside a live sandbox. AsyncSandbox.commands
provides the async equivalent.
Command Execution
| Method | Use |
|---|---|
run(command, args=None, shell=False, cwd=None, envs=None, timeout=None, background=False, on_stdout=None, on_stderr=None) | Run a command, optionally stream output, or start it in the background. |
stream(...) | Stream command output from a long-running foreground execution. |
shell=True for authored shell strings. Use args=[...] when exact
argument boundaries matter.
Background Processes
| Method | Use |
|---|---|
run(..., background=True) | Start a long-running command and return a process handle. |
list() | List running commands and PTY sessions. |
send_stdin(pid, data) | Send input to a process. |
logs(pid) | Fetch stdout, stderr, and interleaved output. |
kill(pid) | Stop a process by PID. |