Send a message to GreenBot and stream the reply
Validates the request before streaming (400 / 402 / 404 / 503 are plain JSON errors), then answers text/event-stream. Every event has an id: sequence; a : ping comment is sent every 15 s. Events: meta {threadId, userMessageId, messageId, title}; text_delta {messageId, delta}; tool_start {messageId, toolCallId, name, label}; tool_progress {messageId, toolCallId, message}; tool_result {messageId, toolCallId, name, status: ok|error, summary}; part {messageId, part} (a rich UI part, in order); error {messageId?, code, message}; done {messageId, finishReason: stop|max_steps|error|cancelled|waiting, creditsCharged?} (waiting: the turn started background work; the thread resumes by itself with a continuation message, trigger job). The persisted assistant message holds, in order, the text part (the deltas coalesced), the tool parts and the rich parts. A client disconnect cancels the turn; the partial reply is saved with status error. The Stop button should call the cancel route first (Cloud Run does not pass a disconnect on). One turn at a time per thread: a turn while another is streaming is a 409 TURN_IN_PROGRESS (a reply still streaming past the deadline + 60 s is closed as stale). With retryOfMessageId the thread's latest reply (failed, stopped or at the step limit) is replaced and its user message reused; content is then ignored and meta.userMessageId is the reused id; any other id is a 409 RETRY_NOT_ALLOWED. Every attachment uploadId must be an upload of the caller's organization (400 INVALID_ATTACHMENT otherwise); context is advisory and never widens access. At most 8 model steps and 240 s per turn. Billed as AI usage under feature area assistant (operation turn); a failed or cancelled turn is recorded but not charged, and a widget proposal is billed separately as a widget draft. Tools are offered by role: reads need org.view_dashboard, propose_widgets org.edit_dashboard, propose_report report.create, analyze_document and start_pcf_analysis org.write_data. Requires org.view_dashboard.
Path parameters
Request body
Response
SSE stream of the reply
Changes
Changed in 1 of the 5 revisions of this API.1
- ○
endpoint added
endpoint-added
- ○