{
"query": "Hello",
"pid": "3..",
"chatbot_id": "DKDvwn...",
"user_context": {
"session_id": "6ff922ed-9884-4430-83c9-7ac83a7b0574",
"platform": "web"
}
}| Field | Type | Required | Description |
|---|---|---|---|
query | string | Yes | User message or question sent to the chatbot. |
pid | string | Yes | Project ID associated with the chatbot. |
chatbot_id | string | Yes | Unique chatbot identifier that should process the message. |
user_context | object | Yes | Additional context about the user, session, platform, or client application. |
user_context.session_id | string | No | Unique session identifier used to continue or group messages in the same conversation. |
user_context.platform | string | Yes | Platform or channel where the message originated. Example: web. |
data: {...}data: [DONE]data: {"type":"start","messageId":"zUqbj2SylMki95Be"}
data: {"type":"start-step"}
data: {"type":"text-start","id":"0"}
data: {"type":"text-delta","id":"0","delta":"Hello"}
data: {"type":"text-delta","id":"0","delta":"! How can I help you today?"}
data: {"type":"text-end","id":"0"}
data: {"type":"finish-step"}
data: {"type":"finish","finishReason":"stop"}
data: {"type":"data-session","data":"6ff922ed-9884-4430-83c9-7ac83a7b0574"}
data: {"type":"data-finish-reason","data":{"finishReason":"stop","rawFinishReason":"STOP"}}
data: [DONE]| Event Type | Description |
|---|---|
start | Indicates that the streaming response has started. Usually includes the generated message ID. |
start-step | Indicates that the agent has started a processing step. |
tool-input-start | Indicates that the agent is preparing to call an available tool. |
tool-input-delta | Streams partial tool input as it is being generated. |
tool-input-available | Indicates that the complete tool input is available. |
tool-output-available | Indicates that the tool has returned output. |
finish-step | Indicates that a processing step has completed. |
text-start | Indicates that the assistant text response has started. |
text-delta | Streams a partial text token or text chunk from the assistant response. |
text-end | Indicates that the assistant text response has completed. |
finish | Indicates that the AI generation has completed. |
data-session | Returns the conversation session ID associated with the response. |
data-finish-reason | Returns the final completion reason for the response. |
[DONE] | Indicates the end of the stream. |
text-deltatext-delta event contains the AI-generated answer in small chunks.{
"type": "text-delta",
"id": "0",
"delta": "Hello! How can I help you today?"
}| Field | Type | Description |
|---|---|---|
type | string | Event type. For streamed text chunks, the value is text-delta. |
id | string | Identifier for the streamed text block. |
delta | string | Partial text content generated by the AI agent. |
data-sessiondata-session event returns the conversation session ID.{
"type": "data-session",
"data": "6ff922ed-9884-4430-83c9-7ac83a7b0574"
}| Field | Type | Description |
|---|---|---|
type | string | Event type. |
data | string | Session ID associated with the conversation. |
data-finish-reasondata-finish-reason event returns the completion reason.{
"type": "data-finish-reason",
"data": {
"finishReason": "stop",
"rawFinishReason": "STOP"
}
}| Field | Type | Description |
|---|---|---|
type | string | Event type. |
data.finishReason | string | Normalized reason why the response finished. |
data.rawFinishReason | string | Raw finish reason returned by the underlying AI provider. |
{
"message": "Bad Request",
"error": {
"code": "BAD_REQUEST",
"detail": "Invalid request body or missing required fields."
}
}{
"message": "Unauthorized",
"error": {
"code": "UNAUTHORIZED",
"detail": "Authentication token is missing or invalid."
}
}text-delta events and append each delta value to the visible chat response.data: [DONE].session_id in user_context to continue an existing conversation.data-session event.curl --location 'https://agents.robofy.ai/v1/ai-agent/chat/stream' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"query": "Hello",
"pid": "3..",
"chatbot_id": "DKDvwn...",
"user_context": {
"session_id": "6ff922ed-9884-4430-83c9-7ac83a7b0574",
"platfrom": "web"
}
}'{
"type": "text-delta",
"id": "0",
"delta": "Hello! How can I help you today?"
}