From Luzmo Agent Skills
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).
How this skill is triggered — by the user, by Claude, or both
Slash command
/luzmo-agent-skills:ai-analyticsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
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.
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.
developer.luzmo.com/*.md page(s) before coding.https://developer.luzmo.com/llms.txt / https://developer.luzmo.com/llms-full.txt only to discover pages, not as the final source.BEFORE implementing any IQ component or API integration, verify:
LUZMO_API_KEY, LUZMO_API_TOKEN) are server-side ONLY — never in the IQ Chat/Answer component, never in the agent's frontend codecreateAuthorization; only authKey (id) and authToken (token) reach the frontendaccess.datasets is scoped to the 5–10 datasets relevant to this user/tenant — IQ accuracy AND security degrade with overly broad token scopeparameter_overrides or filters so IQ cannot see other tenants' rowsIf 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.
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:
Example:
const token = await client.create('authorization', {
type: 'embed',
username: '[email protected]',
name: 'John Doe',
email: '[email protected]',
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.
IQ is available as an add-on — if the user encounters a license error, contact [email protected].
⚠️ 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.
Use the correct component names with -embed- in them:
| Framework | Chat Component | Answer Component |
|---|---|---|
| Vanilla JS / Web Components | luzmo-iq-embed-chat | luzmo-iq-embed-answer |
| React | LuzmoIQChatComponent | LuzmoIQAnswerComponent |
| Angular | NgxLuzmoIQChatComponent / <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).
❌ WRONG: luzmo-iq-chat, luzmo-iq-answer (missing -embed-) for vanilla JS/React
✅ CORRECT: luzmo-iq-embed-chat, luzmo-iq-embed-answer for vanilla JS/React
✅ CORRECT: luzmo-iq-chat, luzmo-iq-answer for Angular/Vue
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 checklistreferences/agentic-integration.md — IQ as a tool for LLM agents: backend brokering, tool schema, multi-turn conversation_id, per-user/per-tenant securityreferences/mcp-server.md — Hosted Luzmo MCP: tools, auth, themes, MCP App (alternative to direct /aiprompt)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:
| Factor | Impact |
|---|---|
| Dataset/column naming | High — wrong names = wrong results |
| Token context scoping (≤10 datasets) | High — ambiguity = wrong dataset |
| Column descriptions | Medium — helps calculated fields |
| Column types/subtypes | Medium — affects formatting |
| Pre-built formulas | Medium — improves consistency |
| Goal | Path |
|---|---|
| Full embedded conversational chat UI | Path A — Chat component (wraps /aiprompt) |
| Render AI answers without a full chat UI | Path 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 tool | Path D — Agentic workflow (uses /aiprompt) |
| Improve AI answer quality | Path E — Data modeling for AI |
Fetch:
https://developer.luzmo.com/guide/iq--introduction--chat-component.md
https://developer.luzmo.com/guide/iq--chat-component-api.md
| Framework | Component |
|---|---|
| Web (vanilla JS) | <luzmo-iq-embed-chat> |
| React | LuzmoIQChatComponent |
Always fetch the component API doc before describing props, events, or customization options.
Fetch:
https://developer.luzmo.com/guide/iq--introduction--answer-component.md
https://developer.luzmo.com/guide/iq--answer-component-api.md
| Framework | Component |
|---|---|
| Web (vanilla JS) | <luzmo-iq-embed-answer> |
| React | LuzmoIQAnswerComponent |
The Answer component accepts messages following the AIPrompt structure. Fetch the API doc for the exact shape.
/aiprompt API (canonical)/aiprompt replaces the legacy IQ Backend API (IQMessage). Fetch 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).
POST https://api.luzmo.com/0.1.0/aiprompt
Content-Type: application/json
Accept: text/event-stream # required when stream: true
Fetch 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
]
}
}
agent | Typical use | Notes |
|---|---|---|
item | Generate, suggest, or describe a single visualization item | task: generate | suggest | describe |
analyst | IQ-backed natural-language Q&A (text and/or chart) | task: generate only; requires IQ addon |
Always fetch https://developer.luzmo.com/api/createAIPrompt.md for the full agent × task matrix, response schema, and streaming event payloads.
input typesExactly one { type: "text", text: "..." } is required. Optional inputs (fetch API doc for shapes):
type | Purpose |
|---|---|
text | User prompt (required) |
dataset | Pin dataset scope for this prompt |
item | Pass existing item JSON for refine/describe flows |
Set stream: true and Accept: text/event-stream. The API emits JSON events in order: start → progress (optional) → text_start / text_delta / text_end → asset_start / asset_delta / asset_end → finish (final result) — or error on failure. Ends with data: [DONE].
Fetch 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.
/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".
| Resource | When to use | Doc |
|---|---|---|
aiconversation | Pre-create a titled thread, or manage conversation metadata | createAIConversation.md |
aimessage | List/replay messages in a thread (include: AIMessageAsset) | searchAIMessage.md |
aimessageasset | Fetch persisted item asset JSON by asset id | searchAIMessageAsset.md |
aiconversation | Pre-create a titled thread, or manage conversation metadata | https://developer.luzmo.com/api/createAIConversation.md |
aimessage | List/replay messages in a thread (include: AIMessageAsset) | https://developer.luzmo.com/api/searchAIMessage.md |
aimessageasset | Fetch persisted item/dashboard JSON by asset id | https://developer.luzmo.com/api/searchAIMessageAsset.md |
Multi-turn: pass conversation_id from the previous /aiprompt response (or from createAIConversation) on the next call.
key + token server-side only to mint scoped embed tokens; never expose them in browser code./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.stream: true and Accept: text/event-stream for SSE responses.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.
Use when an LLM agent needs to answer analytics questions by calling Luzmo data programmatically.
/aiprompt (agent: "analyst") with the user's scoped embed token — or use the hosted MCP server (simpler; see below).response_mode); use conversation_id for follow-ups.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.Fetch: 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.
Read references/data-modeling-for-iq.md — it is the comprehensive quality reference. The checklist, examples, and modeling issues table all live there.
Fetch: https://academy.luzmo.com/article/e6ght1rk
Troubleshoot these frequent problems. ⚠️ Most of them are data-modeling issues, not IQ bugs — see references/data-modeling-for-iq.md.
| Problem | Frequency | Likely Cause | Solution |
|---|---|---|---|
| IQ returns wrong dataset | ⚠️ VERY COMMON | Token has access to too many datasets — IQ can't disambiguate | Narrow token access.datasets to 5–10 relevant datasets |
| IQ doesn't understand column | ⚠️ VERY COMMON | Generic or technical column name | Rename to business-friendly name ("amt" → "Order Amount") |
| IQ formats currency wrong | ⚠️ COMMON | Missing subtype | Set subtype: "currency" on column |
| IQ can't find a metric | ⚠️ COMMON | No pre-built formula exists | Create aggregation formula with descriptive name |
| IQ misinterprets calculated field | ⚠️ COMMON | No description | Add column description explaining calculation |
| Component license error | ⚠️ OCCASIONAL | IQ addon not enabled | Contact [email protected] to enable IQ addon |
| React Native components not working | ⚠️ OCCASIONAL | Platform not supported | IQ 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.
references/data-modeling-for-iq.md (Path E).When to escalate to other skills:
corecore (saved dashboards) or data-visualization (Flex)data-integration (modeling fixes there directly improve IQ accuracy)themingmultitenancy (SECURITY CRITICAL)analytics-studiotroubleshooting FIRSTThis skill does NOT cover:
core for saved dashboards, data-visualization for Flex)core)The legacy IQMessage / IQ Backend API is replaced by POST /0.1.0/aiprompt with action: "create".
| Legacy | /aiprompt |
|---|---|
| IQMessage resource | properties.agent + properties.task + properties.input |
| IQConversation | conversation_id on /aiprompt; persisted as aiconversation |
| Message history | searchAIMessage (include AIMessageAsset for charts) |
| Generated charts | aimessageasset (type: "item") |
| Prompt text | { type: "text", text: "..." } in input array |
| Dataset scope | { type: "dataset", id: "..." } in input + token access.datasets |
Fetch https://developer.luzmo.com/api/createAIPrompt.md — do not implement against deprecated IQ Backend shapes.
https://developer.luzmo.com/llms.txt, https://developer.luzmo.com/llms-full.txt/aiprompt: https://developer.luzmo.com/api/createAIPrompt.mdhttps://developer.luzmo.com/api/createAIConversation.md, https://developer.luzmo.com/api/searchAIMessage.md, https://developer.luzmo.com/api/searchAIMessageAsset.md (CamelCase filenames)https://developer.luzmo.com/guide/mcp--introduction.mdhttps://developer.luzmo.com/guide/iq--chat-component-api.md, https://developer.luzmo.com/guide/iq--answer-component-api.mdhttps://developer.luzmo.com/api/{action}{Resource}/call/{lang}https://developer.luzmo.com/guide/*.mdnpx claudepluginhub luzmo-official/agent-skills --plugin luzmo-agent-skillsProvides CDSS development patterns for drug interaction checking, dose validation, clinical scoring (NEWS2, qSOFA), and alert classification integrated into EMR workflows.