v10

latestOpenAPI 3.0.0raw.githubusercontent.com2026-07-0582185581.9 KB
Conversations

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.

post/conversations/{conversationId}/message/{messageId}/regenerate

Path parameters

conversationIdstring objectId required
messageIdstring objectId required

ID of the message to regenerate response for

Request body

modelKeystring

Identifier of the AI model configuration to use for regeneration. Typically a UUID returned by the model-management endpoints. When omitted, the model used for the original message is reused.

modelNamestring

Provider model name (e.g. the underlying LLM identifier).

modelFriendlyNamestring

Friendly display name of the selected model.

chatModestring

Chat mode used for regeneration (for example internal_search, web_search, or an agent mode such as agent:auto).

timezonestring

IANA timezone identifier from the client. Used to provide time-aware context to the AI during regeneration.

currentTimestring date-time

ISO 8601 / RFC 3339 datetime from the client (UTC Z or numeric offset). Used to anchor any relative time references in the query.

toolsstring[]

Optional list of tool identifiers (fully-qualified action names such as jira.create_issue) the agent may invoke when regenerating. Applicable only in agent chat modes.

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.