Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.kaireonai.com/llms.txt

Use this file to discover all available pages before exploring further.

Overview

KaireonAI includes a built-in AI assistant accessible from every page in the platform. Open it by clicking the AI icon in the top navigation bar, or press Cmd+I (macOS) / Ctrl+I (Windows/Linux). The assistant can:
  • Query any entity — “Show me all active offers in the cross-sell category”
  • Analyze your setup — “Why didn’t customer C-1234 receive the home loan offer?”
  • Build new entities — “Create a qualification rule targeting customers with balance over $10,000”
  • Build V2 pipelines — “Create a V2 decision flow with diversity ranking and formula scoring”
  • Simulate changes — “What would happen if I lowered the email frequency cap to 2 per week?”
  • Generate content — “Write email copy for the premium card offer in an urgent tone”
  • Diagnose models — “Analyze model health and detect drift for my propensity model”
  • Search documentation — “How do I set up a contact policy?”

Architecture

The AI assistant is built on the Vercel AI SDK and uses a three-layer architecture:
  1. Context Router — Inspects the current page route and selects the appropriate system prompt and tool subset. This keeps the LLM focused on the user’s current task.
  2. Tool Layer — 84 tools organized across 11 categories that call internal API routes on behalf of the user. Every tool output is PII-sanitized before reaching the LLM. Tool calling has been verified with Google Gemini.
  3. Provider Layer — Supports 6 LLM providers (Google, Anthropic, OpenAI, Amazon Bedrock, Ollama, LM Studio) with per-tenant configuration stored in the database.

84 Tools

The assistant is powered by 84 tools organized across 11 tool categories:
CategoryToolsCount
DatalistSchemas, getSchemaFields, addSchemaField, listPipelines, listTransformTypes, listConnectors, createSchema, createConnector, createFlowPipeline, updateFlowPipeline10
StudiolistDecisionFlows, listOffers, listChannels, listContactPolicies, createOffer, createDecisionFlow, createChannel, createTreatment, createCategory, createGuardrail, createContactPolicy, createTrigger, createOutcomeType, testConnector, createQualificationRule, createContactPolicyRule16
V2 PipelinelistV2NodeTypes, listScoringMethods, listRankMethods, listGroupAllocationStrategies, createV2DecisionFlow, getDecisionFlowConfig, addV2PipelineNode, removeV2PipelineNode, updateV2PipelineNodeConfig9
AlgorithmslistModels, trainModel, listExperiments, createExperiment, getModelDetails, addPredictor, removePredictor, updateModelConfig8
DashboardsqueryMetric, listAlerts2
Content GenerationgenerateCreativeCopy, generateSubjectLines2
CMSlist_content_items, get_content_item, create_content_item, update_content_item, publish_content_item, generate_content_variants, list_content_sources, sync_content_source8
DocssearchDocs1
Behavioral MetricslistBehavioralMetrics, createBehavioralMetric, previewMetricValues, computeMetricNow, createMetricRule5
MutationsupdateOffer, updateDecisionFlow, updateChannel, updateContactPolicy, updateQualificationRule, deleteEntity, publishDecisionFlow, confirmMutation8
IntelligenceexplainDecision, traceCustomerJourney, compareOfferEligibility, listCustomerSuppressions, analyzeQualificationFunnel, analyzeContactPolicySuppression, analyzePolicyConflicts, analyzeOfferPerformance, simulateRuleChange, simulateFrequencyCapChange, analyzeModelHealth, explainModelScoring, suggestModelImprovements, detectModelDrift, runHealthCheck15

Read Tools (available everywhere)

These 18 tools are available in every context, giving the assistant cross-module visibility regardless of which page you are on: listSchemas, listPipelines, listConnectors, listTransformTypes, listDecisionFlows, listOffers, listChannels, listContactPolicies, listModels, listExperiments, queryMetric, listAlerts, searchDocs, listBehavioralMetrics, listV2NodeTypes, listScoringMethods, listRankMethods, listGroupAllocationStrategies

Write Tools (context-specific)

Creation and mutation tools are added based on the current page context. For example, when on the Decision Flows page, you get the full V2 pipeline toolset plus mutation tools. When on the Algorithms page, you get model management and training tools.

Intelligence Tools

Deep analysis tools that provide explainability, diagnostics, and simulation:
ToolWhat It Does
explainDecisionFull decision funnel walkthrough: inventory, qualification, contact policy, scoring, ranking. Shows why a customer received or did not receive a specific offer.
traceCustomerJourneyTimeline of a customer’s interactions: offers shown, channels used, outcomes recorded, journey enrollments, experiment assignments.
compareOfferEligibilitySide-by-side comparison of 2-5 offers for a customer: which rules pass/fail, which policies block, and the resulting scores.
listCustomerSuppressionsAll active contact policy suppressions affecting a customer: which rules are blocking, on which channels, and expiration.
analyzeQualificationFunnelDecision funnel analysis identifying the biggest bottleneck rule and suggesting improvements.
analyzeContactPolicySuppressionSuppression rate analysis by rule type and channel with recommendations for over-aggressive policies.
analyzePolicyConflictsCross-entity conflict detection: contradictions, overlaps, and misconfigurations across offers, rules, policies, and experiments.
analyzeOfferPerformanceOffer performance analysis: impressions, conversions, conversion rate, revenue, and trends. Identifies top/bottom performers.
simulateRuleChangeBefore/after impact simulation for qualification rule or contact policy changes. Shows reach estimates and impact direction.
simulateFrequencyCapChangeFrequency cap impact simulation: customers unlocked/suppressed, fatigue risk level.
analyzeModelHealthML model health check: AUC, precision, recall, performance trend, feature importance, data freshness, overall verdict.
explainModelScoringScore explanation for a specific customer: raw score, estimated percentile, top contributing features with direction.
suggestModelImprovementsModel improvement recommendations: missing predictors, model type vs data volume, unused features, hyperparameter tuning.
detectModelDriftDrift detection: compare recent scoring distribution against training-time metrics, check calibration, recommend action (retrain/monitor/no action).
runHealthCheckComprehensive tenant health check: model health, policy conflicts, budget burn, suppression rates, stale entities, experiment status. Results cached for 5 minutes.

Context-Aware Routing

The assistant adapts its system prompt and available tools based on which page you are on. This keeps the LLM focused on your current task while always providing read-only cross-module visibility.
Page RouteModuleAdditional Tools
/data/schemasDataaddSchemaField, getSchemaFields, createSchema
/data/flow-pipelinesDatacreateFlowPipeline, updateFlowPipeline, getSchemaFields
/data/*DatacreateConnector, testConnector
/studio/behavioral-metricsStudiocreateBehavioralMetric, previewMetricValues, computeMetricNow, createMetricRule
/studio/customer-viewerStudioexplainDecision, traceCustomerJourney, compareOfferEligibility, listCustomerSuppressions
/studio/decision-flowsStudioFull creation + mutation + V2 pipeline + intelligence tools (30+ additional)
/studio/treatmentsStudioCreation tools + generateCreativeCopy, generateSubjectLines + all 8 CMS tools
/studio/qualification-rulesStudiocreateQualificationRule, updateQualificationRule, deleteEntity, analyzeQualificationFunnel, simulateRuleChange
/studio/contact-policiesStudiocreateContactPolicy, createContactPolicyRule, updateContactPolicy, deleteEntity, analyzeContactPolicySuppression, simulateFrequencyCapChange, analyzePolicyConflicts
/studio/*StudioFull creation + mutation + metrics + analyzeOfferPerformance
/algorithms/*AlgorithmstrainModel, createExperiment, getModelDetails, addPredictor, removePredictor, updateModelConfig, analyzeModelHealth, explainModelScoring, suggestModelImprovements, detectModelDrift
/dashboards/*DashboardsrunHealthCheck, analyzeOfferPerformance, analyzePolicyConflicts
Any other pageGeneralAll 84 tools

How Routing Works

The context router (getContextForRoute) inspects the pathname and returns:
  1. Module labeldata, studio, algorithms, dashboards, or general
  2. System prompt — A module-specific prompt that tells the LLM what it can do, what terminology to use, and which V2 pipeline features are available
  3. Tool names — The 18 read-only tools plus context-specific write/intelligence tools
  4. Tool objects — The actual tool implementations, with tenantId automatically injected
The general fallback (any page not matching a specific route) provides access to all tools.

V2 Composable Pipeline Support

The assistant fully supports the V2 composable pipeline with 16 node types in 3 phases: Phase 1 — Narrow: inventory, match_creatives, enrich, qualify, contact_policy, filter, conditional, call_flow Phase 2 — Score & Rank: score (3 built-in methods + external endpoints + channel overrides + champion/challenger), optimize (multi-objective portfolio optimization), rank (4 algorithms), group (Hungarian optimal allocation) Phase 3 — Output: compute, set_properties, response Cross-phase: call_flow, extension_point

Scoring Methods

  • priority_weighted — Offer priority (0-100), no ML model needed
  • propensity — ML model propensity score
  • formula — Weighted composite: propensity x 0.4 + context x 0.2 + value x 0.3 + lever x 0.1 (weights must sum to 1.0)
  • Channel overrides — Per-channel scoring method/model/formula
  • Champion/Challenger — A/B test scoring models with traffic split

Ranking Methods

  • topN — Best offers by score
  • diversity — Category round-robin with backfill
  • round_robin — Strict equal category representation
  • explore_exploit — Epsilon-greedy (deterministic per customer via FNV-1a hashing)

Group Allocation

  • optimal — Hungarian (Kuhn-Munkres) algorithm for globally optimal placement assignment, O(n^3)
  • greedy / priority_fill — Fill placements sequentially with highest-scoring candidates

Sub-Flow Invocation

The call_flow node invokes another decision flow on the current candidate set. Max depth: 2 levels. Circular reference guard prevents infinite loops. optional=true (default) means the parent flow continues if the sub-flow errors. passContext=true shares the parent’s candidates. mergeMode=replace replaces parent candidates with sub-flow output.

Guided Autonomy

When the AI assistant needs to create or modify something, it follows a preview -> approve -> execute flow:
  1. Preview — The assistant shows exactly what it plans to create or change in a preview card
  2. Approve or Cancel — You review the details and click Approve or Cancel
  3. Execute — Only after your approval, the change is applied via the confirmMutation tool
Pending mutations expire after 5 minutes if not confirmed.
Read operations and analysis run immediately — no approval needed. Only mutations (create, update, delete, publish) require your confirmation.

Deletable Entity Types

The deleteEntity tool supports: offer, decisionFlow, channel, contactPolicy, qualificationRule, experiment, guardrail, trigger.

Conversation History

Your conversations are automatically saved and can be resumed later:
  • Click the History icon in the AI panel header to see past conversations
  • Click any conversation to resume it — full message history is loaded from the database
  • Start a New conversation to begin fresh
  • Conversations are auto-titled from the first user message
  • Up to 50 recent conversations are shown per tenant
  • Conversations can be deleted via the trash icon or the DELETE /api/v1/ai/conversations/:id endpoint
The assistant includes a hybrid documentation search tool (searchDocs) that combines:
  1. Local knowledge base — Keyword-based search over embedded platform documentation covering all features, fields, workflows, and V2 pipeline details
  2. Mintlify MCP fallback — If the local match score is below threshold (score < 4), the assistant queries the external Mintlify docs at docs.kaireonai.com/mcp for additional context
When you ask “how to” questions or need guidance on platform features, the assistant automatically searches docs before answering.

Content Generation

The assistant can generate marketing content directly:
  • generateCreativeCopy — Generate copy for any channel (email, sms, push, in-app) with configurable tone (professional, friendly, urgent, casual) and max character length
  • generateSubjectLines — Generate 1-5 email subject line variants for an offer
  • generate_content_variants — Generate full content variants for A/B testing with channel-specific fields (subject line, headline, body, CTA) and configurable tone

Example Prompts

Building

  • “Create a new email channel with batch delivery mode”
  • “Set up a cross-sell offer for credit cards targeting premium customers”
  • “Build a V2 Decision Flow that enriches from customer data, qualifies by credit score, scores with formula method, and ranks using diversity”
  • “Create a contact policy with a frequency cap of 3 emails per week”
  • “Generate 3 subject line variants for the home loan offer”
  • “Add a call_flow node to my pipeline that invokes the upsell-flow for secondary scoring”
  • “Create a behavioral metric that counts impressions per offer in the last 30 days”

V2 Pipeline

  • “What scoring methods are available?”
  • “What ranking algorithms can I use?”
  • “Create a V2 flow with explore/exploit ranking at 20% exploration rate”
  • “Update the score node to use propensity with a channel override for email using formula scoring”
  • “Add an enrich node that loads loan_amount and credit_score from the applications schema”
  • “Set up multi-placement with hero banner (1 slot) and sidebar (3 slots) using optimal allocation”

Analyzing

  • “Why didn’t customer C-1234 receive the home loan offer?”
  • “Which offers have declining conversion rates this week?”
  • “Are there any conflicts in my contact policies?”
  • “Explain how the propensity model scores customer C-5678”
  • “Run a health check on the platform”
  • “What are the suppression rates by channel this month?”
  • “Is my propensity model drifting? Should I retrain?”

Simulating

  • “What happens if I change the minimum credit score from 700 to 650?”
  • “How many more customers would I reach if I increase the SMS cap to 5 per week?”
  • “Simulate removing the age qualification rule from the auto loan offer”

Content

  • “Write email copy for the premium card offer in an urgent tone”
  • “Generate 3 push notification variants for the savings offer”
  • “List all content items in draft status”

AI Configuration

Configure the LLM provider in Settings > Integrations > AI / LLM Provider:
ProviderModelsNotes
GoogleGemini 2.5 Flash (default), Gemini 2.5 ProGood balance of speed and quality
AnthropicClaude Sonnet, Claude Haiku, Claude OpusStrong reasoning, best for complex analysis
OpenAIGPT-4o, GPT-4o-miniWidely available
Amazon BedrockAny Bedrock-hosted modelEnterprise, uses IAM or role-based auth
OllamaAny self-hosted modelLocal at localhost:11434, no API costs
LM StudioAny local modelLocal at localhost:1234/v1, no API costs
Configuration sources (in priority order):
  1. Database — Per-tenant settings via Settings > AI Configuration (supports all providers including Bedrock with region, role ARN, inference profiles)
  2. Environment variablesAI_PROVIDER, AI_MODEL, AI_API_KEY, AI_BASE_URL
  3. Defaults — Google Gemini 2.5 Flash
Additional environment variables:
  • AI_SIDEBAR_ENABLED — Enable/disable the AI sidebar
  • AI_RATE_LIMIT_PER_MINUTE — Override the default 30 req/min rate limit

Security

  • Prompt injection defense — User messages are scanned for 7 injection patterns (e.g., “ignore previous instructions”, “you are now”, “system:”, “override instructions”) and matching text is replaced with [filtered]. Messages are truncated to 10,000 characters.
  • PII redaction — All tool outputs are recursively sanitized before the LLM sees them. Patterns detected and redacted: email addresses, SSN, credit card numbers, phone numbers, bank account numbers, AWS ARNs, database connection strings, and long base64 strings. Field names like password, secret, token, apiKey, ssn, creditCard, cvv, pin, privateKey are always redacted.
  • RBAC enforcement — The chat endpoint requires admin, editor, or viewer role. Mutation tools inherit the user’s role for downstream API calls.
  • Rate limiting — 30 requests per minute per user (configurable). Non-fail-open: requests beyond the limit return 429.
  • Tenant scoping — The tenantId is automatically injected into every tool call. The assistant cannot access data from other tenants.
  • Audit logging — Every chat interaction is logged with module, route, message count, and conversation ID.
  • Max tool steps — The LLM is limited to 5 sequential tool calls per message to prevent runaway execution.
  • Request timeout — Chat requests time out after 60 seconds.

Next Steps

AI Insights Dashboard

Central hub for AI-generated recommendations.

AI Configuration

Tune analyzer parameters for your organization.

MCP Server

Connect AI IDEs to KaireonAI via MCP.