Converse
Streaming
Stream a conversation with an AI Agent
When conversing, you can set "stream": true
to incrementally stream the response using server-sent events (SSE).
Streaming with SDKs
Both the Python and Typescript/Javascript SDKs provide convenient APIs to stream responses.
Event types
Each server-sent event includes a named event type and associated JSON data. Each event will use an SSE event name (e.g. event: delta), and include the matching event type in its data.
Each stream uses the following event flow:
start
: Indicates the start of the conversation and contains theconversation_id
andagent_id
used to answer the prompt.delta
: contains thedelta
object with the changes to the message.end
: Indicates the end of the conversation.