Run Command (Stream)
Command API
Run Command (Stream)
Execute a command and stream stdout/stderr in real-time via Server-Sent Events.
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
The stream proxies SSE events directly from the envd daemon inside the VM, so the
exact event format may include additional fields.
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
The sandbox identifier. Format:
sbx-<8 chars>.Request Body
The shell command to execute.Example:
"for i in 1 2 3; do echo $i; sleep 0.5; done"Working directory for the command.
Additional environment variables scoped to this command.
Per-command timeout in seconds.
Unix user to run the command as.
Response
The response hasContent-Type: text/event-stream. Each SSE event carries a JSON
payload. The stream terminates when the command exits.
SSE Event Format
Example
Error Responses
| Status | Cause |
|---|---|
400 | Invalid request body |
401 | Missing or invalid API key |
404 | Sandbox not found |
409 | Sandbox is paused — resume it before running commands |
410 | Sandbox has been killed |
502 | envd daemon inside the VM is unreachable |
503 | Sandbox has no VM |