AI SDK v6 Protocol
Endpoints
POST /v1/ai-sdk/agents/:agent_id/runsGET /v1/ai-sdk/agents/:agent_id/chats/:chat_id/stream(legacy:/runs/:chat_id/stream)GET /v1/ai-sdk/threads/:id/messages
Request Model (POST /runs)
AI SDK v6 HTTP uses id/messages.
id(required): thread idmessages(required): UI messages arrayparentThreadId(optional)trigger(optional):submit-messageorregenerate-messagemessageId(required whentrigger=regenerate-message)
Example (normal submit):
{
"id": "thread-1",
"runId": "run-1",
"messages": [
{ "id": "u1", "role": "user", "content": "Summarize latest messages" }
]
}
Example (regenerate):
{
"id": "thread-1",
"trigger": "regenerate-message",
"messageId": "m_assistant_1"
}
Legacy shape (sessionId + input) is rejected for HTTP v6 UI transport.
Decision Forwarding
Decision-only submissions are extracted from assistant message parts (for example tool-approval-response).
If there is no user input and decisions are present, server first tries to forward decisions to an active run keyed by:
- protocol:
ai_sdk agent_id- thread id (
id) runId
Success response:
{
"status": "decision_forwarded",
"threadId": "thread-1"
}
If no active run is found, request falls back to normal run execution path.
Response Transport
Headers:
content-type: text/event-streamx-vercel-ai-ui-message-stream: v1x-tirea-ai-sdk-version: v6
Stream semantics:
- SSE frames contain AI SDK UI stream events (
start,text-*,finish,data-*, …) - server appends
data: [DONE]trailer
Tool progress is emitted as data-activity-snapshot (activityType = tool-call-progress).
Resume Stream
GET /v1/ai-sdk/agents/:agent_id/chats/:chat_id/stream (legacy: /runs/:chat_id/stream)
204 No Contentif no active fanout stream exists foragent_id:chat_id200SSE stream when active
History Endpoint
GET /v1/ai-sdk/threads/:id/messages
Returns AI SDK-encoded message history for thread hydration/replay.
Validation and Errors
- empty
id->400(id cannot be empty) - no user input and no suspension decisions and not regenerate ->
400 - regenerate without
messageId->400 - regenerate with empty
messageId->400 - unknown
agent_id->404
Error body:
{ "error": "bad request: request must include user input or suspension decisions" }