AI Integration Quick Reference
AI Integration Quick Reference
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.
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
AIAssistantListener - After the run completes, persisted Agentic Messages arrive via
MessageListener
Real-time Events
Events arrive viaonAIAssistantEventReceived in this order:
Run Start and Run Finished are always emitted. Tool Call events only appear when tools are invoked — there can be multiple tool call cycles in a single run. Text Message events are always emitted and carry the assistant’s reply incrementally.Event Object Properties
Every event is anAIAssistantBaseEvent with these common properties:
Some events carry additional data:
- Dart
Event descriptions
- Run Start: A new run has begun for the user’s message.
- Tool Call Start: The agent decided to invoke a tool.
- Tool Call Arguments: Arguments being passed to the tool.
- Tool Call End: Tool execution completed.
- Tool Call Result: Tool’s output is available.
- Text Message Start: The agent started composing a reply.
- Text Message Content: Streaming content chunks for progressive rendering.
- Text Message End: The agent reply is complete.
- Run Finished: The run is finalized; persisted messages will follow.
Agentic Messages
After the run completes, these messages arrive viaMessageListener:
Each message type extends
BaseMessage and has a typed data accessor:
The
toolCalls on AIToolArgumentMessage returns a list of AIToolCall objects, each with:
- Dart
Next Steps
AI Chatbots
Configure and deploy AI chatbots for automated conversations
AI Moderation
Implement AI-powered content moderation for your chat
AI User Copilot
AI-powered features like smart replies and conversation summaries
Send Messages
Send text messages that trigger AI Agent responses