Exec
The exec endpoints run a command inside a running VM and return its output. Two flavors are supported:
- Synchronous — start the command, wait for it to finish, return
{stdout, stderr, exit_code}. Best for short-lived commands. - Streaming — receive
stdoutandstderrchunks over Server-Sent Events as they're produced. Best for long-running processes, tests, or interactive output.
Both require a VM in the running state — see VMs to start one.
Endpoints
POST /v1/instances/:id/exec— run synchronouslyPOST /v1/instances/:id/exec/stream— run with SSE streamingGET /v1/instances/:id/exec— list past executions
Related
- Instances
- Files — for reading output artifacts the command wrote to disk
- AI code execution guide — patterns for agent workflows