AI Assistants
This feature is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.
Feature Metadata
| Field | Value |
|---|---|
| Feature | AI Assistants |
| Type | In-product AI conversation and guidance |
| Public endpoint count | 4 |
| Last updated | 2026-10-07 |
Overview
AI Assistants provides conversational help inside Countly features.
It supports conversation threads, streaming assistant responses, and answer feedback.
Each thread belongs to the member who created it and is tied to an app. Threads and their messages are stored in the server's ClickHouse database.
Quick Links
| Endpoint | Path |
|---|---|
| AI Assistants - Load Thread | /o/ai-assistants/load-thread |
| AI Assistants - Create Thread | /i/ai-assistants/create-thread |
| AI Assistants - Feedback | /i/ai-assistants/feedback |
| AI Assistants - Send Message | /i/ai-assistants/send-message |
Returned Data Fields
Thread Endpoints (load-thread, create-thread)
Both endpoints return a thread object. Its shape depends on whether the thread was just created or already existed.
| Field | Type | Description |
|---|---|---|
thread (new thread) | Object | id, title, resourceId (member ID), createdAt, updatedAt, metadata.appId |
thread (existing thread) | Object | _id, memberId, appId, messages |
Feedback Endpoint (feedback)
| Field | Type | Description |
|---|---|---|
ok | Number | Success flag (1) |
tracked | Boolean | true when the feedback was forwarded to Countly; false when it was not forwarded |
Streaming Endpoint (send-message)
| Event/Payload | Description |
|---|---|
event: user | Echo of the user message |
event: start | Stream started with assistant message metadata (_id, role, createdOn) |
event: message (data: {"type":"token","content":"..."}) | Incremental generated text |
event: provisional, event: verifying, event: progress (label) | Status updates during the run |
event: done | Final complete assistant message payload |
event: error | Stream-time error payload |
event: cancel | Cancellation notification |
Configuration & Settings
AI Assistants feature config (ai-assistants)
useGateway: Route requests through the Countly AI gateway (defaulttrue; whenfalse,send-messagereturns HTTP 503)gatewayUrl: Gateway URL. Leave empty to use the default Countly AI gateway. TheAI_GATEWAY_URLenvironment variable, when set, takes precedence.gatewayApiKey: Gateway API key. On servers with a license, the key is provisioned from the license automatically when a message is sent.model: Model ID (defaultgoogle/gemini-3.1-flash-lite)drillAgentEnabled: Enable Drill agent (also enables Drill insights)cohortAgentEnabled: Enable Cohort agentfunnelAgentEnabled: Enable Funnel agentjourneyAgentEnabled: Enable Journey agent
Security config (security)
api_additional_headers: Custom headers (oneName: Valuepair per line) added to thesend-messageSSE response headers. Lines without a colon or with an invalid header name are skipped.
Workflows
1. Start or Resume a Conversation
- Call
load-threadwithapp_id(and a storedthreadId, if you have one) to load the thread or get a new one. - Call
create-threadto start a fresh thread. - Use
send-messagefor assistant responses over SSE.
2. Stream a Response
- Send the prompt using
send-message. - Read token chunks in the SSE stream.
- Consume the
doneevent with the final assistant message object.
3. Send Feedback
- Take the assistant message
_idfrom the stream'sstartordoneevent. This is thepromptId. - Call
feedbackwiththreadId,promptIdand athumbs_uporthumbs_downrating.
Feedback is not stored on your Countly server. It is forwarded to Countly to help improve the product, including the optional comment text. If the server has no public domain configured, feedback is not forwarded and the response contains tracked: false.
Limitations
send-messagerequiresuseGatewayenabled and a gateway API key (provisioned from an active license).- Thread storage requires ClickHouse connection settings (
clickhouse.url,clickhouse.username,clickhouse.password) inapi/config.js. - Agents use recent messages of the thread as context.
- Agent availability depends on enabled feature toggles.
Related Features
Implementation details
Database Collections
| Collection | Purpose |
|---|---|
| ClickHouse thread and message store | Stores threads and message history |
countly.apps | Read to check that the thread's app exists |
countly.plugins | Stores the provisioned gateway API key; the license is read from it |
countly_drill.drill_meta | Metadata source used by assistant agents/tools |