Stream stdout and stderr
sandbox.commands.run(...) without background=True uses
the same streaming path:
Connect to a running process
connect(pid) for background processes that are still running. It attaches
to the exec WebSocket and waits for the process exit event when possible.
Live background streaming
background=True with callbacks starts the command through the exec
WebSocket and returns a BackgroundCommand after an exec_started message. The
CLI equivalent is nullspace sandbox process stream with --cwd, --env, and
--timeout flags.
Behavior
Streaming usesGET /v1/sandboxes/{id}/ws?channel=exec. SDK callers send
exec_start for new commands or exec_connect for existing PIDs and then read
exec_started, exec_stdout, exec_stderr, exec_exit, and error messages.
Use the REST get_logs endpoint when you only need logs after the process has
started.