Stream Message
Sends a user message and streams the AI response as Server-Sent Events (SSE). This endpoint is on the AI Core service (ai.datagol.ai).
Authorizations
For server-to-server or automated access, use a DataGOL Service Account key.
Pass it via the x-auth-token header instead of Authorization:
x-auth-token: <service-account-key>
Body
Must be CustomAgent.
CustomAgent Duplicates agentType for internal routing.
CustomAgent The conversation ID returned by POST /ai/api/v2/conversations.
"ae5ee879-e967-45e4-bca0-c6c78d10bd23"
The user's message text to send to the agent.
"Summarise the data"
Model for this specific message. Can be changed per message to switch models mid-conversation.
"gpt-5.2"
Response
Below is the mapping of each event type, its structure, and required frontend handling.
Response Type (response_type) | Content Structure (content) | Frontend Behavior & Handling Rules |
|---|---|---|
message_id | integer (e.g., 7903) | First event of every agent turn. Provides the server-assigned numeric ID. Stash it if you need a handle; otherwise, safely ignore it. |
text | string (Markdown chunk) | Streaming text chunk. Delivered incrementally. Append each chunk to the in-progress message; do not replace it. |
tool_call | object ({action, input, tool_call_id}) | Agent invoking a tool. Render an inline "running tool..." indicator in the UI. Track tool_call_id. |
subagent_task_end | object ({tool_call_id, tool_response}) | Tool finished. Match tool_call_id to stop the spinner. CRITICAL: tool_response[0].text is a double-encoded JSON string. You must call JSON.parse() a second time to extract the actual structured payload. |
html | string (HTML/SVG fragment) | Rich visualization. SECURITY RULE: Render this content strictly inside a sandboxed <iframe srcdoc="..."> so encapsulated styles do not leak. Do not inject via dangerouslySetInnerHTML. |
| (Any other type) | Varies / Unknown | Forward-compatibility. Safely ignore unlisted types to prevent application crashes as new events are introduced. |