Accessed viaDocumentation Index
Fetch the complete documentation index at: https://docs.opencomputer.dev/llms.txt
Use this file to discover all available pages before exploring further.
sandbox.exec.
await sandbox.exec.run(command, ...)
Run a command synchronously via sh -c. HTTP API →
Shell command
Timeout in seconds
Environment variables
Working directory
ProcessResult
await sandbox.exec.start(command, ...)
Start a long-running command with streaming I/O. HTTP API →
Command
Arguments
Environment variables
Working directory
Timeout in seconds
Seconds to keep running after disconnect
Stdout callback
Stderr callback
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.
Initial working directory
Initial environment variables
Shell
Shell
| Member | Type | Description |
|---|---|---|
session_id | str | Underlying exec session ID |
run(cmd, on_stdout=?, on_stderr=?) | ProcessResult | Run a command, blocking until it exits |
close() | None | Write exit and wait for bash to terminate |
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.
Session ID
Stdout callback
Stderr callback
Exit callback
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
| Member | Type | Description |
|---|---|---|
session_id | str | Session ID |
done | asyncio.Future[int] | Resolves with exit code |
send_stdin(data) | coroutine | Send input (str or bytes) |
kill(signal=9) | coroutine | Kill process |
close() | coroutine | Detach WebSocket (process keeps running) |
Types
ProcessResult
ProcessResult
ExecSessionInfo
ExecSessionInfo