1. Keep the API key on your server
Every stream route requires your API key, so the browser must never connect toapi.autumn.ai directly. Start the task server-side, then either proxy the SSE stream
through your backend or forward its events over your own channel.
2. Subscribe on the server, relay to the client
GET /task/{task_id}/stream sends the current status first, then one event per status
version change. A user who opens the page mid-run still sees the latest state:
3. Map events to UI states
Each event carries the status fields, a printablesummary, and an event name:
The SSE
id is the status version; pass it as Last-Event-ID on reconnect. A repeated
version does not emit the same status again. The default stream is quiet; ?verbose=1
selects the legacy raw feed. The dashboard stream is unaffected.
4. When the turn is done, fetch the rows
Whendone is true, inspect state: for completed, refresh the table from
GET /task/{task_id}/output, flattening cells for display and keeping _sources so each
value can link to where it came from. For input-required, show message and offer an
answer action; a done turn does not necessarily end the task conversation.
Outputs and sources covers the cell shape.
5. Wire the follow-up box to continue
The natural next interaction is the user asking for changes. Send that throughPOST /task/{task_id}/continue; if a turn is running, the follow-up queues and the API
returns 202. Keep the box available while the task runs, and show queue_position from
the response.
Decision: if your UI only needs a progress bar and a finished table, skip the stream
entirely and call GET /task/{task_id}?wait=50 until done is true. Streaming earns its
complexity when users watch.
Related
Live messages
The SSE mechanics: routes, parsing, and event names.
Build a reviewed list
Put a human reviewer behind this UI.