Stream Chat
Streams an agent loop running as a durable Vercel Workflow against the session’s sandbox. The agent uses sandbox-only tools (bash, read, write, grep, glob, todo, task, ask_user_question, skill, fetch) — no MCP or Composio. Requires a sandbox provisioned via POST /api/sandbox.
Related endpoints
POST /api/chat/runs— the headless counterpart: it provisions its own session + sandbox and runs without a streaming client. Use that for tasks/cron/programmatic runs; use this for interactive, streaming turns on an existing chat.GET /api/chat/{chatId}/stream— reconnect to an in-progress response.GET /api/chat/runs/{runId}— check whether a headless run finished (status, not content).
Authorizations
Your Recoup API key. Learn more.
Body
Chat workflow request
Request body for the sandbox-driven, Workflow-backed chat endpoint. Requires an existing session, chat, and provisioned sandbox. The Bearer key from the Authorization header is forwarded into the sandbox for skill-based callbacks to the Recoup API — no separate access-token field needed.
Conversation history as an array of UIMessage objects, matching the Vercel AI SDK UIMessage shape. The last entry is typically the new user turn — the agent loop reads the entire array and persists the latest user message before the workflow starts.
UUID of an existing chat under sessionId. The chat's active_stream_id column is used for compare-and-set race control across concurrent requests.
UUID of the session that owns both the chat and the sandbox. The session must have a non-null sandbox_state — call POST /api/sandbox first if not.
Optional per-prompt context overrides forwarded into the agent loop.
Response
Server-Sent Events stream of UI message parts compatible with the Vercel AI SDK createUIMessageStreamResponse. The x-workflow-run-id response header carries the durable workflow run ID for resume/stop operations.
Server-Sent Events stream containing UI message parts
