Streaming
Real-time conversation streaming with Server-Sent Events
The Inconvo API supports real-time streaming of conversation responses using Server-Sent Events (SSE). This allows you to receive responses as they are generated, providing a more interactive experience for your users.
How it works
Section titled “How it works”When you create a response with stream: true
, the API returns a stream of events instead of waiting for the complete response. This enables you to:
- Display agent progress steps in real-time
- Show partial responses as they’re generated
- Provide immediate feedback to users
- Build more responsive interfaces
Event Types
Section titled “Event Types”The streaming API emits three types of events. For detailed information about each event type, see:
response.created
- Emitted when a response begins processingresponse.agent_step
- Emitted when the agent makes a step in processing the responseresponse.completed
- Emitted when the response is complete.
Stream Response Example
Section titled “Stream Response Example”Streaming Request
Section titled “Streaming Request”curl -N -X POST https://app.inconvo.ai/api/v1/conversations/{id}/response \ -H "Authorization: Bearer $INCONVO_API_KEY" \ -H "Content-Type: application/json" \ -H "Accept: text/event-stream" \ -d '{ "message": "What is my best selling product?", "stream": true }'
Streaming Response
Section titled “Streaming Response”data: {"type":"created","id":"5b5de977-0678-46aa-8d21-3d2ae875fdd2"}
data: {"type":"agent_step","id":"5b5de977-0678-46aa-8d21-3d2ae875fdd2","step":"get_schemas","message":"Jumping into data..."}
data: {"type":"agent_step","id":"5b5de977-0678-46aa-8d21-3d2ae875fdd2","step":"database_retriever","message":"Retrieving..."}
data: {"type":"agent_step","id":"5b5de977-0678-46aa-8d21-3d2ae875fdd2","step":"set_message_derived_filters","message":"Setting filters..."}
data: {"type":"agent_step","id":"5b5de977-0678-46aa-8d21-3d2ae875fdd2","step":"decide_complete","message":"Verifying..."}
data: {"type":"agent_step","id":"5b5de977-0678-46aa-8d21-3d2ae875fdd2","step":"format_response","message":"Formatting response..."}
data: {"type":"completed","id":"5b5de977-0678-46aa-8d21-3d2ae875fdd2","response":{"type":"text","message":"Your best selling product is the iPhone 15, with the highest total quantity sold to date."}}
data: [DONE]