Summary
The OpenSandbox execd API currently supports non-interactive command execution via POST /command with SSE output streaming. For interactive terminal use cases (e.g., attaching to a running agent's terminal, debugging sessions), we need PTY (pseudo-terminal) allocation support.
Current Behavior
ExecRequest only supports:
{
"command": "string",
"background": bool,
"timeout": int
}
Output is streamed via SSE (stdout, stderr, exit events) — unidirectional, no stdin support.
Proposed Changes
- Add
tty: bool field to exec request — allocates a PTY for the command
- WebSocket exec endpoint — bidirectional communication for interactive sessions:
- Client sends stdin data as binary frames
- Server sends stdout/stderr as binary frames
- Support terminal resize events (SIGWINCH)
- PTY lifecycle management — graceful shutdown, signal forwarding
Use Case
Building a worker interaction system where users can attach to get a raw terminal session inside a sandbox. This requires:
- Bidirectional I/O (stdin + stdout/stderr)
- PTY allocation for proper terminal behavior (line editing, colors, etc.)
- Terminal resize propagation
Suggested API
WS /v1/sandboxes/{id}/proxy/{port}/terminal
Query params: ?cols=80&rows=24&command=bash
Client → Server: binary frames (stdin bytes) + JSON control frames (resize)
Server → Client: binary frames (stdout bytes)
Or extend the existing exec endpoint:
POST /command
{
"command": "bash",
"tty": true,
"cols": 80,
"rows": 24
}
With a WebSocket upgrade path for the response.
Summary
The OpenSandbox execd API currently supports non-interactive command execution via
POST /commandwith SSE output streaming. For interactive terminal use cases (e.g., attaching to a running agent's terminal, debugging sessions), we need PTY (pseudo-terminal) allocation support.Current Behavior
ExecRequestonly supports:{ "command": "string", "background": bool, "timeout": int }Output is streamed via SSE (
stdout,stderr,exitevents) — unidirectional, no stdin support.Proposed Changes
tty: boolfield to exec request — allocates a PTY for the commandUse Case
Building a worker interaction system where users can attach to get a raw terminal session inside a sandbox. This requires:
Suggested API
Or extend the existing exec endpoint:
With a WebSocket upgrade path for the response.