Quick Reference
Quick Reference
| Field | Value |
|---|---|
| Packages | com.cometchat:chatuikit-kotlin-android · com.cometchat:chatuikit-compose-android |
| Key components | CometChatAIAssistantChatHistory, CometChatMessageList, CometChatMessageComposer, CometChatMessageHeader |
| Purpose | Enable AI-powered conversational assistance with chat history, contextual responses, and seamless handoffs. |
| Related | AI Assistant Chat History, AI Features, All Guides |
- AI Assistant Chat History
- Chat History Management
- Contextual Responses
- Agent Detection
- Seamless Handoffs
1:1 conversations only. AI Agents currently respond only in one-on-one conversations between an end user and the agent user. They do not respond to messages sent in groups, even if the agent user is added as a member or owner. Group support is on the roadmap — share your use case on feedback.cometchat.com.
Overview
Users can interact with AI agents through a dedicated chat interface that:- Provides intelligent responses based on conversation context.
- Maintains chat history for continuity.
- Seamlessly integrates with your existing user chat system.

Prerequisites
- Android Studio project with
com.cometchat:chatuikit-kotlin-androidorcom.cometchat:chatuikit-compose-androidinbuild.gradle. - Internet permission in
AndroidManifest.xml. - Valid CometChat App ID, Region, and Auth Key configured via
UIKitSettings. - User logged in with
CometChatUIKit.login(). - AI Agent configured in your CometChat dashboard.
Components
| Component / Class | Role |
|---|---|
AIAssistantChatActivity | Main activity for AI agent chat. |
CometChatAIAssistantChatHistory | Displays previous AI conversation history. |
CometChatMessageList | Shows AI messages with threading support. |
CometChatMessageComposer | Input interface for AI conversations. |
CometChatMessageHeader | Header with AI agent info and controls. |
Integration Steps
Step 1 — Activity / Screen Setup
Create the AI Assistant chat screen with proper layout configuration.- Kotlin (XML Views)
- Jetpack Compose
AIAssistantChatActivity.kt
AIAssistantChatActivity.kt
Step 2 — Layout (XML Views only)
AddCometChatMessageHeader, CometChatMessageList, and CometChatMessageComposer to your layout.
activity_ai_assistant_chat.xml
Note: In Jetpack Compose, layout is handled declaratively in the composable function — no XML needed.
Step 3 — Style of Message List & Composer (XML Views only)
Define custom styles for the message list and composer to differentiate AI agent chats.themes.xml
Jetpack Compose: Pass a custom style object via the style parameter on each composable instead of XML styles.
Step 4 — Initialize click listeners
Initialize click listeners to handle new chat creation and chat history access.- Kotlin (XML Views)
- Jetpack Compose
AIAssistantChatActivity.kt
Step 5 — AI Assistant Chat History screen
Create a screen to host theCometChatAIAssistantChatHistory component.
- Kotlin (XML Views)
- Jetpack Compose
AIAssistantChatHistoryActivity.kt
Step 6 — Chat History layout (XML Views only)
activity_ai_assistant_chat_history.xml
Note: In Jetpack Compose, the CometChatAIAssistantChatHistory composable is used directly — no XML layout needed.
Step 7 — Launching AI Chat
- Kotlin (XML Views)
- Jetpack Compose
Implementation Flow Summary
| Step | Action |
|---|---|
| 1 | User selects AI agent from chat list |
| 2 | AI chat screen launches |
| 3 | Parse intent data and detect agent chat (Role of user must be “@agentic”) |
| 4 | Initialize UI with AI-specific styling |
| 5 | Configure chat history and navigation |
| 6 | Launch chat with AI agent |
Customization Options
- Custom AI Assistant Empty Chat View: Customize the empty state view using
setAIAssistantEmptyChatGreetingView()(XML Views) or theemptyViewcomposable slot (Compose). - Streaming Speed: Adjust AI response streaming speed via
setStreamingSpeed(). - AI Assistant Suggested Messages: Create custom list of suggested messages using
setAIAssistantSuggestedMessages(). - AI Assistant Tools: Set tools for the AI agent using
setAIAssistantTools().
Feature Matrix
| Feature | Kotlin (XML Views) | Jetpack Compose |
|---|---|---|
| AI Chat Interface | AIAssistantChatActivity | AIAssistantChatScreen composable |
| Chat History | CometChatAIAssistantChatHistory XML | CometChatAIAssistantChatHistory() composable |
| Message List | CometChatMessageList XML | CometChatMessageList() composable |
| Message Composer | CometChatMessageComposer XML | CometChatMessageComposer() composable |
Android AI Builder Sample
Explore this feature in the CometChat AI Builder:
GitHub → AI Builder
Android Sample App (Kotlin)
Explore this feature in the CometChat SampleApp:
GitHub → SampleApp