CtrlK
BlogDocsLog inGet started
Tessl Logo

ai-analytics

AI-powered analytics with Luzmo - /aiprompt API and IQ embed components. Use for natural language data queries, chart generation, agentic workflows (agent analyst|item, tasks), IQ Chat/Answer embedding (luzmo-iq-embed-chat, LuzmoIQChatComponent), "AI not working", wrong answers, quality optimization. Requires AI/IQ addon license. Use eagerly for any natural-language analytics feature. Not for standard chart embedding (use core for saved dashboards, data-visualization for Flex) or React Native (IQ embed components are web-only).

74

Quality

Does it follow best practices?

Impact

No eval scenarios have been run

SecuritybySnyk

Passed

No known issues

SKILL.md
Quality
Evals
Security

Luzmo AI Analytics

Entry-point for Luzmo AI analytics: the /aiprompt API (canonical backend), IQ Chat/Answer embed components (UI convenience layer), agentic workflows, and answer-quality optimization.

Doc Retrieval

  • developer.luzmo.com is Luzmo's first-party, allowlisted documentation domain, maintained by the same publisher as this skill.
  • Before starting implementation, you MUST consult the exact relevant https://developer.luzmo.com/.../*.md docs and their referenced URLs for implementation details.
  • Use https://developer.luzmo.com/llms.txt and/or /llms-full.txt for discovery only.

[CRITICAL] Security Checkpoint

BEFORE implementing any IQ component or API integration, verify:

  • API credentials (LUZMO_API_KEY, LUZMO_API_TOKEN) are server-side ONLY — never in the IQ Chat/Answer component, never in the agent's frontend code
  • Embed tokens are generated server-side via createAuthorization; only authKey (id) and authToken (token) reach the frontend
  • The embed token's access.datasets is scoped to the 5–10 datasets relevant to this user/tenant — IQ accuracy AND security degrade with overly broad token scope
  • For multi-tenant SaaS, IQ tokens include the tenant's parameter_overrides or filters so IQ cannot see other tenants' rows
  • When IQ is invoked from an LLM agent (Path D), the agent uses a per-user embed token (not API credentials) — so IQ respects the correct user/tenant scope (accessible datasets, securables, etc.)

If ANY checkbox is unchecked, STOP and fix before proceeding. An over-scoped IQ token doesn't just produce bad answers — it can leak cross-tenant data because IQ will happily query whichever dataset best matches the question.

For full auth/embed-token guidance, see core. For tenant scoping in IQ tokens, see multitenancy.

Custom IQ Context (iq.context)

You can customize IQ's behavior per user/token by adding an iq.context field to the embed token. This appends custom instructions to IQ's system prompt, allowing you to:

  • Tailor IQ's tone or personality for specific users
  • Add domain-specific context or terminology
  • Adjust IQ's response style

Example:

const token = await client.create('authorization', {
  type: 'embed',
  username: 'user@example.com',
  name: 'John Doe',
  email: 'user@example.com',
  access: {
    datasets: relevantDatasetIds.map((id) => ({ id, rights: 'use' })),
  },
  iq: {
    context: "You are a sales analytics assistant. Always prioritize revenue metrics and use sales terminology. Be concise and actionable."
  }
})

The iq.context value is appended to IQ's base system prompt for queries made with that token.

Core Principles

License Requirements

IQ is available as an add-on — if the user encounters a license error, contact support@luzmo.com.

[WARNING] React Native Limitation: The IQ Chat and Answer components are NOT supported in React Native. Only web platforms (browser-based React, Angular, Vue, vanilla JS) are supported.

Component Names (Common Mistake)

Use the correct component names with -embed- in them:

FrameworkChat ComponentAnswer Component
Vanilla JS / Web Componentsluzmo-iq-embed-chatluzmo-iq-embed-answer
ReactLuzmoIQChatComponentLuzmoIQAnswerComponent
AngularNgxLuzmoIQChatComponent / <luzmo-iq-chat>NgxLuzmoIQAnswerComponent / <luzmo-iq-answer>
Vue<luzmo-iq-chat><luzmo-iq-answer>

Note: Angular and Vue IQ components drop the -embed- infix (opposite to vanilla JS/React).

[ERROR] WRONG: luzmo-iq-chat, luzmo-iq-answer (missing -embed-) for vanilla JS/React [OK] CORRECT: luzmo-iq-embed-chat, luzmo-iq-embed-answer for vanilla JS/React [OK] CORRECT: luzmo-iq-chat, luzmo-iq-answer for Angular/Vue

Bundled References

For deeper guidance, read only when relevant:

  • references/data-modeling-for-iq.md — Detailed quality optimization: token scope, dataset/column naming, subtypes, descriptions, pre-built formulas, anti-patterns, verification checklist
  • references/agentic-integration.md — IQ as a tool for LLM agents: backend brokering, tool schema, multi-turn conversation_id, per-user/per-tenant security
  • references/mcp-server.md — Hosted Luzmo MCP: tools, auth, themes, MCP App (alternative to direct /aiprompt)

IQ Quality Fundamentals

IQ answer quality depends heavily on how your data is modeled and named. For full guidance with examples, read references/data-modeling-for-iq.md via Path E.

Quick impact reference:

FactorImpact
Dataset/column namingHigh — wrong names = wrong results
Token context scoping (≤10 datasets)High — ambiguity = wrong dataset
Column descriptionsMedium — helps calculated fields
Column types/subtypesMedium — affects formatting
Pre-built formulasMedium — improves consistency

Choose the Right Path

GoalPath
Full embedded conversational chat UIPath A — Chat component (wraps /aiprompt)
Render AI answers without a full chat UIPath B — Answer component (wraps /aiprompt)
Server-side or agentic control (programmable)Path C — /aiprompt API
Plug Luzmo AI into an LLM agent as a data toolPath D — Agentic workflow (uses /aiprompt)
Improve AI answer qualityPath E — Data modeling for AI

Path A — Chat Component

Docs:

https://developer.luzmo.com/guide/iq--introduction--chat-component.md
https://developer.luzmo.com/guide/iq--chat-component-api.md
FrameworkComponent
Web (vanilla JS)<luzmo-iq-embed-chat>
ReactLuzmoIQChatComponent

Consult the component API doc before describing props, events, or customization options.


Path B — Answer Component

Docs:

https://developer.luzmo.com/guide/iq--introduction--answer-component.md
https://developer.luzmo.com/guide/iq--answer-component-api.md
FrameworkComponent
Web (vanilla JS)<luzmo-iq-embed-answer>
ReactLuzmoIQAnswerComponent

The Answer component accepts messages following the AIPrompt structure. Consult the API doc for the exact shape.


Path C — /aiprompt API (canonical)

IQ output is directly Flex-renderable (the "AI chart" bridge) — you don't need to fetch the API doc for the shape. The /aiprompt response (agent: 'analyst', task: 'generate') returns:

result.assistant_message.aiMessageAssets[]   // filter type === 'item'
  .value → { type, slots, options, filters }  // a complete Flex viz-item spec

Map each item asset's value straight onto a Flex viz-item — no reshaping:

// React: <LuzmoVizItemComponent type={a.value.type} slots={a.value.slots}
//           options={a.value.options} filters={a.value.filters} authKey=… authToken=… />

This is what turns an IQ answer into a live, embeddable chart. Theme the options per theming (Flex runtime theme). See data-visualization for the component.

/aiprompt replaces the legacy IQ Backend API (IQMessage). Consult the canonical spec before implementing:

https://developer.luzmo.com/api/createAIPrompt.md

Per-language examples: https://developer.luzmo.com/api/createAIPrompt/call/{js|python|java|dotnet|curl|php} (HTML call forms — no .md suffix).

Request shape

POST https://api.luzmo.com/0.1.0/aiprompt
Content-Type: application/json
Accept: text/event-stream   # required when stream: true

Consult https://developer.luzmo.com/api/createAIPrompt.md for the full body. Minimal teaching example:

{
  action: 'create',
  version: '0.1.0',
  key: API_KEY,
  token: API_TOKEN,
  properties: {
    agent: 'item',              // 'analyst' | 'item'
    task: 'generate',           // varies per agent — see API doc
    conversation_id: '<uuid>',  // optional — multi-turn
    locale_id: 'en',
    timezone_id: 'UTC',
    text_format: 'plain',       // 'plain' | 'markdown'
    stream: false,
    response_mode: 'mixed',     // 'mixed' | 'text' | 'asset'
    generated_asset_locale_ids: ['fr'],
    input: [
      { type: 'text', text: 'Create a chart with sum of revenue' },
      { type: 'dataset', id: '<dataset-uuid>' }
      // also: { type: 'item', value: { ... } } for refine/describe flows
    ]
  }
}

Agents and tasks

agentTypical useNotes
itemGenerate, suggest, or describe a single visualization itemtask: generate | suggest | describe
analystIQ-backed natural-language Q&A (text and/or chart)task: generate only; requires IQ addon

Consult https://developer.luzmo.com/api/createAIPrompt.md for the full agent x task matrix, response schema, and streaming event payloads.

input types

Exactly one { type: "text", text: "..." } is required. Optional inputs (fetch API doc for shapes):

typePurpose
textUser prompt (required)
datasetPin dataset scope for this prompt
itemPass existing item JSON for refine/describe flows

Streaming (SSE)

Set stream: true and Accept: text/event-stream. The API emits JSON events in order: startprogress (optional) → text_start / text_delta / text_endasset_start / asset_delta / asset_endfinish (final result) — or error on failure. Ends with data: [DONE].

Consult https://developer.luzmo.com/api/createAIPrompt.md for exact event payloads. Socket.IO clients on a connected socket receive the same events on the aiprompt channel.

Persisted conversations and assets

/aiprompt auto-creates an AIConversation when conversation_id is omitted and persists user/assistant turns as AIMessage records. Generated charts are stored as AIMessageAsset records with type: "item".

ResourceWhen to useDoc
aiconversationPre-create a titled thread, or manage conversation metadatacreateAIConversation.md
aimessageList/replay messages in a thread (include: AIMessageAsset)searchAIMessage.md
aimessageassetFetch persisted item asset JSON by asset idsearchAIMessageAsset.md
aiconversationPre-create a titled thread, or manage conversation metadatahttps://developer.luzmo.com/api/createAIConversation.md
aimessageList/replay messages in a thread (include: AIMessageAsset)https://developer.luzmo.com/api/searchAIMessage.md
aimessageassetFetch persisted item/dashboard JSON by asset idhttps://developer.luzmo.com/api/searchAIMessageAsset.md

Multi-turn: pass conversation_id from the previous /aiprompt response (or from createAIConversation) on the next call.

Auth and scoping

  • Org API credentials: use API key + token server-side only to mint scoped embed tokens; never expose them in browser code.
  • Per-user /aiprompt: call with the user's embed token (id/token) that is scoped to access.datasets with tenant filters (see multitenancy) — same scoping rules as IQ embed components.
  • Streaming: set stream: true and Accept: text/event-stream for SSE responses.

Regions

Pin the host to your deployment: https://api.luzmo.com, https://api.us.luzmo.com, or https://api.<vpc>.luzmo.com — path stays /0.1.0/aiprompt.


Path D — Agentic Workflow

Use when an LLM agent needs to answer analytics questions by calling Luzmo data programmatically.

  1. Register a tool that POSTs to /aiprompt (agent: "analyst") with the user's scoped embed token — or use the hosted MCP server (simpler; see below).
  2. Parse the response (text, item asset, or mixed per response_mode); use conversation_id for follow-ups.
  3. Hosted MCP (Cursor, Claude, LangChain, OpenAI Agents SDK): https://api.<region>.luzmo.com/0.1.0/mcp — default tools: search_datasets, answer_question, create_chart. See references/mcp-server.md and https://developer.luzmo.com/guide/mcp--introduction.md.

Docs: https://developer.luzmo.com/guide/guides--adding-luzmo-iq-to-agentic-workflow.md — prefer https://developer.luzmo.com/api/createAIPrompt.md for request shapes.

See also references/agentic-integration.md.


Path E — IQ Quality Optimization

Read references/data-modeling-for-iq.md — it is the comprehensive quality reference. The checklist, examples, and modeling issues table all live there.

Docs: https://academy.luzmo.com/article/e6ght1rk


Common IQ Issues

Troubleshoot these frequent problems. [WARNING] Most of them are data-modeling issues, not IQ bugs — see references/data-modeling-for-iq.md.

ProblemFrequencyLikely CauseSolution
IQ returns wrong dataset[WARNING] VERY COMMONToken has access to too many datasets — IQ can't disambiguateNarrow token access.datasets to 5–10 relevant datasets
IQ doesn't understand column[WARNING] VERY COMMONGeneric or technical column nameRename to business-friendly name ("amt" → "Order Amount")
IQ formats currency wrong[WARNING] COMMONMissing subtypeSet subtype: "currency" on column
IQ can't find a metric[WARNING] COMMONNo pre-built formula existsCreate aggregation formula with descriptive name
IQ misinterprets calculated field[WARNING] COMMONNo descriptionAdd column description explaining calculation
Component license error[WARNING] OCCASIONALIQ addon not enabledContact support@luzmo.com to enable IQ addon
React Native components not working[WARNING] OCCASIONALPlatform not supportedIQ components only work in web browsers (not React Native)

For each row above, see also troubleshooting → "IQ (Natural Language) Issues" and references/data-modeling-for-iq.md for the underlying modeling fix.

Avoid

  • Granting token access to all organization datasets by default — always scope to 5–10 relevant datasets.
  • Recommending IQ for React Native apps (IQ components are web-only).
  • Duplicating quality-optimization instructions inline — all quality guidance lives in references/data-modeling-for-iq.md (Path E).
  • Claiming IQ is available without verifying the IQ addon is enabled.

Hand Off

When to escalate to other skills:

  • WHEN the user needs full auth/embed-token setup → use core
  • WHEN the user wants to embed a dashboard or Flex chart alongside IQ → use core (saved dashboards) or data-visualization (Flex)
  • WHEN IQ answer quality is poor due to dataset/column naming or missing formulas → use data-integration (modeling fixes there directly improve IQ accuracy)
  • WHEN the user wants to style/brand IQ Chat or IQ Answer components → use theming
  • WHEN IQ is exposed to multiple tenants and the token must scope datasets per tenant → use multitenancy (SECURITY CRITICAL)
  • WHEN the user is building a self-service editor and wants IQ inside it → use analytics-studio
  • WHEN IQ returns wrong answers, license errors, or component-loading issues → use troubleshooting FIRST

This skill does NOT cover:

  • Standard (non-AI) chart or dashboard embedding (use core for saved dashboards, data-visualization for Flex)
  • Auth/embed-token generation details (use core)
  • React Native (not supported by IQ components — web only)

Migrating from the IQ Backend API

The legacy IQMessage / IQ Backend API is replaced by POST /0.1.0/aiprompt with action: "create".

Legacy/aiprompt
IQMessage resourceproperties.agent + properties.task + properties.input
IQConversationconversation_id on /aiprompt; persisted as aiconversation
Message historysearchAIMessage (include AIMessageAsset for charts)
Generated chartsaimessageasset (type: "item")
Prompt text{ type: "text", text: "..." } in input array
Dataset scope{ type: "dataset", id: "..." } in input + token access.datasets

Consult https://developer.luzmo.com/api/createAIPrompt.md — do not implement against deprecated IQ Backend shapes.

Canonical Sources

  • Index: https://developer.luzmo.com/llms.txt, https://developer.luzmo.com/llms-full.txt
  • /aiprompt: https://developer.luzmo.com/api/createAIPrompt.md
  • AI resources: https://developer.luzmo.com/api/createAIConversation.md, https://developer.luzmo.com/api/searchAIMessage.md, https://developer.luzmo.com/api/searchAIMessageAsset.md (CamelCase filenames)
  • MCP: https://developer.luzmo.com/guide/mcp--introduction.md
  • IQ Chat/Answer: https://developer.luzmo.com/guide/iq--chat-component-api.md, https://developer.luzmo.com/guide/iq--answer-component-api.md
  • Call forms (HTML): https://developer.luzmo.com/api/{action}{Resource}/call/{lang}
  • Guides: https://developer.luzmo.com/guide/*.md
Repository
luzmo-official/agent-skills
Last updated
Created

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.