Agent-readable docs index: /llms.txt. Full docs in one file: /llms-full.txt. Download /docs.zip to grep all markdown files locally.

Interactive Terminals

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).
typescript
import { Sandbox } from "@opencomputer/sdk"; const sandbox = await Sandbox.create(); const pty = await sandbox.pty.create({ onOutput: (data) => process.stdout.write(data), }); pty.send("ls -la /app\n"); // ... wait for output ... pty.close(); await sandbox.kill();

Creating a PTY

typescript
const pty = await sandbox.pty.create({ cols: 120, rows: 40, onOutput: (data) => process.stdout.write(data), });

Parameters

ParameterTypeDefaultDescription
colsnumber80Terminal columns
rowsnumber24Terminal rows
onOutputcallback—Called with output data (TS: Uint8Array, Python: bytes)

PtySession

MemberTypeScriptPythonDescription
Session IDpty.sessionIdpty.session_idUnique session ID
Send inputpty.send(data)pty.send(data)Send keystrokes or commands
Receive outputvia onOutput callbackawait pty.recv()Get terminal output
Closepty.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:
bash
oc shell sb-abc123 oc shell sb-abc123 --shell /bin/zsh
Terminal size is auto-detected and resize events are forwarded. See oc shell for details.
CLI equivalent: oc shell. Full reference: TypeScript SDK · Python SDK · HTTP API.