Skip to main content

Overview

CometChatAIAssistantChat is an AI agent chat interface. It renders a full chat experience with streaming responses, suggested message pills, tool calling support, and a conversation history sidebar. Pass a CometChat.User representing the AI assistant and the component handles the rest — message threading, streaming display, and composer integration.
1:1 and group conversations. AI Agents work in both one-on-one and group conversations. In a 1:1 chat, the end user talks directly with the agent user. In a group, the agent participates as a member — its messages (including cards) are delivered and attributed like any other member’s message. If the group contains only one user and one agent, the agent responds automatically. In groups with more than two members, the agent only responds when @mentioned.
Live Preview — interact with the default AI assistant chat.Open in Storybook ↗
The component handles:
  • Streaming AI responses with configurable speed
  • Suggested message pills (from props or user metadata)
  • Tool calling via aiAssistantTools
  • Conversation history sidebar
  • New chat creation
  • Custom header views

Usage

Flat API

With Tool Calling

With Custom Header

Full Layout Example


Actions and Events

Callback Props

Events Emitted

UI events this component publishes:

Events Received

None.

SDK Listeners (Automatic)

None directly — the component uses CometChatMessageList internally which handles SDK listeners for message updates. The AI streaming is handled via CometChat.addAIAssistantListener.

Customization

View Props

Use view props to replace sections of the default UI while keeping the component’s behavior intact:

emptyChatImageView

emptyChatGreetingView

emptyChatIntroMessageView

CSS Styling

Override design tokens on the component selector:

Props

user is required. All other props are optional.

user

The AI assistant user entity. This is the CometChat user that represents the AI agent.

streamingSpeed

Milliseconds between text chunks during streaming display.

aiAssistantTools

Tool handlers for AI function calls. Maps tool names to handler functions.

loadLastAgentConversation

Auto-load the most recent conversation with the AI assistant on mount.

hideSuggestedMessages

Hide the suggestion pills in the empty chat state.

suggestedMessages

Custom suggestion texts displayed as pills in the empty state. Overrides suggestions from user metadata.

emptyChatImageView

Custom image/icon view for the empty chat state.

emptyChatGreetingView

Custom greeting message view for the empty chat state.

emptyChatIntroMessageView

Custom intro message view for the empty chat state.

hideChatHistory

Hide the chat history sidebar button in the header.

hideNewChat

Hide the “New Chat” button in the header.

showBackButton

Show the back button in the header.

showCloseButton

Show the close button in the header.

onBackButtonClicked

Callback when the back button is clicked.

onCloseButtonClicked

Callback when the close button is clicked.

onSendButtonClick

Callback when a message is sent to the AI assistant.

emptyView

Custom empty state view. Replaces the entire default greeting (image + greeting + intro + suggestions).

loadingView

Custom loading view.

errorView

Custom error view.

onError

Callback when an SDK error occurs.

className

Additional CSS class name applied to the root element.

parentMessageId

Load a specific conversation thread by parent message ID.

headerItemView

Custom view that replaces the entire header.

headerTitleView

Custom title view for the header.

headerSubtitleView

Custom subtitle view for the header.

headerLeadingView

Custom leading view (avatar area) for the header.

headerTrailingView

Custom trailing view for the header.

headerAuxiliaryButtonView

Custom auxiliary button view for the header. Replaces the default New Chat + History buttons.

CSS Selectors


Next Steps

Message List

Display messages in a conversation

Message Composer

Compose and send messages

Theming

Customize colors, fonts, and spacing