Skip to main content
GET
Stream Conversation AI Agent Response (SSE)
⚠️ This is a streaming endpoint using Server-Sent Events (SSE). Opens a live SSE stream to receive real-time response messages from the conversational agent after sending a message. Use the temporary token received from /generate_secret or /get_inference as applicable to authenticate the stream. The stream sends event.data messages that include control signals or agent-generated content.

1. Connection Closing

  • close_connection/[DONE]: Indicates the normal end of the stream. The client must close the EventSource connection.

2. Stream Continuation

  • call_again: Indicates a tool/function call occurred. You’ve to set your message loading state to true and new message chunks will be sent in the stream.

3. Error / Restriction Signals

These indicate problems or user restrictions. In all cases, the client must close the connection.
  • no_message_found: The agent was unable to generate a response as no user message corresponding to request found.
  • close_connection_incomplete_content: AI model exceeded its response context window.
  • close_connection_incomplete_tool_calls: Context overflow occurred while generating tool call arguments.
  • close_connection_incomplete_request: Context overflow occurred while generating response.
  • __ERROR__: ....: An error occurred while processing the request.
  • [FROZEN] / [BLACKLISTED]: User access restrictions triggered.

4. AI Agent Response Content

  • JSON payloads: Contain AI Agent Response message content. When streaming is ON you will receive message chunks, and when streaming is OFF you will get the full response in a single JSON payload.
When Streaming is ON:
When Streaming is OFF:
Example Implementation

Query Parameters

token
string
required

Temporary access token used to authenticate the Server-Sent Events (SSE) stream.

This token is obtained from the /generate_secret endpoint and also after sending a message to the AI agent via /get_inference.

Pass it as a query parameter like this:

If the token is missing or invalid, the server will respond with a 401 Unauthorized error.

Example:

"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Response

200 - text/event-stream

SSE stream opened. Messages will be sent continuously as text/event-stream.

The response is of type string.

Example:

"data: {\"content\": \"How\"}\n\ndata: {\"content\": \" can\"}\n\ndata: {\"content\": \" I\"}\n\ndata: {\"content\": \" assist\"}\n\ndata: {\"content\": \" you\"}\n\ndata: {\"content\": \" today\"}\n\ndata: {\"content\": \"?\"}\n\ndata: close_connection\n\n"