Stream a Chat Completion (SSE)
For clients that don’t speak MCP JSON-RPC. Appends one user message to the (workspace x x-session-id) conversation, runs the agent loop, and streams the response as a text/event-stream. Reuse the same x-session-id across calls to continue the same conversation — the server persists message history per session.
Stateless workspaces: if the workspace has statelessMode: true, nothing is persisted and the x-session-id header is ignored. Instead, supply prior turns yourself via the request body’s history array (up to 200 turns; the current message stays in message). Sending history to a non-stateless workspace returns 400. statelessMode is a workspace setting and cannot be overridden per request.
SSE event types: message_delta (incremental assistant text), tool_call_start, tool_call_result, tool_calls_complete, usage (token counts), done (stream end), and error.
Authorizations
Enter your API key with the Bearer prefix — e.g. Bearer sk_live_xxx (production) or Bearer sk_test_xxx (sandbox)
Headers
Conversation id — must be a valid UUID. The same value across requests resumes the same chat; a new value starts a fresh conversation.
Path Parameters
Workspace (MCP server) UUID to route the chat through.
Body
The user message for this turn. This is the CURRENT message only — prior turns go in history (stateless workspaces) or are loaded from the persisted session (stateful workspaces).
1 - 50000"Hello"
Optional free-text background about the end-user (e.g. an email signature, preferred tone, defaults). When non-empty it is injected into the agent so it can apply it when calling tools. On a stateful workspace it is stored encrypted and sticky for the end-user (keyed by the x-session-id header); on a stateless workspace it is injected for this request only and NEVER stored. Omit or send an empty string to keep any previously stored value; a new non-empty value overwrites it. Max 50000 characters.
50000Caller-supplied PRIOR conversation turns, accepted ONLY when the workspace is in statelessMode. Sending history to a non-stateless workspace returns 400. Excludes the current message (which stays in message). Up to 200 items; each item's message is capped at ~50,000 characters.
200Response
Server-Sent Events stream of the agent loop's response. Parse event:/data: frames; the stream ends with a done event.
An SSE stream. Each frame is event: <type>\ndata: <json>\n\n.