Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Event Streams (SSE)

Server-Sent Events endpoints for real-time monitoring. All SSE endpoints use text/event-stream content type with keep-alive pings every 15 seconds.

GET /api/v1/events

Unified event stream for all agents.

Event types

EventDataDescription
token{"agent":"NAME","text":"..."}Inference token streamed
tool_call_start{"agent":"NAME","tool":"...","args":{}}Agent started a tool call
tool_call_end{"agent":"NAME","tool":"...","result":"..."}Tool call completed
agent_complete{"agent":"NAME","duration_ms":N}Agent tick finished
error{"agent":"NAME","error":"..."}Agent error
keepalive{}Connection keep-alive ping

Example stream

event: token
data: {"agent":"researcher","text":"The"}

event: token
data: {"agent":"researcher","text":" results"}

event: tool_call_start
data: {"agent":"researcher","tool":"http_fetch","args":{"url":"https://example.com"}}

event: tool_call_end
data: {"agent":"researcher","tool":"http_fetch","result":"200 OK"}

event: agent_complete
data: {"agent":"researcher","duration_ms":1234}

GET /api/v1/agents/stream

Per-agent event stream.

Query parameters

ParamRequiredDescription
agentyesAgent name to subscribe to

Returns the same event types as /events, filtered to the specified agent.

GET /api/v1/agui/events

AG-UI protocol event stream for frontend integration. Follows the AG-UI lifecycle specification.

Event types

EventDescription
STATE_SNAPSHOTFull state of all agents (sent on connect)
STATE_DELTAIncremental state change
RUN_STARTEDAgent execution cycle started
RUN_FINISHEDAgent execution cycle completed
TEXT_MESSAGE_STARTBeginning of a text message
TEXT_MESSAGE_CONTENTStreamed text content chunk
TEXT_MESSAGE_ENDEnd of a text message
TOOL_CALL_STARTTool invocation started
TOOL_CALL_ENDTool invocation completed

Example

event: STATE_SNAPSHOT
data: {"agents":[{"name":"log-monitor","status":"running"}]}

event: RUN_STARTED
data: {"agent":"log-monitor","run_id":"abc123"}

event: TEXT_MESSAGE_CONTENT
data: {"agent":"log-monitor","run_id":"abc123","text":"Scanning..."}

event: RUN_FINISHED
data: {"agent":"log-monitor","run_id":"abc123","duration_ms":500}