TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/opensandbox-group/OpenSandbox/llms.txt
Use this file to discover all available pages before exploring further.
execd daemon runs inside every sandbox and exposes a local HTTP API at port 44772. It handles shell command execution, bash session management, file operations, code interpretation, and system metrics. All execd endpoints require the X-EXECD-ACCESS-TOKEN header — the token is provisioned at sandbox startup by the runtime. This page covers health checking, shell command execution, bash session management, and command status polling.
GET /ping
Health check endpoint. Returns200 OK if the execd daemon is running and responsive. Typically used by orchestration platforms and monitoring systems to verify service availability.
Auth: X-EXECD-ACCESS-TOKEN header required.
Example
POST /command
Executes a shell command and streams output in real-time using Server-Sent Events (SSE). Commands can run in foreground (default) or detached background mode. Optionally specify a timeout, working directory, user/group IDs, and environment variable overrides. Auth:X-EXECD-ACCESS-TOKEN header required.
Request Body
Shell command string to execute. Example:
"ls -la /workspace".Working directory for command execution. Defaults to the sandbox working directory.
When
true, the command runs in detached mode. SSE stream still starts immediately but the process continues after the stream closes. Default: false.Maximum execution time in milliseconds. The server forcefully terminates the process when reached. Omit to run without a server-enforced timeout.
Unix user ID for running the command. Required when
gid is provided.Unix group ID for running the command. Requires
uid to be provided.Environment variables injected into the command process. Key-value string pairs.
Response — 200 OK (text/event-stream)
The response is an SSE stream. Each event has a type field and optional payload fields.
Event type. One of:
init, status, stdout, stderr, result, execution_complete, execution_count, error, ping.Textual payload for
stdout, stderr, status, and init events.Execution duration in milliseconds. Present on
execution_complete.Error details for
error events. Contains ename, evalue, and traceback.Unix milliseconds when the event was generated.
Example
DELETE /command
Interrupts the currently running command execution in the specified context. Sends a termination signal to the process and releases associated resources. Auth:X-EXECD-ACCESS-TOKEN header required.
Query Parameters
Session ID of the execution context to interrupt.
Example
GET /command/status/
Returns the current status of a command (foreground or background) including running state, exit code, error message, and start/finish timestamps. Auth:X-EXECD-ACCESS-TOKEN header required.
Path Parameters
Command ID returned by
POST /command.Response — 200 OK
Command ID.
Original command string.
Whether the command is still executing.
Exit code once the command has finished.
null if still running.Error message if the command failed.
Start time in RFC 3339 format.
Finish time in RFC 3339 format.
null if still running.Example
GET /command//logs
Returns accumulated stdout and stderr for a background command. Supports incremental reads via a line-based cursor. Intended for polling logs of detached background commands; foreground commands should consume output directly from the SSE stream. Auth:X-EXECD-ACCESS-TOKEN header required.
Path Parameters
Command ID returned by
POST /command.Query Parameters
Optional 0-based line cursor. When provided, only lines after this position are returned. Omit to receive the full log. Use the
EXECD-COMMANDS-TAIL-CURSOR response header value as the next cursor for incremental polling.Response — 200 OK
The response body istext/plain log content. The EXECD-COMMANDS-TAIL-CURSOR response header contains the highest available 0-based line index — pass this as cursor in the next request to poll only new lines.
Example
POST /session
Creates a persistent bash session that maintains shell state (working directory, environment variables) across multiple command runs. Returns asession_id for use with subsequent POST /session/{sessionId}/run requests.
Auth: X-EXECD-ACCESS-TOKEN header required.
Request Body (optional)
Initial working directory for the session. Defaults to the sandbox working directory.
Response — 200 OK
Unique session ID for
run_in_session and delete_session calls.Example
POST /session//run
Executes a shell command inside an existing bash session, streaming output in real-time via SSE. The session maintains state between runs (e.g.cd persists across calls).
Auth: X-EXECD-ACCESS-TOKEN header required.
Path Parameters
Session ID returned by
POST /session.Request Body
Shell command to execute in the session.
Working directory override for this individual run.
Maximum execution time in milliseconds for this run.
Response — 200 OK (text/event-stream)
SSE stream with the same event types as POST /command: init, status, stdout, stderr, result, execution_complete, error.
Example
DELETE /session/
Terminates a bash session, stopping the underlying shell process and releasing all associated resources. Auth:X-EXECD-ACCESS-TOKEN header required.
Path Parameters
Session ID to delete.
Example
SSE Event Types
| Event Type | Description |
|---|---|
init | Initialization event, fired when execution starts. |
status | Status update with descriptive text. |
stdout | Standard output chunk from the process. |
stderr | Standard error chunk from the process. |
result | Final execution result (code interpreter contexts). |
execution_complete | Signals the command/code has finished. |
execution_count | Cell execution counter increment (Jupyter contexts). |
error | Structured error with ename, evalue, and traceback. |
ping | Keep-alive heartbeat. |