Skip to main content
GET /v1/agents/runtime/{runtime_id}/pty/{session_id}/stream Streams the session’s terminal output as Server-Sent Events. The stream begins with the session’s retained scrollback and then follows live output, so attaching to a session that has been running unattended shows you what you missed before it shows you what happens next. Multiple clients can stream the same session concurrently, and you can detach and re-attach freely: the session is owned by the execution plane, not by the connection.

Events

Each SSE frame carries one JSON object with a type field.

Why the data is base64 encoded

Terminal output is a byte stream, not text. It contains escape sequences, and a chunk boundary can fall in the middle of a multi-byte UTF-8 character. Base64 keeps those bytes intact through JSON. The Python SDK decodes data back to bytes for you. If you need text, decode with errors="replace" and accumulate across chunks rather than decoding each chunk in isolation:

Scrollback

Each session retains up to 256 KB of recent output. Attaching replays that buffer first, which is what makes detach and re-attach useful. If a session has produced more than 256 KB since you last attached, the oldest output has been discarded and the replay starts partway through. If you need a complete transcript, keep a reader attached, or redirect the program’s output to a file in the runtime and read the file afterwards.