Regenerate AI response
Regenerate the AI response for a specific message and stream the new answer over Server-Sent Events.
Overview:
If you're not satisfied with an AI response, use this endpoint to generate a new answer. The original user query is re-processed and a new bot response replaces the previous one in place.
Constraints:
- Only the last message of the conversation can be regenerated.
- The target message must be of type bot_response.
Use Cases:
- Response was incomplete or unclear
- Want to try a different AI model
- New documents have been indexed since original response
Model Override:
Specify modelKey to use a different model for regeneration.
Streaming:
The response is delivered as an SSE (text/event-stream) stream. The exact event vocabulary depends on chatMode:
- For non-agent modes (e.g. internal_search, web_search) the request is dispatched to the assistant chat backend.
- For agent modes (e.g. agent:auto) the request is dispatched to the agent backend with a placeholder agent built from the caller's workspace, which can additionally emit tool_result and tool_execution_complete events.
See SSEEvent for the full union of event names this endpoint can emit across both backends.
Path parameters
ID of the message to regenerate response for
Request body
Example request
{
"modelKey": "05438a37-68f2-4641-a8dc-6c47e63278ca",
"modelName": "gpt-5.4-mini",
"modelFriendlyName": "mini",
"chatMode": "internal_search",
"timezone": "Asia/Calcutta",
"currentTime": "2026-05-11T15:43:21+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 on SSEEvent. The exact subset of events emitted depends on chatMode (see the route description for routing rules).
Lifecycle (all event names are sent verbatim on the wire):
- connected — { "message": "SSE connection established" }. Fired once on connection by the API layer.
- status — progress messages from the AI backend. Possible status sub-values include started, transforming, searching, processing, checking_tools, generating_answer, generating, analyzing, evaluating, planning, executing, retrying, continuing, success, skipped, pending, keepalive, cascade_error, and backend-defined values that may be added over time.
- answer_chunk — incremental token batches with running accumulated text, accumulated citations, and the backend-supplied confidence (typically null until the final chunk).
- tool_calls / tool_call / tool_success / tool_error — emitted when the model invokes tools (agent chat modes, or the non-agent path when SQL / record-fetch tools are configured).
- tool_result / tool_execution_complete — additional tool lifecycle events emitted only on the agent-mode path.
- restreaming — emitted when the LLM is restarted with new context (e.g. before a citation-verification pass or reflection-driven retry).
- metadata — {} keep-alive emitted by the JSON-streaming branch while waiting for the next safe-to-flush chunk.
- complete — { "conversation": Conversation, "recordsUsed": number, "meta": { "requestId": string, "timestamp": string, "duration": number, "recordsUsed": number } }. Fired once after the regeneration is persisted; the new bot response replaces the previous one in conversation.messages at the same index. The AI backend's own complete frame is consumed server-side and is not forwarded — clients see only this server-defined frame.
- error — { "error": string, "details"?: string }. Fired if the stream fails; the previous bot response is replaced with an error message and the conversation row is marked FAILED before close.
Clients should ignore unknown event names rather than treating them as errors.