Send a message to an agent and receive a response. Supports streaming responses when stream: true is set in the request body.
API key from your account settings
The agent ID
1"5QHA6VB-DIAbBhxwqxfdi"
The user message to send to the agent. Omit to continue the conversation after submitting a tool result.
1"Hello, how can you help me?"
Optional conversation ID to continue an existing conversation. If omitted, a new conversation will be started.
Whether to stream the response as Server-Sent Events (SSE). Defaults to true.
Optional user ID to associate with a new conversation. Only applied when creating a new conversation (no conversationId). Once set, a conversation's userId is immutable — this field is ignored for existing conversations. Must contain only URL-safe characters (letters, digits, hyphens, underscores, dots).
128^[a-zA-Z0-9._-]+$Successful response
Streaming response using the AI SDK UIMessage Stream protocol.
Each SSE event has an event: field with the type and a data: field with JSON content.
AI SDK events:
message-start — { type, messageId } — Start of a new messagetext-start — { type, id } — Start of a text blocktext-delta — { type, id, delta } — Incremental text chunktext-end — { type, id } — End of a text blocktool-input-start — { type, toolCallId, toolName } — Start of tool call inputtool-input-delta — { type, toolCallId, inputTextDelta } — Incremental tool inputtool-input-available — { type, toolCallId, toolName, input } — Complete tool inputtool-output-available — { type, toolCallId, output } — Tool execution resultstart-step — { type } — Start of a processing stepfinish-step — { type } — End of a processing stepfinish — { type } — Stream completeerror — { type, errorText } — Error occurredChatbase metadata (emitted as message-metadata on the finish event):
The schema below describes the custom metadata attached to the finish event. Use conversationId for follow-up messages.
Stream terminates with data: [DONE].
Unique ID of the assistant message
The ID of the user message that triggered this response. For continuation responses, this is the last user message in the conversation.
The conversation ID. Use this for follow-up messages.
The user ID associated with this conversation, or null if none
Usage information for this request