Reference
Remy Reference/interface/chat.sendMessage
?

chat.sendMessage

Posts a user turn and streams the agent's reply through named callbacks.
chat.sendMessage(threadId, content, callbacks?, options?) → AbortablePromise<SendMessageResult>

Posts a message to a thread and streams the reply over SSE. The callbacks report each piece of the turn as it arrives: onText for the answer (a delta to append, unlike the method client's accumulated onToken), onThinking for extended thinking, onToolCallStart and onToolCallResult for tool activity, and onEvent for the raw AgentChatEvent when something lower level is needed. It returns an AbortablePromise that resolves with the stop reason and token usage, carries an abort to cancel mid-stream, and takes images or documents through the attachments option.

Parameters
threadId
string
RequiredThe thread to post to.
content
string
RequiredThe user's message text.
callbacks
SendMessageCallbacks
Streaming handlers: onText, onThinking, onThinkingComplete, onToolCallStart, onToolCallResult, onClientToolCall, onError, onEvent, and an AbortSignal.
options
SendMessageOptions
attachments: CDN URLs to attach. Images become vision input; documents have their text extracted into context.
Stream a turn
const res = chat.sendMessage(threadId, text, {
  onText: (delta) => setText((p) => p + delta),      // delta: append, do not replace
  onToolCallStart: (id, name) => showActivity(name),
  onToolCallResult: (id, output) => resolveActivity(id, output),
});
const { stopReason, usage } = await res;
// res.abort() cancels mid-stream