Skip to main content
The server sends these events to your client. Group them into four categories: PolyAI agent, live agent, handoff, and system.

PolyAI agent events

EVENT_TYPE_POLY_AGENT_JOINED

The PolyAI agent has joined the session. Sent in response to your REQUEST_POLY_AGENT_JOIN.

EVENT_TYPE_POLY_AGENT_THINKING

The agent is composing a response. Show a typing indicator in your UI.

EVENT_TYPE_POLY_AGENT_MESSAGE

A complete message from the agent. Sent when streaming_enabled is false.
If streaming_enabled is true, you receive EVENT_TYPE_POLY_AGENT_MESSAGE_CHUNK events instead. See Streaming.

EVENT_TYPE_POLY_AGENT_LEFT

The agent has left the session (typically before a handoff to a live agent).

EVENT_TYPE_POLY_AGENT_TRIGGERED_HANDOFF

The agent has determined a human should take over. Handoff events follow — see Handoff.

Live agent events

When a conversation is handed off to a human, you receive these events:

EVENT_TYPE_LIVE_AGENT_JOINED

A human agent has connected to the conversation.

EVENT_TYPE_LIVE_AGENT_TYPING

The human agent is typing.

EVENT_TYPE_LIVE_AGENT_MESSAGE

A message from the human agent. Same structure as agent messages, plus an agent_id.

EVENT_TYPE_LIVE_AGENT_LEFT

The human agent has left the session.

Handoff events

These events track the transition from the PolyAI agent to a human agent. See Handoff for the full flow.

EVENT_TYPE_HANDOFF_ACCEPTED

The live agent system accepted the handoff. The user may be placed in a queue.

EVENT_TYPE_HANDOFF_QUEUE_STATUS

Periodic updates while the user is waiting. Show in your UI (e.g. “You are #3 in the queue”).
All fields are optional — not all live agent systems provide queue position data.

EVENT_TYPE_CLIENT_HANDOFF_REQUIRED

The server cannot handle the handoff automatically and needs your client to take action (e.g. redirect to a different channel or open a third-party widget).

EVENT_TYPE_HANDOFF_FAILED

The handoff could not be completed (e.g. the live agent system is unavailable).

EVENT_TYPE_HANDOFF_TIMEOUT

The user waited too long in the queue without being connected.

System events

EVENT_TYPE_SESSION_START

Sent as part of the history replay when the WebSocket connects. Describes session capabilities.

EVENT_TYPE_SESSION_END

The session has ended. After this, no further events will be sent. Close the WebSocket.

EVENT_TYPE_SYSTEM_MESSAGE

A system-level notification — usually an error in response to an invalid event you sent. See Errors for the full catalog.

EVENT_TYPE_LANGUAGE_CHANGED

The PolyAI agent has detected the conversation has switched language. Use this to update your UI locale (for example, swap response suggestion translations, adjust input direction, or relabel controls).
The event is journaled and replayed on reconnect, so your client may receive it more than once. It is idempotent — it carries the absolute language code, not a delta — so just apply the latest value you see.

EVENT_TYPE_EVENT_BATCH

A batch of historical events, sent during connection replay. Contains an array of events in chronological order.
Flatten the events array into your local event list, using sequence for ordering and id for deduplication.

Attachments

Attachments are rich content items in agent or live agent messages — typically links or images.
Last modified on June 12, 2026