Skip to main content
POST
Run Command (Stream)
Executes a command inside the sandbox and streams its output to the client in real-time using Server-Sent Events (SSE). The response has Content-Type: text/event-stream. Use this endpoint when you want to display output incrementally as the command runs, rather than waiting for it to complete.

Path Parameters

string
required
The sandbox identifier. Format: sbx-<8 chars>.

Request Body

string
required
The shell command to execute.Example: "for i in 1 2 3; do echo $i; sleep 0.5; done"
string
Working directory for the command.
object
Additional environment variables scoped to this command.
number
Per-command timeout in seconds.
string
Unix user to run the command as.

Response

The response has Content-Type: text/event-stream. Each SSE event carries a JSON payload. The stream terminates when the command exits.

SSE Event Format

The stream proxies SSE events directly from the envd daemon inside the VM, so the exact event format may include additional fields.

Example

Error Responses