The Engine streams everything. From the firstDocumentation Index
Fetch the complete documentation index at: https://internal.september.wtf/llms.txt
Use this file to discover all available pages before exploring further.
text_delta to the final
thread_lifecycle: completed, every meaningful state change emits as a
Server-Sent Event. This page covers how to consume the stream well.
Why SSE
SSE is the right protocol for this surface because:- Server-pushed, like WebSocket, but over plain HTTP — works through every load balancer, proxy, and firewall that allows HTTPS.
- Text-based, parseable with two regexes.
- Reconnection is built into the spec; the browser’s
EventSourcehandles it for you. - No back-channel needed. The agent loop runs on the server; you just read.
POST /hitl/respond, which is a separate request.
The simplest consumer
A complete consumer
A real consumer routes by event type, handles disconnections, and surfaces meaningful state to the UI. Here’s the shape:data: field can span multiple lines — accumulate until a blank
line.
Event family routing
Group events into four families and handle them separately:Lifecycle
thread_lifecycle, error — the meta-events. Use them to start, stop,
and fail the UI’s “this turn is in progress” state.
Content
text_delta, thinking_delta, content_block_start,
content_block_stop — the model’s output. Stream into your message UI.
Tools
tool_call, tool_result — agent activity. Surface as collapsed UI
elements (“Searching the web…”, “Read 3 files”) that expand on click.
HITL
hitl_request, hitl_resolved — the agent is paused. Surface as a
prompt the user must respond to before the turn continues.
Reconnection
If your client disconnects mid-stream, the Engine keeps running. To catch up:0 to replay everything available.
The buffer’s lifetime is CHANNEL_STATE_TTL_ACTIVE (default 3 hours)
for active turns and CHANNEL_STATE_TTL_HITL (default 72 hours) for
HITL-paused turns.
Implementing resilient streaming
task_id is the key. Each event has a timestamp field; track
the last one you’ve seen. On reconnect, replay from there.
Heartbeats
The Engine emits aheartbeat event periodically — every 15 seconds by
default. Use it to detect dead connections. If you don’t see one for 30+
seconds, your connection is probably gone; reconnect.
Client-side rendering
A few patterns that work well:Accumulating text
For the simplest UX, concatenatetext_delta.text and re-render on each
event. Modern UI frameworks debounce at 60 FPS, so even a chatty stream
feels smooth.
Block-aware rendering
If the agent calls multiple tools and emits text between them, render each block as a separate UI element.content_block_start /
content_block_stop give you the boundaries.
Tool affordances
Don’t show raw tool input/output to the user. Format it:| Event | UI surface |
|---|---|
tool_call: web_search | ”Searching for X…” |
tool_result: web_search | ”Found 5 results” (collapsed; expandable) |
tool_call: read_file | ”Reading report.md” |
tool_call: bash | Show command, hide output by default |
HITL prompts
Whenhitl_request arrives, foreground a confirmation dialog. The
stream is paused; the user must respond before anything else happens.
After hitl_resolved, hide the dialog and resume the normal stream
view.
Timeouts
Set the HTTP client’s read timeout toNone (or very high). The Engine
holds the stream open for the duration of the turn, which can be
minutes. Normal HTTP timeouts will close the connection mid-turn.
Gotchas
- Buffer flushing. Some HTTP clients buffer the body. With curl, use
-N(no buffering). With Python’srequests, usestream=True. With fetch, the response body’sgetReader()is unbuffered by default. - Proxy buffering. Reverse proxies (nginx, ALB) sometimes buffer
responses. Configure
proxy_buffering offfor the Engine path. - Compression. Some proxies compress responses, which buffers them.
Disable compression on the SSE path or set
X-Accel-Buffering: noupstream. - Wide writes. A single
text_deltaevent can carry several tokens; others carry one. Don’t assume one delta = one token in your UI logic.
See also
- Streaming events — every event
type, with
datashapes. - POST /execute — the stream’s source.
- Durability — the underlying channel-state mechanism.

