SNA

Events

The 15-type AgentEvent protocol. What flows over WS and SSE.

Every runtime emits a normalized AgentEvent stream. Consumers subscribe through WebSocket (push) or GET /agent/events (SSE), both of which carry the same wire shape.

Event types

TypeWhenCarries
initsession startedprovider, model, capabilities
assistantfinalized assistant text blockfull text
assistant_deltastreaming text chunkdelta
text_deltaalias used by some adaptersdelta
thinkingextended-thinking final blockfull thinking
thinking_deltastreaming thinking chunkdelta
tool_usetool invocationtool name, input
tool_use_deltastreaming tool input (JSON)partial input
tool_resulttool responseresult, isError, durationMs
permission_neededtool requires approvaltool name, input, decisionId
milestoneruntime-defined markerlabel
user_messageuser-side echo (after canonicalization)content
interruptedturn cancelledreason
errorruntime errormessage
completeturn doneusage, costUsd, durationMs

Deltas vs finals

For text and thinking, both _delta chunks and a final assistant / thinking event arrive. The final is the canonical version, it's what gets persisted in history. The deltas are for live rendering.

For tool use, tool_use_delta carries partial JSON input (Anthropic's input_json_delta). The final tool_use event has the parsed complete input.

Subscribing

WebSocket (recommended for live UI):

client.agent.onEvent(({ event }) => {
  if (event.type === "assistant_delta") render(event.delta);
});
await client.agent.subscribe(sessionId);

SSE (when WS is not available):

for await (const event of client.agent.streamEvents(sessionId)) {
  if (event.type === "complete") break;
}

For one-shot runs without a session, the SSE endpoint POST /agent/run-once/stream and its client wrapper agent.runOnceStream(opts) ship the same event protocol.

On this page