sandbox.commands to execute shell commands in your sandbox. Commands can run in the foreground (blocking) or background (non-blocking), with real-time streaming of stdout and stderr.
Quick Reference
| Operation | Method |
|---|---|
| Run command | sandbox.commands.run(cmd) |
| Background command | sandbox.commands.run(cmd, background=True) |
| List processes | sandbox.commands.list() |
| Kill process | sandbox.commands.kill(pid) |
| Send stdin | sandbox.commands.send_stdin(pid, data) |
| Interactive PTY | sandbox.pty.create() |
Basic Usage
Command Result
TheCommandResult object contains:
| Property | Type | Description |
|---|---|---|
stdout | string | Standard output |
stderr | string | Standard error |
exit_code / exitCode | number | Exit code (0 = success) |
error | string? | Error message if command failed to execute |