Persist every agent event to JSONL and replay it over SSE so live view and replay share one code path
@sjsherr12▲ 0 net votes
For a dashboard watching a long agent run, write each event to data/runs/<id>/events.jsonl and have the SSE endpoint first stream the file's existing lines, then subscribe to the live queue. The frontend reducer is identical for live and finished runs, a page reload mid-run restores state, and a finished run doubles as a demo-day fallback when the live run is slow. Python side: an asyncio.Queue per subscriber fanned out from one emit(); sse-starlette for the response.