AI-powered analytics with Luzmo - /aiprompt API, saved Agents, Rules, AI context, and IQ embed components. Use for natural language data queries, chart or dashboard generation, agentic workflows (agent analyst|item|dashboard, or a saved agent_id), IQ Chat/Answer embedding (luzmo-iq-embed-chat, LuzmoIQChatComponent), published Rules, ai_context / business knowledge, "AI not working", wrong answers, quality optimization. Requires AI/IQ addon license. Use eagerly for any natural-language analytics feature, saved Agent, Rule, or AI-context task. Not for standard chart embedding (use core for saved dashboards, data-visualization for Flex) or React Native (IQ embed components are web-only).
75
94%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Low
Low-risk findings worth noting
Entry-point for Luzmo AI analytics: the /aiprompt API (canonical backend), saved Agents and published Rules, AI context on datasets and columns, IQ Chat/Answer embed components (UI convenience layer), agentic workflows, and answer-quality optimization.
developer.luzmo.com is Luzmo's first-party, allowlisted documentation domain, maintained by the same publisher as this skill.https://developer.luzmo.com/.../*.md docs and their referenced URLs for implementation details.https://developer.luzmo.com/llms.txt and/or /llms-full.txt for discovery only.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: '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. On a call it is combined with per-request context and, when invoking a saved Agent, that Agent's published Rules. Business knowledge on the data itself belongs in ai_context, not in this token field — see Path E and references/saved-agents.md.
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.
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).
[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
For deeper guidance, read only when relevant:
references/saved-agents.md — Saved Agents and Rules: agent_id vs agent, capabilities, dataset allowlist, publish-before-apply, themereferences/data-modeling-for-iq.md — Quality optimization: token scope, names, subtypes, descriptions, ai_context, formulas, anti-patternsreferences/agentic-integration.md — IQ as a tool for LLM agents: backend brokering, tool schema, optional agent_id, multi-turn conversation_id, per-user/per-tenant securityreferences/mcp-server.md — Hosted Luzmo MCP: credential-based tools, agentId, 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 |
ai_context on datasets, columns, and formulas | High — definitions, caveats, and sign conventions IQ would otherwise guess |
| 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 |
| Reuse one Agent (capabilities, datasets, Rules) across calls | Path F — Saved Agent |
Docs:
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 |
Consult the component API doc before describing props, events, or customization options.
Docs:
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. Consult the API doc for the exact shape.
/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
/aipromptresponse (agent: 'analyst',task: 'generate') returns:result.assistant_message.aiMessageAssets[] // filter type === 'item' .value → { type, slots, options, filters } // a complete Flex viz-item specMap each item asset's
valuestraight 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
optionspertheming(Flex runtime theme). Seedata-visualizationfor the component.
/aiprompt replaces the legacy IQ Backend API (IQMessage). Consult the canonical spec before implementing:
https://developer.luzmo.com/api/createAIPrompt.mdPer-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: trueConsult 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' | 'dashboard'
task: 'generate', // varies per agent — see API doc
// saved Agent: send agent_id INSTEAD of agent, task, and capabilities — Path F
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 |
dashboard | Generate a multi-item dashboard, or edit one passed as { type: "dashboard" } input | task: generate only; response_mode: asset | mixed |
This agent field is the one-shot router. A saved Agent is agent_id and must not be combined with agent, task, or capabilities — see Path F.
Consult https://developer.luzmo.com/api/createAIPrompt.md for the full agent x 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 |
dashboard | For dashboard: edit or continue an existing dashboard. For analyst: the dashboard the user is viewing (charts, runtime filters, title) — not persisted as an asset |
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].
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.
/aiprompt auto-creates an AIConversation when conversation_id is omitted and persists user/assistant turns as AIMessage records. Generated charts and dashboards are stored as AIMessageAsset records with type: "item" or type: "dashboard".
| Resource | When to use | Doc |
|---|---|---|
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 or 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 with the user's scoped embed token — agent: "analyst" for one-shot Q&A, or agent_id alone when a saved Agent should run. 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. Embed tokens default to search_datasets, answer_question, and create_chart. API-key and OAuth sessions get a wider tool set. Append ?agentId=<uuid> to run those Q&A and chart tools through a saved Agent. 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.
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 and https://developer.luzmo.com/guide/guides--managing-ai-context.md
Read references/saved-agents.md before creating, linking, or invoking a saved Agent.
A saved Agent is properties.agent_id. Do not also send agent, task, or capabilities. Create and configure it with the org API key; invoke it with the user's embed token. Associated datasets are an allowlist. Linked Rules apply only after a version is published. theme_id is not applied to returned assets — render with theming.
Docs:
https://developer.luzmo.com/guide/guides--creating-and-using-agents-through-the-api.md
https://developer.luzmo.com/guide/guides--creating-and-managing-rules-through-the-api.mdTroubleshoot these frequent problems. [WARNING] 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 | [WARNING] 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 | [WARNING] VERY COMMON | Generic or technical column name | Rename to business-friendly name ("amt" → "Order Amount") |
| IQ formats currency wrong | [WARNING] COMMON | Missing subtype | Set subtype: "currency" on column |
| IQ can't find a metric | [WARNING] COMMON | No pre-built formula exists | Create aggregation formula with descriptive name |
| IQ misinterprets calculated field | [WARNING] COMMON | No description or ai_context | Add a description and ai_context for definitions, caveats, and sign conventions |
| Linked Rule never affects answers | [WARNING] COMMON | Rule is still a draft, or the new version was saved but not published | Publish the version. See references/saved-agents.md |
agent_id returns 404 | [WARNING] OCCASIONAL | Unknown, deleted, or other-organization Agent | Use an Agent id from the same organization |
| Agent theme ignored on charts | [WARNING] OCCASIONAL | AIPrompt does not apply theme_id | Fetch the theme and apply it when rendering (theming) |
| Prompt datasets ignored | [WARNING] OCCASIONAL | Dataset is outside the Agent allowlist or the user's token | Associate the dataset with the Agent and grant the embed token use |
| Component license error | [WARNING] OCCASIONAL | IQ addon not enabled | Contact support@luzmo.com to enable IQ addon |
| React Native components not working | [WARNING] 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).agent_id with agent, task, or capabilities — a saved Agent supplies those.theme_id to returned assets.When to escalate to other skills:
corecore (saved dashboards) or data-visualization (Flex)data-integration (modeling fixes there directly improve IQ accuracy)theming (theme_id is not applied by AIPrompt)multitenancy (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 or dashboards | aimessageasset (type: "item" or "dashboard") |
| 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.
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/guides--creating-and-using-agents-through-the-api.mdhttps://developer.luzmo.com/guide/guides--creating-and-managing-rules-through-the-api.mdhttps://developer.luzmo.com/guide/guides--managing-ai-context.mdhttps://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/*.mdluzmo-official/agent-skills
a12c919
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.