AI Integration Quick Reference
AI Integration Quick Reference
| Feature | Description |
|---|---|
| AI Agents | Intelligent automated conversations with real-time streaming |
| AI Moderation | Automatic content moderation with pending/approved/disapproved flow |
| AI User Copilot | Smart Replies, Conversation Starter, Conversation Summary (Dashboard-enabled) |
CometChat.init() + CometChat.login() completed, AI features enabled in Dashboard
Event flow: Run Start -> Tool Call(s) -> Text Message Stream -> Run FinishedAgents only respond to text messages.
Sending a Message to an AI Agent
Send a text message to an agent’s UID like any other user:- Swift
Agent Run Lifecycle and Message Flow
When a user sends a text message to an Agent:- The platform starts a run and streams real-time events via
AIAssistantEventsDelegate - After the run completes, persisted Agentic Messages arrive via
CometChatMessageDelegate
Real-time Events
Events are received viaonAIAssistantEventReceived as AIAssistantBaseEvent objects, in this order:
| Order | Event | Description |
|---|---|---|
| 1 | Run Start | A new run has begun |
| 2 | Tool Call Start | Agent decided to invoke a tool |
| 3 | Tool Call Arguments | Arguments being passed to the tool |
| 4 | Tool Call End | Tool execution completed |
| 5 | Tool Call Result | Tool’s output is available |
| 6 | Text Message Start | Agent started composing a reply |
| 7 | Text Message Content | Streaming content chunks (multiple) |
| 8 | Text Message End | Agent reply is complete |
| 9 | Run Finished | Run finalized; persisted messages follow |
Run Start and Run Finished are always emitted. Tool Call events only appear when tools are invoked. Text Message events are always emitted and carry the assistant’s reply incrementally.- Swift
Agentic Messages
After the run completes, these messages arrive viaCometChatMessageDelegate:
| Message Type | Description |
|---|---|
AIAssistantMessage | The full assistant reply |
AIToolResultMessage | The final output of a tool call |
AIToolArgumentMessage | The arguments passed to a tool |
- Swift
Next Steps
AI Chatbots
Set up AI-powered chatbots for automated conversations
AI Moderation
Automatically moderate messages with AI
AI User Copilot
AI-powered features like smart replies and conversation summaries
Send Messages
Send text messages that trigger AI Agent responses