Quick Reference for AI Agents & Developers
- Key components:
AIAssistantChatViewController,CometChatAIAssistantChatHistory - Import:
import CometChatUIKitSwift - Related: AI Features · AI Assistant Chat History · Guide Overview
- AI Assistant Chat History
- Chat History Management
- Contextual Responses
- Agent Detection
- Seamless Handoffs
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
- CometChat UIKit for iOS installed via CocoaPods or Swift Package Manager
- CometChat initialized with
App ID,Region, andAuth Key - Message chat enabled in your CometChat app
- Navigation set up between message and user/group screens
- Internet permissions
Components
| Component/Class | Role |
|---|---|
CometChatMessageHeader | Manages message interactions and state |
CometChatMessageList | Displays a list of messages |
CometChatMessageComposer | Composes and sends new messages |
CometChatAIAssistantChatHistory | Displays previous AI conversation history |
Integration Steps
Step 1 - Screen Setup
Create a screen for AI Assistant chat usingCometChatMessageHeader, CometChatMessageList, and CometChatMessageComposer.
- Swift
Step 2 - Chat History Screen
Create a screen for AI Assistant chat history usingCometChatAIAssistantChatHistory.
Features Implemented:
- Browse their previous AI chat sessions.
- Resume a previous conversation (onMessageClicked).
- Start a new chat session (onNewChatButtonClicked).
- Close the chat history view (onClose).
Step 3 - Custom Styles
Define custom styles for AI chat bubbles and the composer usingCometChatAiAssistantBubbleStyle.
- swift
Implementation Flow Summary
| Step | Action |
|---|---|
| 1 | User selects AI agent from chat list |
| 2 | AIAssistantChatViewController launches |
| 3 | Parse User data and detect agent chat (Role 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 using
emptyStateView. - Streaming Speed: Adjust AI response streaming speed with
streamingSpeed. - AI Assistant Suggested Messages: Set quick prompts using
suggestedMessages. - AI Assistant Tools: Set AI agent tools using
setAiAssistantToolscallback.
Feature Matrix
| Feature | Implementation | UI Component |
|---|---|---|
| AI Chat | AIAssistantChatViewController | Full chat screen |
| Chat History | CometChatAIAssistantChatHistory | Chat history screen |