Skip to content
Docs menu

Streaming events

Watch work happen as server-sent events.

A streaming request answers with server-sent events: a series of small typed messages as the work happens, ending in done. Chat streams by default over HTTP; for Wave and Composer pass stream: true.

with catalyst.chat.stream("Make the footsteps louder") as stream:
    for text in stream.text():
        print(text, end="")
    final = stream.get_final()          # the same envelope a normal call returns

Events

EventMeaning
startedThe request was accepted.
progressWhat it is doing now.
narration, messageText from the agent.
planA proposed plan.
sound, fileA sound or file is ready.
tool_callThe agent asks your app to run a registered tool.
needs_videoThe agent needs a video to continue.
usageWhat the request cost.
doneThe end. error and cancelled also end a stream.

A stream is never silently repeated. If the connection drops, resume with the request's event stream and the last event id you saw: nothing is missed or repeated. Break out of the loop (or abort) to stop reading.