sandbox.exec.
await sandbox.exec.run(command, ...)
Run a command synchronously via sh -c. HTTP API →
str
required
Shell command
int
default:"60"
Timeout in seconds
dict[str, str]
Environment variables
str
Working directory
ProcessResult
await sandbox.exec.start(command, ...)
Start a long-running command with streaming I/O. HTTP API →
str
required
Command
list[str]
Arguments
dict[str, str]
Environment variables
str
Working directory
int
Timeout in seconds
int
Seconds to keep running after disconnect
Callable[[bytes], None]
Stdout callback
Callable[[bytes], None]
Stderr callback
Callable[[int], None]
Exit callback
ExecSession
await sandbox.exec.background(command, ...)
Alias for start. Same signature, same return type. Use when the intent is “run this in the background and observe it”.
await sandbox.exec.shell(...)
Open a stateful shell session. Subsequent .run() calls share the same bash process, so cwd, exported env vars, and shell functions persist — the ergonomics of a terminal tab.
Backed by a long-running bash --noprofile --norc session. Foreground-only: concurrent .run() raises ShellBusyError.
str
Initial working directory
dict[str, str]
Initial environment variables
Shell
Shell
Per-call
cwd, env, and timeout are intentionally not supported in v1. Use inline shell syntax (cd /x && cmd, FOO=bar cmd) — the shell state carries across calls.ShellBusyError— anotherrun()is in flight (shell is foreground-only).ShellClosedError— bash has exited (explicitclose(), a command ranexit, or the session dropped).
await sandbox.exec.attach(session_id, ...)
Reconnect to a running exec session over WebSocket.
str
required
Session ID
Callable[[bytes], None]
Stdout callback
Callable[[bytes], None]
Stderr callback
Callable[[int], None]
Exit callback
Callable[[], None]
Scrollback replay done
ExecSession
await sandbox.exec.list()
List all exec sessions. HTTP API →
Returns: list[ExecSessionInfo]
await sandbox.exec.kill(session_id, signal=9)
Kill an exec session. HTTP API →
Returns: None
ExecSession
Types
ProcessResult
ProcessResult
ExecSessionInfo
ExecSessionInfo