A PTY session is a full interactive terminal inside the sandbox — like SSH but over WebSocket. Supports colors, cursor movement, and full-screen applications (vim, htop).Documentation Index
Fetch the complete documentation index at: https://docs.opencomputer.dev/llms.txt
Use this file to discover all available pages before exploring further.
Creating a PTY
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
cols | number | 80 | Terminal columns |
rows | number | 24 | Terminal rows |
onOutput | callback | — | Called with output data (TS: Uint8Array, Python: bytes) |
PtySession
| Member | TypeScript | Python | Description |
|---|---|---|---|
| Session ID | pty.sessionId | pty.session_id | Unique session ID |
| Send input | pty.send(data) | pty.send(data) | Send keystrokes or commands |
| Receive output | via onOutput callback | await pty.recv() | Get terminal output |
| Close | pty.close() | await pty.close() | Close the PTY session |
recv() is Python-only — a pull-based alternative to the on_output callback. Returns raw bytes.Resize
PTY resize is available via the HTTP API only (POST /api/sandboxes/:id/pty/:sessionID/resize). The SDKs do not expose a resize method — the CLI handles resize automatically for interactive sessions.
CLI
The fastest way to get an interactive shell:oc shell for details.