Create conversation with streaming response
Start a new conversation and stream the AI response over Server-Sent Events (SSE). Behaves like POST /conversations but emits tokens, tool activity, and status updates incrementally instead of returning a single JSON response at the end.
Lifecycle
- The server validates query, persists an in-progress conversation, then opens the SSE stream with HTTP 200.
- A connected event is emitted immediately with the new conversationId so the client can link the stream (sidebar, parallel tabs, deep links) without an extra request.
- AI-backend events stream through (token chunks, tool calls, status, etc.).
- On success a single complete event is emitted carrying the full persisted conversation.
- On failure an error event is emitted and the conversation is marked FAILED before the stream closes.
Event vocabulary
Three events have stable, server-defined data shapes:
- connected — { "message": string, "conversationId": string, "title": string }
- complete — { "conversation": Conversation, "meta": { "requestId": string, "timestamp": string, "duration": number } }
- error — { "error": string, "details"?: string }
The forwarded events are status, answer_chunk, tool_calls, restreaming, metadata, and tool_execution_complete. Their payloads come from the Python query service and may evolve. Note that raw tool_call / tool_success / tool_error / tool_result events emitted by the LLM tool runtime are rewrapped as status by the upstream wrapper before they reach this route, so clients on /conversations/stream never see those names directly. Clients should ignore unknown event names rather than treating them as errors.
Agent mode
When chatMode selects an agent mode (for example agent:auto), the optional tools list restricts which tools the agent may invoke for this turn. Outside agent modes the tools field is ignored.
Request body
Example request
{
"query": "What are the key findings from our Q4 financial report?",
"recordIds": [
"507f1f77bcf86cd799439011",
"507f1f77bcf86cd799439012"
],
"modelKey": "gpt-4-turbo",
"modelName": "GPT-4 Turbo",
"modelFriendlyName": "GPT-4 Turbo",
"chatMode": "internal_search",
"timezone": "America/New_York",
"currentTime": "2026-04-12T16:00:00+05:30",
"tools": [
"jira.create_issue",
"confluence.search_content"
]
}Response
SSE stream established. The body is a sequence of text/event-stream frames using the event vocabulary described above.