Skip to main content
Start from Send a first message. This page covers the timeline after that first bubble. messages is the ordered timeline. Each message has role (user or assistant) and parts. A part is one block in the message, such as text or thinking. See useWebChat for the full type list.

State

Use these fields to drive the composer, spinner, and error banner:

Errors

error is the last failure from load, send, retry, or action. Show error.message. sendMessage, respondToAction, sendAction, and retryMessage do not throw. A try/catch around them does not run. Wait for the result and read error on that call:
When the organization is over a plan limit, error is a WebChatPlanLimitError. The HTTP status is 402. Read reason (agents, channels, or conversations) and show message.

Text

Start with type === 'text'. That is the visible body of the row.

Thinking

isRunning is true for the whole agent turn. typing is present only while the agent types. Assistant messages can also include thinking parts before text arrives. run is an alias for the same snapshot: isRunning is run.isRunning, and typing is run.typing. Show a status line while the turn runs:
Then render thinking parts next to text:
The first event of a turn can create an empty assistant message before any text arrives. Keep that row in the list. Then fill it as parts arrive.