Stream agent response (AI SDK format)
Build and stream responses from an agent in AI SDK v6 UIMessageStream format. Compatible with assistant-ui and AI SDK useChat. Provide either agentId or copilotId. Requests with the shared TRUSTED_KEY bypass DB API-key lookup; otherwise an API key in the Authorization header is validated.
Authorizations
Org API key (scopes the request to its organization) or the shared trusted key (requires X-Organization-Id on every request).
Headers
Organization to scope the request to. Optional when authenticating with an org API key (the org is taken from the key; if sent, it must match). Required when authenticating with the trusted key.
End-user identity for the request; user-scoped data (threads, memory) resolves to {orgId}_{userId}. Required by endpoints that read or write user-scoped resources. A userId query param (or body field, where documented) is accepted as a fallback.
Body
1Stable agents.id — runs the agent's ACTIVE published version
Override: run this EXACT agent_versions.id (e.g. preview a draft or a non-active published version) instead of the active one
Copilot id to route through (alternative to agentId)
Conversation thread id
Optional STABLE caller-supplied chatter group id (chatter_groups.external_id). When sent, group matching is by this id; a differing groupName renames the group.
1 - 255Optional chatter group name. Without groupId this matches/provisions by name (legacy behavior); alongside groupId it is display-only (rename on change).
Runtime authentication map: { [providerNameOrId]: { credentials } }
Additional context messages to provide to the agent.
AI SDK trigger type
submit-message, regenerate-message AI SDK client-side tools
AI SDK session metadata
Default true. When the request lands on an orchestrator (copilot routing agent that was not optimized to a subagent), a pre-stream Handoff Agent picks whether to stream the orchestrator (multi-step / synthesis) or a single subagent directly (domain-specific ask). No-op when the resolved agent is not an orchestrator flow. Pass false to disable.
Response
AI SDK v6 UIMessageStream response
The response is of type string.
