Subscribe to a session's event stream (SSE)
Subscribe to a session’s live event stream.
Returns a text/event-stream that first replays any buffered
events from the current run’s replay log (if a run is in progress
or just finished), then streams live events as they are produced
by :meth:ChatService.run. The connection stays open
until the client disconnects — subsequent runs on the same session
are delivered over the same connection.
A heartbeat comment frame (:\n\n) is sent every 30 seconds to
keep the connection alive through reverse proxies.
Args:
session_id (str):
The session to subscribe to.
agent_id (str):
The agent that owns the session (used for ownership
validation).
user_id (str):
Injected authenticated user id.
storage (StorageBase):
Injected storage backend (ownership check only).
message_bus (MessageBus):
Injected message bus (replay + live subscription).
Returns:
StreamingResponse:
SSE stream of AgentEvent frames + periodic heartbeats.