Skip to content

06-admin-ai-ops ​

Pages read: 43 (list at the bottom). There is no admin/index.md; the only other top-level file in admin/ is time-zones.md, which another slice covers.

Core facts checked in the running Cube Core v1.8.35 image (cubebi-cube), used as evidence below:

  • No AI, MCP, SAML or SCIM code in Core. I grepped api-gateway, server-core, server, shared and cloud dist for llm/openai/anthropic/mcp/modelcontextprotocol/saml/scim and found nothing; @modelcontextprotocol is not installed. Nothing in Core reads agents/, CUBE_CLOUD_AGENTS_CONFIG_*, certified_queries, eval_questions, accessible_views or memory_mode. Core compiles only schema_path (default model/), so an agents/ dir sitting next to it is ignored.

  • Observability hook in Core: server-core/dist/src/core/agentCollect.js + server.js#initAgent(). When CUBEJS_AGENT_ENDPOINT_URL is set, Core wraps its logger and sends every log event to that URL: batched (CUBEJS_AGENT_FRAME_SIZE, CUBEJS_AGENT_FLUSH_INTERVAL, CUBEJS_AGENT_MAX_SOCKETS), as deflate-compressed JSON over HTTP POST, or over WebSocket if the URL is ws(s)://. Each event gets id, timestamp, instanceId and sentAt, with 3 retries. This is the feed Cube Cloud uses to build Query History. The docs for CUBEJS_LOG_REDACTION confirm it: "events sent to CUBEJS_AGENT_ENDPOINT_URL, which is how Cube Cloud receives them for Query History, keep the original values".

  • Core log events (from gateway.js log() and the orchestrator). Every gateway event carries securityContext, requestId, appName, protocol and apiType. Event types:

    • Requests: Load Request, Load Request Success (query, duration, apiType, isPlayground, queries, queriesWithPreAggregations, dbType, lastRefreshTime), Load Request SQL, REST API Request, Query Rewrite/Query Rewrite completed, Incoming network usage/Outgoing network usage (bytes, path), Auth Error, UserError, Internal Server Error.
    • Orchestrator: Query started, Query completed, Performing query/Performing query completed, Added to queue, Waiting for query, Slow Query Warning, Executing SQL, Cancelling query due to timeout, and the pre-aggregation build/download/upload events.
    • Refresh scheduler: Refresh Scheduler Run/Error/Long Execution.
    • SQL API (native): SQL API Query Planning Success, SQL API Plan Rewrite Success, Load Request Success.
  • Other Core monitoring hooks:

    • logger(message, params) config option.
    • CUBEJS_LOG_LEVEL. Production logs are structured JSON, one object per line.
    • CUBEJS_LOG_REDACTION.
    • CUBEJS_SQL_INCLUDE_TRACE_ID, which adds a trace_id SQL comment.
    • /readyz and /livez.
    • DELETE /v1/running-query/:requestId.
    • Cube Store metrics over statsd/dogstatsd (CUBESTORE_METRICS_FORMAT|ADDRESS|PORT).
    • There is no Prometheus /metrics endpoint on the Cube API process.
  • Private "system" API in Core (gateway.js l.520–576). It is mounted only when CUBEJS_PLAYGROUND_AUTH_SECRET is set and has its own auth (checkAuthSystemMiddleware). Endpoints:

    • /cubejs-system/v1/context
    • /cubejs-system/v1/pre-aggregations, plus /security-contexts, /timezones, /partitions, /preview, /build, /queue and /cancel under it
    • The public Orchestration API: POST /v1/pre-aggregations/jobs and /v1/pre-aggregations/can-use

    These are the backend for a pre-aggregations console.

  • User attributes and groups are partly Core. The schema compiler (CubePropContextTranspiler.js) rewrites userAttributes.x / user_attributes.x / groups in access policies to securityContext.cubeCloud.userAttributes.x. CompilerApi.js resolves access-policy group/groups through the contextToGroups option. So Core enforces policies that reference user attributes and groups as long as your auth layer fills securityContext.cubeCloud.{userAttributes,groups} and/or context_to_groups.

  • Core auth primitives: JWT verification (CUBEJS_API_SECRET, jwt.jwkUrl, CUBEJS_JWT_*, claimsNamespace), check_auth, check_sql_auth, context_to_api_scopes, extend_context, context_to_app_id.

  • HTTP endpoints an agent rebuild can use: /v1/meta, /v1/load, /v1/sql, /v1/dry-run, POST /v1/cubesql (SQL API over HTTP, supports MEASURE()), plus the Postgres-wire SQL API.


AI: Agent configuration as code (single agent) ​

  • Docs: pages/admin/ai/index.md
  • What it does:
    • Where the config lives: the data model repo, as agents/config.yml + agents/rules/*.md + agents/certified_queries/*.md + agents/skills/*.md (+ agents/eval_questions*.yml). The dir defaults to agents and is overridden with CUBE_CLOUD_AGENTS_CONFIG_PATH.
    • Opt-in: existing deployments opt in with CUBE_CLOUD_AGENTS_CONFIG_ENABLED=true; it is the default for deployments created after 2026-04-30. Cube ≥1.6.5 is required. Configuring the agent in the UI is deprecated, and agent settings are read-only in the UI.
    • Root properties:
      • llm: auto | predefined name | {byom:{name}}. Predefined names: Claude 3.5→5.5 variants (claude_4_6_sonnet, claude_5_5_opus, …), OpenAI (gpt_4o, gpt_5, gpt_6_astra, o3, …), Fireworks (glm_5_3, kimi_k3).
      • small_llm: auto | claude-haiku-5-5 | gpt-6-luna | kimi_k3 | glm_5_3 | BYOM.
      • embedding_llm: text-embedding-3-large (default) | text-embedding-3-small | BYOM.
      • accessible_views: list; default is all views.
      • memory_mode: space (default) | user | disabled.
      • suggestions: list of starter prompts.
    • auto lets Cube pick and change the model over time.
    • accessible_views is prompt guidance only, not security.
    • suggestions show as buttons on the empty chat screen. Clicking one fills the input box; it does not send.
    • Config is read per deployment and per branch, so dev branches can test agent changes before merge.
    • API reference lists "Get agent defaults" and "Get agent suggestions" endpoints (Cloud API).
  • Availability: CLOUD-ONLY (all plans with AI). Evidence: env vars are CUBE_CLOUD_*; there is no trace of agents/, accessible_views or memory_mode in the Core image.
  • Core building blocks to use:
    • /v1/meta: the semantic catalog to feed the LLM. Filter it to accessible_views; use meta, descriptions and public.
    • SQL API (POST /v1/cubesql or the pg wire) with MEASURE() as the agent's query tool.
    • /v1/load + /v1/sql.
    • The security context / JWT per user.
    • repository_factory / file reads to load an agents/ dir from the same repo.
  • To build on Core:
    • A YAML/Markdown config loader for the same agents/ layout, with schema validation.
    • An agent runtime: an LLM client and tool loop with tools such as describe_model, run_cube_sql, run_source_sql, chart and email.
    • A chat backend with thread storage and streaming.
    • Starter-prompt UI.
    • Effort L for a solid single agent (M for a basic loop).
  • Gotchas: keep accessible_views advisory and enforce security with Core access policies. Model-name aliases have to be maintained. Branch-aware config needs per-branch Cube deployments, or schema_version/repository_factory keyed by branch.

AI: LLM providers / Bring Your Own Model (BYOM) and small LLM ​

  • Docs: pages/admin/ai/bring-your-own-model.md
  • What it does:
    • Model registry: models are registered in Admin > Models with a name, a type (LLM | Small LLM | Embedding), a provider, the model and credentials. They are referenced from YAML as llm: {byom: {name: ...}} (by name or ID), and each agent can use different models.
    • Providers (chat / embeddings):
      • Anthropic: chat only (API key)
      • OpenAI: chat and embeddings
      • AWS Bedrock: chat and embeddings. Region, plus access keys, an assume-role ARN with optional external ID, or OIDC workload identity. Optional inference profile.
      • GCP Vertex: chat only. Region and project, plus a service-account JSON or OIDC WIF audience, with optional SA impersonation.
      • Databricks: workspace URL and token
      • Snowflake Cortex: JWT, or a key-pair PKCS#8 key (encrypted or not, with a passphrase)
      • Custom OpenAI-compatible: <base>/chat/completions, base includes /v1
      • Custom Anthropic-compatible: <base>/v1/messages, x-api-key
    • Custom endpoint rules:
      • The base URL must be http(s), with no loopback or link-local host (SSRF guard).
      • The API key is optional.
      • Custom HTTP headers can use placeholders: {{userId}}, {{userExternalId}}, {{email}}, {{username}}, {{tenantId}}, {{tenantName}}, {{tenantUrl}}, {{deploymentId}}, {{agentId}} and {{securityContext.<path>}}. securityContext works only on Chat API/MCP requests, comes from the signed token claims before check_auth, and excludes reserved claims (sub, iss, aud, iat, exp, scope, cubeCloudScope, override, requestSource, cubeCloud).
      • An unresolved placeholder is sent through as literal text.
    • Extended thinking: an on/off toggle, on by default, for Claude ≥3.7 on Anthropic/Bedrock/Vertex/custom-Anthropic. The custom-Anthropic provider also needs a Thinking mode, Adaptive (default) or Budgeted, that matches the model or every request fails. Reasoning is shown in chat and exposed as a Chat API thinking field.
    • Small LLM: runs short tasks: chat titles, suggested questions, memory, and parsing typed date ranges in dashboard controls.
      • With auto: Claude/GLM/Kimi/auto agents use claude-haiku-5-5, other built-ins use gpt-6-luna. A BYOM LLM gets a small model from the same provider (Anthropic/Bedrock/Vertex: Haiku 5.5, OpenAI: gpt-6-luna, others: the LLM itself).
      • Fallback order: BYOM small → auto → the LLM itself.
      • The UI warns when a BYOM agent runs its small tasks on a built-in model, because that is billed.
    • Embedding model: changing it invalidates existing memories, because vectors are tied to the model.
    • Billing and network: BYOM calls cost 0 Cube tokens but are still counted in AI Tokens Usage and the Usage Analytics "AI Calls & Cost" view. Provider IP allowlisting uses Cube egress IPs (control plane or BYOC region).
  • Availability: CLOUD-ONLY. Enterprise plan (BYOM). Evidence: plan badge; Admin UI; no LLM code in Core.
  • Core building blocks to use: the security context (for header placeholders such as per-tenant attribution) and check_auth. Nothing in Core is LLM-related.
  • To build on Core:
    • A model registry (DB table plus encrypted secret storage) and a provider abstraction. A library such as LiteLLM, Vercel AI SDK or LangChain covers OpenAI/Anthropic/Bedrock/Vertex.
    • Routing of small tasks to a small model with fallback.
    • Thinking-mode handling.
    • An embedding client.
    • Header templating with a reserved-claim blocklist.
    • An SSRF guard on custom endpoints.
    • OIDC workload identity for AWS/GCP is extra.
    • Effort M (L with OIDC federation and the full provider matrix).
  • Gotchas: keep secrets out of YAML; Cube keeps them in the UI/DB and only references them by name in YAML. Thinking-mode mismatch causes hard failures. Embedding-model swaps orphan memories. Count tokens even for "free" BYOM calls.

AI: Rules (agent instructions) ​

  • Docs: pages/admin/ai/rules.md
  • What it does:
    • Format: Markdown files in agents/rules/ (name inferred from the file name) or inline in config.yml under rules:.
    • Frontmatter: type (required: always | agent_requested), description (needed for agent_requested; the agent matches the user request against it), name, prompt (falls back to the body), conditions, and space in multi-agent setups.
    • When rules apply: always rules are injected into every interaction. agent_requested rules are pulled in when the agent judges them relevant. Like skills, they work as a catalog of descriptions that the LLM picks from.
    • conditions: a list that must ALL hold.
      • {user_attribute: X, values: [...]}: the user attribute equals one of the values. Values are strings, so quote numbers.
      • {group: g} or {groups: [..]}: the user is in the group, or in any of the groups.
      • Conditions use the same attributes and groups as access policies. A user without the attribute doesn't get the rule. Unknown keys are ignored.
    • Not security: conditions only filter which instructions are sent to the model.
    • Conflicts: contradictory always rules are surfaced by the agent in its answer.
    • Scope: rules belong to a space (the implicit auto space in single-agent mode, or agents/rules/<space>/ / space: frontmatter).
  • Availability: CLOUD-ONLY (all plans with AI). Evidence: Cloud agent feature; nothing in Core.
  • Core building blocks to use: securityContext.cubeCloud.userAttributes / groups and context_to_groups, the same inputs Core access policies use, to evaluate conditions the same way.
  • To build on Core: a rule loader; a prompt assembler (always rules go in the system prompt, agent_requested rules become a catalog plus a "load_rule" tool or a pre-selection LLM call); a condition evaluator reusing the security context. Effort S.
  • Gotchas: keep groups and attribute resolution identical to context_to_groups so rules and access policies agree. Watch the prompt-size budget as rules grow.

AI: Certified queries ​

  • Docs: pages/admin/ai/certified-queries.md
  • What it does:
    • Purpose: a library of trusted SQL examples. The agent may run one as-is, adapt it (add filters, dimensions or measures), or ignore it. It is not a whitelist.
    • Format: files in agents/certified_queries/ (also certified-queries/ or queries/). Frontmatter: user_request (required), description, name, sql_query (falls back to the body), and space. They can also be inlined in config.yml under certified_queries:.
    • SQL dialect: Cube SQL API SQL over cubes and views (e.g. FROM orders, MEASURE()).
    • Matching: the agent matches on user_request + description, so these are retrieval keys.
    • UI: Admin → Spaces → Certified queries has create, edit and delete. While the Description field is empty, an LLM suggests a one-sentence description from the SQL; this needs AI enabled and a space bound to a deployment. If a space is configured in YAML, the UI cannot create queries, and UI-created queries are listed but ignored by the agent.
    • Other uses: "Certify this query" in chat creates one, and evals can reference them as ground truth.
  • Availability: CLOUD-ONLY. Evidence: Cloud agent feature.
  • Core building blocks to use: SQL API (/v1/cubesql, pg wire) to validate and execute them; /v1/meta to check member references.
  • To build on Core: a loader and validator (dry-run each query through the SQL API in CI); a retrieval step (embedding similarity over user_request+description, or put all of them in the prompt if few) that hands top-k examples to the agent; an optional CRUD UI. Effort S–M.
  • Gotchas: validate them against the model on every deploy, because renamed members silently break examples. Decide the precedence between YAML and the DB (Cube: YAML wins and DB entries are ignored).

AI: Skills (named reusable workflows) ​

  • Docs: pages/admin/ai/skills.md
  • What it does:
    • Format: agents/skills/*.md. Frontmatter: title (required; the button and /-menu label), description (required; "use when…" text for auto-matching), name (inferred from the file name). The body is the instructions. Nested folders are allowed, but names must be unique across skills/. They can be inlined in YAML under skills: with an instructions: key.
    • Progressive disclosure: the agent sees a catalog of name/title/description and loads the full instructions only when a skill runs. The browser only ever receives name, title and description; instructions stay server-side.
    • How users run them: the /skill-name extra context slash menu, buttons, or automatic matching. They work in Analytics Chat, workbooks, dashboards and the IDE.
    • Limits: the first version is instructions-only, with no per-skill data scoping or external actions.
    • Permissions: authoring needs data-model edit (Admin/Developer); running needs chat access (incl. Explorer/Viewer). Skills are tested on dev branches.
    • Scope: per space (agents/skills/<space>/ or a space's skills: key).
  • Availability: CLOUD-ONLY. Evidence: Cloud agent feature.
  • Core building blocks to use: none beyond the agent's query tools.
  • To build on Core: a loader; a catalog injected into the system prompt plus a load_skill(name) tool; a slash-command UI; an endpoint that returns only metadata to the client. Effort S.
  • Gotchas: keep instruction bodies server-side if they encode sensitive business logic.

AI: Multi-agent, spaces, reconciliation, default agent ​

  • Docs: pages/admin/ai/multi-agent.md
  • What it does:
    • Shape: config.yml switches to spaces: [{name, description}] + agents: [{name (required), description, space (required), llm, small_llm, embedding_llm, accessible_views, memory_mode, suggestions}]. It cannot be mixed with the flat single-agent style in one file.
    • Spaces: a space owns its rules, certified queries, skills and memories. Agents in the same space share them.
    • Attaching content to a space: space: frontmatter, or the agents/rules/<space>/ and agents/certified_queries/<space>/ dirs.
    • Reconciliation: YAML is the source of truth, but DB records must be created via "Import from YAML" on the Admin Agents/Spaces pages. Entries are matched by name, and the IDE shows a "Reconcile agent configs" pending count.
      • Behaviour fields take effect without reconciling.
      • Changing an agent's space doesn't move the existing agent. You delete it and re-import, which creates a new agent and loses its chats.
      • Renaming an entry creates a new record, and the old one is flagged "(misconfigured)".
    • Space scope: Global (shared by all deployments) or Per deployment (named like "Product (production)"). Scope affects storage (memories), not configuration: each deployment still reads its own agents/ dir. Spaces created before scoping existed show as "Not scoped".
    • Default agent: set per deployment (Settings → Configuration → Agents). New chats, MCP clients and scheduled tasks that name no agent use it, otherwise the "Auto" agent is used.
    • Turning Auto off: possible only while a default agent is set. Requests for Auto then go to the default, including the deployment-scoped Chat API URL. The current default agent can't be deleted or moved.
    • Guidance: split agents by audience (tone or model), not by subject. Use agent_requested rules and access policies instead of subject agents.
  • Availability: CLOUD-ONLY. Evidence: Cloud Admin pages, Cloud DB records.
  • Core building blocks to use: context_to_app_id/deployments if one Cube serves many tenants; access policies for real scoping.
  • To build on Core: a DB schema (account → spaces → agents → threads/memories); config-to-DB reconciliation (diff by name, pending list, import); a default-agent setting; agent selection in chat/API/MCP. Effort M.
  • Gotchas: a name-keyed identity means renames orphan data. Decide global vs per-deployment memory storage. Don't let agent choice be a security boundary.

AI: Memories (memory isolation) ​

  • Docs: pages/admin/ai/memory-isolation.md, pages/admin/ai/index.md#memory
  • What it does:
    • Purpose: the agent stores user preferences, decisions and context as memories and retrieves them in later conversations.
    • Modes: space (shared across users of the space; the default), user (per user), disabled.
    • Storage: a vector store keyed by tenant + space (+ user in user mode). The embedding model is set by embedding_llm. All vector searches filter by tenant and user, and DB queries are tenant-filtered by decorators. A DI container per tenant. Security context comes from signed JWTs only.
    • Scope across deployments: a global space shares memories across deployments; a per-deployment space keeps them to that deployment.
    • Who writes them: memory extraction runs on the small LLM.
    • Isolation: BYOC or single-tenant infra is offered for stronger isolation.
  • Availability: CLOUD-ONLY. Evidence: Cloud agent feature.
  • Core building blocks to use: security context / context_to_app_id for the tenant key.
  • To build on Core: a vector store (pgvector, Qdrant, etc.); a memory-extraction step after each turn (small LLM); a retrieval step before each turn; mandatory tenant/space/user filters on every query; a delete/inspect UI. Effort M.
  • Gotchas:
    • Cross-tenant leakage risk: filter on the server side and never trust client IDs.
    • Re-embed on model change.
    • "Space" mode shares one user's facts with others; default to user for multi-tenant embedding.
    • GDPR deletion.

AI: MCP Connectors (outbound tools for the agent) ​

  • Docs: pages/admin/ai/mcp-connectors.md
  • What it does:
    • Purpose: an admin connects external remote MCP servers (from a directory: Notion, Linear, Sentry, Attio…; or custom by HTTPS URL) at organization level. The servers' tools become callable by the agent in chat.
    • Auth methods:
      • OAuth 2.0: tokens stored and refreshed.
      • API key: sent as Authorization: Bearer, unless the value already has a scheme.
      • Basic auth.
      • Custom header.
      • No auth: if tool discovery fails, the connector shows "Not connected" with a Connect retry.
    • Tool exposure: tools are discovered automatically. The admin enables a subset (shown as "16 / 16"), and only enabled tools reach the agent.
    • Per-user authorization: if a tool needs per-user auth, the agent prompts the user to authorize in chat before running it.
    • Permissions: managing connectors needs admin or McpToolsManage. Using them needs chat access.
    • Contrast with the MCP server: connectors are outbound; Cube's MCP server is inbound.
  • Availability: CLOUD-ONLY. Premium and Enterprise plans. Evidence: plan badge; no MCP library in the Core image.
  • Core building blocks to use: none (this is agent-side).
  • To build on Core: an MCP client (official TS/Python SDK, streamable HTTP); a connector registry with encrypted credentials; an OAuth client flow plus token refresh; tool discovery plus an enable list; a per-user OAuth consent flow in chat; a tool-call audit log. Effort M (L with per-user OAuth and a directory).
  • Gotchas: prompt injection through tool outputs. Org-wide credentials mean every chat user acts with the admin's external identity unless per-user OAuth is used. Rate limits and timeouts.

AI: Evals (agent benchmarking) ​

  • Docs: pages/admin/ai/evals.md
  • What it does:
    • Questions: agents/eval_questions.yml and/or agents/eval_questions/*.yml, merged into one set. Each item has name (unique per space), question, and exactly one ground truth: certifiedQuery: <name> or sql: (run via the Cube SQL API). Optional check: exact|ai and a file-level space (default auto). The UI Questions tab is read-only.
    • Runs: "Run eval" in the IDE Evals tab takes a branch, a question file (or all) and an agent. Runs execute in the background. The run list shows environment (dev/staging/prod), agent, status, accuracy NN% (passed/total), creator and timestamps.
    • Exact grader: executes both the agent SQL and the ground-truth SQL and compares the result sets.
      • Rows: order is ignored; numbers match to 4 significant figures.
      • Columns: each ground-truth column must be matched by some agent column by values (aliases and extra columns are ignored).
      • Row count: there is no separate gate; it is enforced by the ground-truth row count.
      • Verdicts: pass | fail | review (no ground truth, or the agent ran no query) | error.
      • Score reasons: Row count mismatch, Missing columns, Value mismatch, Unexpected rows, Query error, Ground truth query failed, Ground truth not found, Agent error.
    • AI grader (check: ai): runs only after a deterministic fail. An LLM judge on the same provider as the agent can flip a fail to a pass, never the reverse.
      • Lenient on unspecified row count, ordering, extra or omitted columns, labels and formatting. Strict on values, grain, filters, time range, and total-vs-breakdown.
      • Judges the data only, not the prose answer.
      • Results over 50 rows are sampled: the first 25 rows plus up to 50 sampled rows, each block capped at 20k chars, with the true counts passed separately.
      • If the judge is unavailable, the result is tagged "AI check unavailable". Needs Cube ≥1.7.37.
    • Per-result fields: verdict, scoreReasons, analysis, agentSql, groundTruthSql, agentResponse, plus response time and tokens (UI only). Run-level: median response time and total tokens.
    • CI:
      • CLI: cube evals run <deploymentId> --branch --wait --timeout --json [--agent] [--file] [--security-context], which exits non-zero unless every question passes.
      • Platform API: POST/GET /api/v1/deployments/{id}/evaluations[/{id}[/results]] with body {branchName, agentName, questionFile, securityContext} and cursor pagination.
      • Permissions: SchemaUpdate to start a run, SchemaRead to read.
      • securityContext is merged over the caller's context (admin-only cubeCloud key, of which only groups/userAttributes take effect).
      • In preview.
  • Availability: CLOUD-ONLY (preview for CI). Evidence: Cloud IDE tab, Platform API, cube Cloud CLI.
  • Core building blocks to use: SQL API (/v1/cubesql) to execute ground truth and agent SQL under the same security context; JWT minting for an arbitrary context.
  • To build on Core: a YAML loader; a runner (queue/worker) that calls your agent per question and captures its SQL; a result-set comparator implementing the algorithm above (well specified, easy to port); an optional LLM judge; a results DB plus UI; a CLI/API for CI. Effort M.
  • Gotchas: you must capture the agent's final SQL, which needs tool-call tracing. Non-determinism means running N times. Ground truth must run under the same security context as the agent.

AI: Agent permissions & guardrails (cross-cutting) ​

  • Docs: pages/admin/users-and-permissions/roles-and-permissions.md#agent-permissions, pages/admin/ai/multi-agent.md (warning), pages/admin/ai/rules.md, pages/admin/users-and-permissions/custom-roles.md (AI actions)
  • What it does:
    • The agent runs with the permissions of the user it acts for, and access policies decide what it can query and return.
    • accessible_views ("Restrict views"), rules and the agent choice are guidance only.
    • Email tool: admins can email any member; other built-in roles can email only themselves; custom roles use SendEmailToSelf / SendEmailToWorkspaceMembers (which includes groups). The tool must be enabled for the workspace.
    • Source SQL: the agent's SQL against raw data sources requires SqlRunnerRead.
    • Access to AI: gated by DeploymentAgentRead ("Access AI agents").
    • Spend limits: token quotas and spending limits act as cost guardrails (see AI Tokens).
  • Availability: CORE+CLOUD. The data-security half (access policies, row/member-level, context_to_groups, security context) is Core. The agent-side checks (tool gating by role, email permissions, view restriction) are Cloud.
  • Core building blocks to use: access_policy in views/cubes, context_to_groups, query_rewrite, check_auth, context_to_api_scopes (e.g. deny sql/data scopes to some users).
  • To build on Core: always call Core with the end user's JWT, never a service token; add a tool-permission layer in the agent service; budget enforcement. Effort S (on top of the agent).
  • Gotchas: raw-source SQL tools bypass Cube access policies entirely, so restrict them hard.

Monitoring: Query History ​

  • Docs: pages/admin/monitoring/query-history.md
  • What it does:
    • Live view: a live feed plus a time-range picker with Move back/forward and a ▶ live button.
    • API tab (requests to the data APIs):
      • All queries (by recency) vs Top queries (by hits × avg duration), each capped at 100 unique queries.
      • Filters: duration, cache status, pre-aggregation hit, error, API type, and Source (request_source: cube, sql-runner, playground, embedding, cube-excel-addin, cube-sheets-addon, ai-engineer, other).
      • Columns: query (REST JSON form, or raw SQL for SQL API), API type (REST over HTTP or WS, GraphQL, SQL), duration, cache-type icon, time.
      • Detail tabs: Query JSON, Error, Generated SQL (with Open in Explore), Pre-aggregation used, Security context, Queue graph (concurrent queue activity), Flame graph (time across components).
    • Database tab (SQL sent to data sources): Query, Error, and Events (queue events with timestamps).
    • Retention and throughput by Query History tier: XS 1 day / 50k req/day … XL 30 days / 1M req/day.
    • Platform API: GET /api/v1/deployments/{id}/query-history/requests (filters from, to, status, apiType, minDurationMs, search; cursor first/after) and /requests/{id}. Needs APMRead. Covers production only, not dev branches or meta calls. Also available through the CLI.
  • Availability: CORE+CLOUD. Core: emits all the raw events (Load Request / Load Request Success with query, duration, apiType, queriesWithPreAggregations, dbType, securityContext, requestId; Query started/Query completed/Performing query completed; queue events; SQL API planning events) to the logger and, via CUBEJS_AGENT_ENDPOINT_URL, to an HTTP/WS collector. Cloud: the collector, storage, UI, flame/queue graphs, API, retention tiers, and the request_source tagging (a JWT claim requestSource that Cloud reserves; not found in Core code).
  • Core building blocks to use:
    • CUBEJS_AGENT_ENDPOINT_URL (+ CUBEJS_AGENT_FRAME_SIZE / FLUSH_INTERVAL / MAX_SOCKETS), or a custom logger in cube.js.
    • CUBEJS_LOG_LEVEL=info (trace for more).
    • CUBEJS_SQL_INCLUDE_TRACE_ID to correlate with warehouse query history.
    • requestId (x-request-id header) as the trace key.
    • DELETE /v1/running-query/:requestId for cancel.
  • To build on Core:
    • A collector service that accepts deflated JSON batches.
    • Storage in a time-series or columnar store (ClickHouse, DuckDB or Postgres).
    • An event-to-request stitcher by requestId.
    • A UI for the list, filters, top queries and detail tabs.
    • Optionally, a request-source claim in your JWTs.
    • Effort M for list/detail/filters, L with queue and flame graphs.
  • Gotchas: events sent to the agent endpoint are not redacted (they hold filter values and the security context), so treat the store as sensitive. The event schema is internal and undocumented, so it may change between Core versions. Flame-graph data needs fine-grained span events; check which ones Core emits before promising that view.

Monitoring: Query History export (and DuckDB analysis recipe) ​

  • Docs: pages/admin/monitoring/monitoring-integrations/index.md#query-history-export, pages/admin/monitoring/query-history-export.md
  • What it does:
    • Pipeline: the Vector query-history input streams one record per API request to any sink.
    • Record fields: trace_id, account_name, query_history_link, deployment_id, environment_name (NULL for prod), api_type, api_query, security_context, status (success/error), error_message, start_time_unix_ms, end_time_unix_ms, api_response_duration_ms, cache_type (no_cache, pre_aggregations_in_cube_store, …).
    • Tier requirement: needs the Monitoring Integrations tier M (50 GB/mo). On XS or S it fails silently.
    • Recipe: a Vector aws_s3 sink writing gzip JSON, then a Cube requests cube over read_json_auto('s3://…/**/*.log.gz') with DuckDB. It has count/total/avg/median/min/max duration measures, production_environment and errors segments, and an hourly pre-aggregation refreshed every 10 min.
    • Use cases: queries missing pre-aggregations, slow-query alerts, chargeback per user.
  • Availability: CORE+CLOUD. Enterprise. The record is derived from Core events (see above); Vector packaging and the tier are Cloud. The DuckDB analysis model itself is pure Core.
  • Core building blocks to use: the agent endpoint / logger events; the DuckDB driver (CUBEJS_DB_DUCKDB_S3_*) to model the exported data back in Cube.
  • To build on Core: a small transformer from Core events to this flat record; write to S3 or a DB; reuse the documented cube model. Effort S.
  • Gotchas: security_context holds PII; apply your own redaction.

Monitoring: Pre-Aggregations console ​

  • Docs: pages/admin/monitoring/pre-aggregations.md
  • What it does:
    • List: every pre-aggregation with last build time, build duration, size and partition count.
    • Detail tabs:
      • Partitions: per-partition build time and size, Build all / Build N selected.
      • Definition: JSON.
      • Preview: sample rows.
      • Used by: recent queries that hit it.
      • Indexes.
    • Build history: last 24 h of builds with status, trigger, start time, duration, size and build steps.
    • Permissions: Admin/Developer can view and build. Custom roles: PreAggregationRead (read-only; build/cancel buttons hidden), PreAggregationBuild.
    • Branches: builds from staging/dev branches land in the same schema as production and may delete unused production tables.
  • Availability: CORE+CLOUD. Core: /cubejs-system/v1/pre-aggregations (list), /partitions, /preview, /build, /queue, /cancel, /security-contexts, /timezones (enabled by CUBEJS_PLAYGROUND_AUTH_SECRET); public POST /v1/pre-aggregations/jobs (Orchestration API) and /can-use; build log events. Cloud: the UI, the 24 h build-history store and "Used by" (from Query History).
  • Core building blocks to use: the system endpoints above, Orchestration API, scheduled_refresh_*, refresh-worker logs (Refreshing pre-aggregation content, Error refreshing pre-aggregation, …), and Cube Store SYSTEM tables via the SQL API, if exposed.
  • To build on Core: a UI over the system API; a build-history store fed from log events; a "used by" join with your query-history store (usedPreAggregations per request). Effort M.
  • Gotchas: the system endpoints are undocumented and gated by the playground auth secret, so don't expose them publicly. Builds triggered from branches share the same pre-aggregation schema.

Monitoring: Performance Insights ​

  • Docs: pages/admin/monitoring/performance.md
  • What it does:
    • Charts:
      • API instance count over time (to tune autoscaling min/max and auto-suspend)
      • Requests and average response time by cache type (pre-agg / in-memory / no cache)
      • Requests that waited for data-model compilation, and total wait time
      • Cube Store worker saturation and wait time for queries and for jobs
    • What the charts tell you: when to add pre-aggregations or indexes, to raise the instance minimum, to fix context_to_app_id bucketing, to use a multi-cluster deployment, or to add Cube Store workers.
    • Premium and above; the data is governed by the Query History tier.
  • Availability: CORE+CLOUD. Request, cache-type and compile-wait data come from Core events (Load Request Success has queriesWithPreAggregations, plus compile events such as Compiling schema completed). Instance counts and worker saturation are Cloud infrastructure telemetry (Kubernetes), though Cube Store can emit statsd metrics.
  • Core building blocks to use: the logger / agent endpoint events; CUBESTORE_METRICS_* (statsd/dogstatsd); container metrics from your orchestrator (cAdvisor/Prometheus).
  • To build on Core: dashboards in Grafana over the query-history store plus Cube Store statsd plus container metrics. Effort S–M.
  • Gotchas: the compile-wait metric needs correlation between compile events and requests; Core may not tag a request as "waited for compile". Check the events before relying on it.

Monitoring: Monitoring integrations (Vector-based log & metric export) ​

  • Docs: pages/admin/monitoring/monitoring-integrations/index.md + sub-guides:
    • cloudwatch.md: aws_cloudwatch_logs sink. Keyless OIDC via CUBE_CLOUD_MONITORING_AWS_ROLE_ARN (requires the :component: sub claim and logs:DescribeLogGroups on *). Keyless does not cover warmup-job.
    • datadog.md: datadog_logs + datadog_metrics with the site option.
    • grafana-cloud.md: loki sink (basic auth, labels) + prometheus_remote_write.
    • gcs.md: gcp_cloud_storage with Cube-specific credentials_base64. The sink name must be lowercase/digits/dashes. Disable the healthcheck (it needs storage.objects.list).
    • new-relic.md: new_relic sink, api = logs|metrics.
    • s3.md: aws_s3 sink, healthcheck off, region-mismatch error.
  • What it does:
    • Setup: "Enable Vector" adds a Vector agent per deployment. Sinks are configured in vector.toml committed next to cube.js on the main branch. Secrets come from env vars prefixed CUBE_CLOUD_MONITORING_. Production environments only; paused while auto-suspended.
    • Log inputs: cubejs-server, refresh-scheduler, warmup-job, cubestore (with a levels filter, default error+info), query-history, chat-history.
    • Added log fields: deployment_id, deployment_name, hostname, pod_name, service, level, status, origin=cube_cloud. Datadog sinks also get ddsource/ddtags.
    • Metric input metrics:
      • Gauges: cube_cpu_usage_ratio, cube_memory_usage_ratio.
      • Counters (reset at UTC midnight): cube_requests_total, _success_total, _errors_total, cube_requests_duration_ms_total|_success|_errors.
      • Labels: deployment_id, api_type, request_source, pod_name.
      • A built-in prometheus_exporter has credentials shown in the UI (CUBE_CLOUD_MONITORING_METRICS_USER/PASSWORD).
    • Tiers: XS 10 GB, S 25 GB, M 50 GB per month (M is required for query and chat history export).
  • Availability: CORE+CLOUD. Enterprise. Core: writes JSON logs to stdout in production (CUBEJS_LOG_LEVEL, CUBEJS_LOG_REDACTION), has the custom logger hook, and Cube Store statsd metrics. Cloud: the managed Vector sidecar, field enrichment, the cube_requests_* Prometheus metrics (derived, not exposed by Core), and the tiers.
  • Core building blocks to use: stdout JSON logs; logger option; CUBESTORE_METRICS_*; agent endpoint events.
  • To build on Core: run your own Vector/Fluent Bit/OTel collector reading container stdout, plus a small transform that derives request counters and durations from Load Request Success / error events (or a logger hook that increments prom-client counters and exposes /metrics on a side port). Effort S.
  • Gotchas: Core has no built-in /metrics, so request metrics must be derived. Redaction applies to logs but not to agent-endpoint events.

Monitoring: Usage Analytics ​

  • Docs: pages/admin/monitoring/usage-analytics.md
  • What it does:
    • Pre-built dashboards: Overview; Query Activity & Performance (volume by API, latency percentiles, execution-stage breakdown, slowest queries, errors, heatmap); Users & Adoption (active, new vs returning, seat utilization, dormant); AI & Token Tracking (messages and conversations by surface, adoption, tokens with estimated cost, latency).
    • Curated views: API Requests, AI Usage, AI Calls & Cost (per LLM call, by model, conversation, embed user and billing line), Users & Adoption, Dashboard Usage, Engagement, Interactions, Authoring, Inventory, Metered Usage, Billing Spend, Invoices.
    • Implementation: a Cube app in Creator Mode, embedded in the admin UI. Users can build their own dashboards over the views.
    • Token API: POST /api/v1/usage-analytics/token returns a 1 h Cube API token + apiUrl to query the views over REST.
    • Data: delayed; account-scoped by RLS; admins only.
  • Availability: CLOUD-ONLY. Premium and above, admins only. Evidence: plan badge; a hosted usage-analytics deployment.
  • Core building blocks to use: the pattern itself is "Cube on its own telemetry". Point a Core deployment at your query-history/chat/LLM-call tables and model them as cubes and views, with RLS via access policies.
  • To build on Core: telemetry tables (requests, AI calls with tokens and cost, user activity, dashboard events) plus a Cube model plus dashboards. Effort M (depends on what telemetry you already collect).
  • Gotchas: client-side dashboard engagement events must be collected by your UI. Cost estimates need a model price table.

Monitoring: Chat history (and chat history export) ​

  • Docs: pages/admin/monitoring/chats-history.md, monitoring-integrations/index.md#chat-history-export
  • What it does:
    • Admin viewer: Monitoring → Chat history shows all users' threads for a deployment. Search by first message or chat UUID. Filters: user type, creation date, source (Web incl. Excel/Sheets panes, MCP, Slack, Scheduled, API).
    • Thread view: shows context-window usage ("34% of 200K context") and, for dashboard agent panels, the originating dashboard.
    • Deep link: /d/<deployment>/chat-history/<chat_uuid>.
    • Access: admin or ChatHistoryRead.
    • Chat History API (admin-only): GET /api/v1/deployments/{id}/chat-history/threads (filter dashboardPublicId, repeatable up to 100), and a get-thread endpoint.
    • Export via the Vector chat-history input (preview; M tier plus an "Export chat history" toggle):
      • One record per turn: schemaVersion=1, eventId, tenantId, deploymentId, chatId, messageId, source, user{id,type,externalId}, agentId, startedAt, endedAt, status (completed|failed|stopped), prompt, finalAnswer, queries[] (tool = cubeSqlApi|runSql, title, sql, dataSource, status, error, rowCount, requestId, executedAt), truncated, omittedQueryCount.
      • Text over 20k chars is clipped and records are capped at 256 KB.
      • Delivery is at-least-once: dedupe on eventId, keeping the latest endedAt.
      • Not redacted. Eval runs are excluded.
  • Availability: CLOUD-ONLY (chat itself is Cloud-only). Export is Enterprise.
  • Core building blocks to use: requestId to link agent queries to Core query events.
  • To build on Core: persist threads, messages and tool calls in your chat backend (you need them anyway); an admin viewer with filters; a turn-level export event with the schema above; context-usage accounting from LLM responses. Effort S–M (on top of the chat system).
  • Gotchas: prompts and SQL contain sensitive data. Gate viewing with a permission and log access.

Monitoring: Alerts ​

  • Docs: pages/admin/monitoring/alerts.md
  • What it does:
    • Event types: API outages, Database response timeouts, Pre-aggregation build failures, Build completed (with status, no resolve), or All.
    • Condition alerts: send a "Resolved —" email when they clear. Re-send is suppressed for 1 h (API and DB) or 3 h (pre-aggregations).
    • Scope: all deployments or specific ones.
    • Recipients: all users (only those who have ever signed in) plus extra emails, or specific users and emails, deduplicated.
    • Channels: email only, plus an in-app inbox. Per-user unsubscribe from emails keeps inbox notifications.
    • Permissions: admins (below Enterprise). Enterprise uses AlertsCreate/Read/Update/Delete, granted only through the built-in Developer/AIBI Developer roles, not through custom roles. The same actions govern budgets.
  • Availability: CLOUD-ONLY. Premium and above. Evidence: plan badge; Cloud UI.
  • Core building blocks to use: /readyz and /livez for API outage; orchestrator events (Cancelling query due to timeout, Error querying db) for DB timeouts; refresh events (Error refreshing pre-aggregation, Pre-aggregations build job error); build events come from your CI/CD.
  • To build on Core: health probes plus log-based alert rules in Prometheus/Alertmanager/Grafana, or a small alert service with dedup windows and resolve emails. Effort S (with existing observability tooling).
  • Gotchas: keep the dedup window and resolve semantics so alerts don't storm.

Monitoring: Audit Log ​

  • Docs: pages/admin/monitoring/audit-log.md
  • What it does:
    • Enable and view: toggle under Team & Security → Audit log. A table shows time, user email, event, deployment; the detail view shows IP and event attributes.
    • Sanitization: env var and encryption key values are never stored ([REDACTED]/[HIDDEN]). Attributes whose name contains PASS/SECRET/TOKEN/KEY become [HIDDEN]. Embedded secrets (JWTs, Bearer tokens, URL passwords, provider keys, long random strings) become [MASKED] (kind).
    • Filters: full-text search, date range, user, event, deployment.
    • Export: CSV download, and the /api/v1/audit-logs/export API (an account-wide key is required).
    • Event catalog: users, SCIM, custom roles, auth (login/logout/SAML), account and SSO settings, deployments and env vars, encryption keys, OIDC, OAuth integrations, branches and dev mode, Git/CD, budgets, dashboard comments. UI and Platform API changes are logged the same way.
    • Tiers: S/M (M adds export), at 4–6 CCU/h.
  • Availability: CLOUD-ONLY. Enterprise. Evidence: plan badge; all audited objects are Cloud control-plane objects.
  • Core building blocks to use: none (Core has no admin plane). Core Auth Error events can feed security monitoring.
  • To build on Core: an append-only audit table written by your control-plane service, a sanitizer, a UI, and CSV/API export. Effort S–M.
  • Gotchas: sanitize before storing, not at display time.

SSO: Authentication methods & SAML SSO (Google Workspace, Okta, Microsoft Entra ID) ​

  • Docs: pages/admin/sso/index.md, google-workspace.md, okta/saml.md, microsoft-entra-id/saml.md
  • What it does:
    • Sign-in methods: toggles for Password, Google, GitHub and SAML under Admin → Settings → Authentication & SSO.
    • SP values: Cube shows the Single sign-on URL (ACS) and the Audience (SP entity ID). For new integrations, set the Audience equal to the SSO URL. A blank Audience disables audience validation (legacy).
    • IdP fields: Entity ID/issuer, SSO URL, X.509 certificate. Entra metadata XML can be uploaded to auto-fill them.
    • Attributes: email and name. The groups attribute defaults to groups; Entra's canonical groups claim URL is read automatically. Entra must sign both response and assertion.
    • Auto-provisioning: users are created on first login. The default role is Viewer, or a picked built-in or custom role (not Admin). If the configured role is deleted, new users fall back to Viewer.
    • Map roles by group: IdP group display name (case-insensitive) → Cube role. Applied only at first login (it replaces the default role) and on SCIM group pushes. Additive: roles are never removed.
    • Test: login URL <cube url>/sso/saml. Keep another auth method enabled while testing.
  • Availability: CLOUD-ONLY. Enterprise (SAML). Evidence: plan badge; no SAML code in Core. Core only verifies JWTs (CUBEJS_JWT_*, jwt.jwkUrl, check_auth). It has no user login.
  • Core building blocks to use: JWT/JWK verification (jwt.jwk_url, issuer, audience, claims_namespace), check_auth, context_to_groups, and security context claims cubeCloud.groups / cubeCloud.userAttributes.
  • To build on Core: an app-level IdP integration (Keycloak, Auth0, or Dex; or a SAML library such as passport-saml or python3-saml); a user DB; JIT provisioning with a default role and a group→role map; minting a Cube JWT with groups and attributes per session (or using the IdP's OIDC ID token directly via jwk_url). Effort M.
  • Gotchas: Cube's mappings are add-only and apply at first login only, which is a known staleness trap. Decide whether yours re-syncs on every login. Always validate the audience.

SSO: SCIM provisioning (Okta, Microsoft Entra ID) ​

  • Docs: pages/admin/sso/okta/scim.md, pages/admin/sso/microsoft-entra-id/scim.md (spec: specs/scim.yaml, /scim/v2/Users, /Users/{id}, /Groups, /Groups/{id})
  • What it does:
    • Setup: enable "SCIM provisioning" in the SAML section. The base URL is <cube url>/api/scim/v2 and the bearer is a Cube API key.
    • Okta: push new users, profile updates and groups. Supports create, update and deactivate. Users must be assigned to the app; "Provision User" fixes users assigned before SCIM was enabled.
    • Entra: automatic mode. Keep only userName, displayName, active (users) and displayName, members (groups).
    • Default role: SCIM-created users get the SAML default role. Existing users are untouched.
    • Group pushes: apply the SAML group→role map, additive only (removing a user from a group doesn't revoke the role).
    • User attributes: synced via the custom SCIM attribute urn:cube:params:1.0:UserAttribute:<reference> (string or integer).
  • Availability: CLOUD-ONLY. Enterprise. Evidence: plan badge; Cloud /api/scim/v2; no SCIM in Core.
  • Core building blocks to use: none directly. SCIM-synced groups and attributes end up in the JWT as cubeCloud.groups / cubeCloud.userAttributes for Core access policies.
  • To build on Core: a SCIM 2.0 server (libraries exist, e.g. scim2 for Node, or use Keycloak plus a SCIM plugin) writing to your user, group and attribute tables; deactivation that revokes sessions. Effort M.
  • Gotchas: Entra and Okta SCIM dialects differ (PATCH semantics). Token refresh is needed so attribute changes reach Core (JWTs are stateless).

Users & permissions: User management ​

  • Docs: pages/admin/users-and-permissions/manage-users.md
  • What it does:
    • Invite: Admin → Users → Add User: email, built-in role (Admin, Developer, Explorer, Viewer), optional custom roles. This generates a copyable invite link (activation sets a password), which can be resent.
    • User page: name, role, custom roles, groups, attribute values.
    • Deactivate and reactivate: deactivation kills sessions immediately. You can't deactivate yourself or the last admin.
    • Delete: irreversible, and not allowed for yourself.
    • Permissions and billing: only admins manage users; admins are billed at the developer rate. SCIM and SAML JIT users get the default role.
  • Availability: CLOUD-ONLY (all plans). Evidence: Cloud control plane; Core has no user store.
  • Core building blocks to use: none (Core is stateless about users). Your JWT minting is the bridge.
  • To build on Core: a users table, invite flow (email/token), session management, admin UI. Effort S–M (or delegate to an IdP).
  • Gotchas: deactivation must also invalidate Cube JWTs. Use short expiry or a denylist in check_auth.

Users & permissions: Built-in roles, permission matrix, download controls, role API ​

  • Docs: pages/admin/users-and-permissions/roles-and-permissions.md
  • What it does:
    • Permission matrix:
      • Admin: users and account settings.
      • Developer and above: deployments, model editing, source SQL.
      • Explorer and above: explore and query, workbooks.
      • All roles: view dashboards, export, chat, BI tools via the SQL API, the agent emailing themselves.
      • Admin only: the agent emailing other members.
    • Download controls: an account-wide "Allow data downloads" switch (wins over everything, including admins and embeds), plus a per-user DownloadData action. Both hide buttons only; data is still rendered.
    • Built-in role IDs: Developer -3 (AIBIDeveloper), Explorer -4 (AIBIUser), Viewer -6 (AIBIViewer), legacy Developer -1. Admin is the isAdmin flag (PUT /api/v1/users/{id}) or comes via a group; it can't be assigned by role ID.
    • Role API: PUT/DELETE /api/v1/roles/{roleId}/users/{userId} (idempotent), and GET /api/v1/roles/{id}/users (cursor paging; each user lists roles[] with direct/groupIds). Admin-only, with an account-wide API key.
    • Stacking: permissions stack. SSO never removes roles.
  • Availability: CLOUD-ONLY. Evidence: Cloud control-plane API.
  • Core building blocks to use: context_to_api_scopes (Core API scopes meta, data, graphql, sql, jobs) to block, e.g., Viewers from the raw query APIs; access policies for data.
  • To build on Core: an RBAC model in your app (roles → permissions) mapped into JWT claims/scopes; UI gating. Effort S–M.
  • Gotchas: "download disabled" is UI-only in Cloud. If you need real enforcement, block the API scopes too.

Users & permissions: Custom roles (Enterprise RBAC) ​

  • Docs: pages/admin/users-and-permissions/custom-roles.md
  • What it does:
    • Structure: a role has a Base Role/license tier (AIBIView | AIBIExplore | AIBIDevelop), Global permissions, and N deployment policies (scope All or specific deployment IDs; actions or Full access All).
    • Union: a user holds the union of all roles; their tier is the max Base Role.
    • Global actions: SignIn (console sign-in; doesn't affect API keys, SQL API, signed embedding), AuditLogManage, BillingRead, ChartPalettesManage, DashboardThemesManage, OAuthIntegrationsManage, OAuthIntegrationsIssueTokens, McpToolsManage, DeploymentsManage, SendEmailToSelf, SendEmailToWorkspaceMembers.
    • Deployment actions:
      • General: DeploymentRead/Update/Delete, SecretsManage.
      • Data model and SQL: SchemaRead/Update/UpdateDevBranches, SqlRunnerRead.
      • AI and automation: DeploymentAgentRead, ScheduledTasksCreate/Read/Manage, AutomationsCreate/Read/Manage.
      • Monitoring: APMRead, ChatHistoryRead.
      • Data and pre-aggregations: DownloadData, PreAggregationRead/Build.
    • Auto-bump in the builder: checking anything outside 11 exempt actions forces the Developer tier (client-side only).
    • Builder validation: reserved names. Empty policies are dropped on save, while the API rejects them with 400.
    • API: POST/GET/PUT/DELETE /api/v1/roles. The wire format is a list of {resourceType: Global|Deployment|Report|Workbook|Agent|ChatThread, actions, resources}. PUT replaces policies. Duplicate names return 409. The API doesn't add SignIn or a tier automatically.
    • Legacy migration: roles saved earlier implicitly hold some newer actions.
  • Availability: CLOUD-ONLY. Enterprise plan. Evidence: plan badge; Cloud control-plane objects.
  • Core building blocks to use: context_to_api_scopes, access policies keyed by groups (context_to_groups) for data-side permissions.
  • To build on Core: a policy engine (resourceType × actions × resources) in your control plane (Casbin, OPA or plain tables); a role builder UI; enforcement in every backend endpoint. Effort M–L, depending on how many product surfaces you gate.
  • Gotchas: keep app RBAC (what screens and actions) separate from data security (Core access policies).

Users & permissions: User groups ​

  • Docs: pages/admin/users-and-permissions/user-groups.md
  • What it does:
    • Groups: Admin → User Groups: name, description, members. Groups are used by access policies (group/groups) and rule conditions, and are synced via SCIM.
    • Roles on groups (preview): every member gets the role. Roles only add, with no deny, and that includes Admin granted via a group. A user's page shows effective access with the granting group.
  • Availability: CORE+CLOUD. Core: access-policy group/groups matching via context_to_groups (verified in CompilerApi.js) and securityContext.cubeCloud.groups shorthand handling. Cloud: group CRUD UI, membership store, role-to-group assignment, SCIM sync.
  • Core building blocks to use: context_to_groups, access_policy.
  • To build on Core: groups and membership tables plus UI; put groups into the JWT; implement context_to_groups to read them. Effort S.
  • Gotchas: group-granted Admin is an escalation path, so restrict who can edit group roles.

Users & permissions: User attributes ​

  • Docs: pages/admin/users-and-permissions/user-attributes.md
  • What it does:
    • Definitions: Admin → Attributes: name, type, default, display name. Per-user values are set on the user page or synced via SCIM (Entra) and signed embedding.
    • Use in access policies: referenced as { userAttributes.city }, e.g. row_level.filters: [{member: customers_city, operator: equals, values: ["{ userAttributes.city }"]}].
    • Other uses: rule conditions, and BYOM header context.
  • Availability: CORE+CLOUD. Core: the schema compiler transpiles userAttributes.x / user_attributes.x to securityContext.cubeCloud.userAttributes.x (verified in CubePropContextTranspiler.js), so policies work in Core if the JWT carries cubeCloud.userAttributes. Cloud: attribute definitions, per-user values UI, defaults, SCIM sync.
  • Core building blocks to use: security context (cubeCloud.userAttributes key), access policies, extend_context/check_auth to inject attributes server-side.
  • To build on Core: an attribute-definition table, per-user values, defaults, and injection into JWT claims at mint time (or check_auth lookup). Effort S.
  • Gotchas: stateless JWTs mean attribute changes apply only after token refresh. Default values must be applied before minting, because a missing attribute breaks filters.

Account & billing: API keys ​

  • Docs: pages/admin/account-billing/api-keys.md
  • What it does:
    • Who can hold keys: admin keys by default. "Allow all users to create API keys" enables personal keys, which carry exactly the owner's permissions. That setting is only allowed while RBAC is enforced; turning it off makes personal keys return 403 (they aren't deleted).
    • Deployment scope: All, or specific deployments. Org-wide endpoints (MCP token, audit log export, user and role management, OIDC configs) require an all-deployments key.
    • Endpoint scope: allowedEndpoints: IDs such as AuditLogPublicController.exportAuditLog or groups Controller.*. Empty means all. Endpoints that return another credential reject endpoint-limited keys.
    • Admin-only uses: embed session generation; an MCP token acting as another user.
    • Keys are also manageable via the Platform API.
  • Availability: CLOUD-ONLY. Evidence: Cloud control-plane API keys. Core auth is a JWT signed with CUBEJS_API_SECRET (or JWKS), with no key management.
  • Core building blocks to use: check_auth (can validate opaque API keys against your store), context_to_api_scopes.
  • To build on Core: a hashed API-key store, scopes (deployment and endpoint), and a token-exchange endpoint that mints short-lived Cube JWTs from an API key. Effort S.
  • Gotchas: never hand out CUBEJS_API_SECRET; exchange keys for short-lived JWTs.

Account & billing: AI tokens, quotas, spending limits ​

  • Docs: pages/admin/account-billing/ai-tokens.md, pricing.md#ai-tokens
  • What it does:
    • What drives consumption: task complexity, data-model context size, and the model chosen. Agentic multi-step calls each consume tokens.
    • Allocations:
      • On-demand plans: per-seat monthly grants worth half the seat price (per user, no rollover), then on-demand overage billed to the card, capped by an admin "monthly on-demand spending limit".
      • Contract plans: pooled token packages (valid for the contract, combinable, no auto-renew).
      • Free plan: a per-user monthly allowance.
    • Limit reached: the error Token limit exceeded. Please purchase or allocate more tokens. Admins are sent to billing; others are told to contact an admin.
    • Tracking: an "AI Tokens Usage" tab (usage over time, remaining allocation, breakdown by dimension) and "Cost and usage" balance chips per credit package. BYOM is recorded at zero cost.
    • Pricing: token price is passed through at provider cost with no markup.
  • Availability: CLOUD-ONLY. All plans. Evidence: Cloud billing.
  • Core building blocks to use: none.
  • To build on Core: an LLM gateway that meters tokens per user, account and model (LiteLLM proxy has budgets built in); a quota check before each agent turn; usage UI. Effort S–M.
  • Gotchas: count tokens from provider responses, not estimates. Small-LLM background calls count too.

Account & billing: Pricing, CCUs, tiers, billing FAQ ​

  • Docs: pages/admin/account-billing/pricing.md, billing-faq.md
  • What it does:
    • CCU metering: CCUs are metered in 5-minute intervals.
    • Tiers: Free (2 shared deployments, dev only); Starter (dedicated deployment, pre-aggregations up to 150 GB, auto-suspend); Premium (multi-cluster, custom domains, 99.95% SLA); Enterprise (SAML, dedicated infra, private connectivity, monitoring integrations, RBAC, 99.99% SLA).
    • Resource CCU rates:
      • Dedicated deployment 4–8 CCU/h; Shared 1–2; API instance 1–2. The Performance M tier is needed for DAX/MDX.
      • Cube Store worker 1–32 CCU/h. Performance M or higher is needed for customer-managed-key encryption.
      • Query History XS–XL: 0–20 CCU/h, 1–30 days retention.
      • Monitoring Integrations XS/S/M: 1/2/4 CCU/h.
      • Audit Log S/M: 4/6 CCU/h.
      • Single-tenant infrastructure: 3 CCU/h.
    • Payments: on-demand via Stripe card or Link, with seats billed in advance and prorated in arrears; contract terms are annual, Net 30, ACH/wire. Failed payments are retried, and the account can be suspended.
  • Availability: CLOUD-ONLY. Commercial terms only, nothing to rebuild. These tiers do show which Cloud features depend on paid add-ons (Query History retention, Monitoring M tier for exports).
  • Core building blocks to use: n/a.
  • To build on Core: nothing required. If you resell, you'd need metering + Stripe billing (L).
  • Gotchas: DAX/MDX APIs and customer-managed-key encryption are tied to Cloud performance tiers. Check other slices for whether they exist in Core.

Account & billing: Support ​

  • Docs: pages/admin/account-billing/support.md
  • What it does:
    • Channels by tier: Free uses docs and Slack. Starter adds 2 tickets per month. Premium has 4 tickets per month on-demand or unlimited on contract (P0 60 min, P1 4 h, P2 8 business h, P3 2 business days). Enterprise has unlimited tickets (P0 30 min, P1 2 h) plus a CSM.
    • Hours: weekdays 8am–8pm ET.
  • Availability: CLOUD-ONLY (a commercial service). Nothing to build.
  • Core building blocks to use: n/a. To build on Core: n/a. Gotchas: with self-built Core you only get community support (Slack/GitHub).

Customization: App theme (branding) ​

  • Docs: pages/admin/customization/app-theme.md
  • What it does:
    • Scope: one account-wide theme, admin-only.
    • Light and Dark schemes: each has an Accent, Background and Foreground color plus a Contrast value (0–100, 45 is neutral). The full accessible palette (borders, muted text, states, hover) is generated from these.
    • Logo: an HTTPS URL to a PNG, SVG, JPG or WebP file. Shown at 24×24 in the nav and up to 48 px high in apps, only if the file is ≤512 KB.
    • Fonts: an HTTPS font file (woff2/woff/ttf/otf) or a CSS @font-face stylesheet (Google Fonts). Cube fetches and validates them. Body and heading fonts and weights are assigned separately.
    • Editing: a live preview with Light/Auto/Dark, Restore defaults and Revert.
    • Where it applies: embedded surfaces (Creator Mode, published dashboards, embedded chat) always. "Apply across Cube Cloud" extends it to the whole console (not sign-in pages) and to email/Slack/PNG/PDF snapshots. Apps use the theme and the default chart palette.
  • Availability: CLOUD-ONLY. Evidence: Cloud UI feature.
  • Core building blocks to use: none (UI-only).
  • To build on Core: a theme JSON in DB → CSS variables; palette generation (e.g. a Radix-style scale from the accent, with an APCA/WCAG contrast check); a font loader. Effort S–M.
  • Gotchas: server-rendered snapshots (PDF/PNG) must apply the same theme. Validate font URLs (SSRF, size).

Customization: Chart palettes ​

  • Docs: pages/admin/customization/chart-palettes.md
  • What it does:
    • Palettes: built-in palettes (read-only) plus custom palettes (name + comma-separated hex list), account-wide across deployments.
    • Default palette: "Set as default" (starred) applies to charts with no palette and to apps. The default can't be deleted.
    • Per chart: the Style panel's Palette dropdown filters to discrete palettes for categorical encodings and continuous ones for quantitative or temporal encodings.
    • Changes: edits propagate to charts that use the palette. Deleting a palette makes its charts fall back to the default.
    • Permission: ChartPalettesManage.
  • Availability: CLOUD-ONLY. Evidence: Cloud workbook/dashboard UI.
  • Core building blocks to use: none. Member meta could carry per-member color hints.
  • To build on Core: a palette table plus a picker in your charting layer. Effort S.
  • Gotchas: store a palette reference on each chart (not the copied colors) so edits propagate.

Customization: Dashboard themes ​

  • Docs: pages/admin/customization/dashboard-themes.md
  • What it does:
    • Theme properties: Dashboard (background, padding), Widgets (card background, padding), Borders (color, width, style, radius), Titles (color, size, weight, family), Text (color, secondary color, family, code family).
    • Built-in theme: "Cube" is always available and immutable.
    • Creation: themes are created from the dashboard builder's Theme tab ("Save as new"). The admin page only renames and deletes.
    • Overrides: per-dashboard tweaks on top of a theme are stored as overrides. "Save" pushes the effective styles back into the theme, updating every dashboard that uses it; published snapshots keep their old styling until re-published.
    • Deletion: dashboards using a deleted theme revert to Cube.
    • Scope: themes are account-wide; assignment is per dashboard.
    • Permission: DashboardThemesManage.
  • Availability: CLOUD-ONLY. Evidence: Cloud dashboards feature.
  • Core building blocks to use: none.
  • To build on Core: a theme JSON schema, theme plus override merge in the dashboard renderer, and a theme CRUD. Effort S (assuming you already have dashboards).
  • Gotchas: snapshot/publish semantics: decide whether published dashboards pin theme versions.

Summary table ​

FeatureAvailabilityPlanEffort to build on CoreDepends on
Agent config as code (single agent)CLOUD-ONLYAll w/ AIL (M basic)LLM runtime, /v1/meta, SQL API, chat backend
LLM providers / BYOM / small LLMCLOUD-ONLYEnterprise (BYOM)M (L w/ OIDC)Model registry, secrets store, provider SDKs
Rules (always / agent_requested / conditions)CLOUD-ONLYAll w/ AISAgent runtime, groups/userAttributes in security context
Certified queriesCLOUD-ONLYAll w/ AIS–MSQL API, retrieval (embeddings)
SkillsCLOUD-ONLYAll w/ AISAgent runtime, chat UI slash menu
Multi-agent, spaces, reconciliation, default agentCLOUD-ONLYAll w/ AIMDB for spaces/agents, config loader
MemoriesCLOUD-ONLYAll w/ AIMVector store, embedding model, small LLM, tenant keys
MCP Connectors (outbound)CLOUD-ONLYPremium, EnterpriseM (L w/ per-user OAuth)MCP client SDK, OAuth, secrets store
EvalsCLOUD-ONLYAll w/ AI (CI preview)MSQL API, agent SQL capture, job runner, LLM judge
Agent permissions & guardrailsCORE+CLOUDAllSCore access policies, per-user JWT, tool gating
Query HistoryCORE+CLOUDAll (tiers)M–LCUBEJS_AGENT_ENDPOINT_URL / logger events, event store, UI
Query History export (+DuckDB recipe)CORE+CLOUDEnterprise (Monitoring M)SCore events, S3/DB, DuckDB driver
Pre-Aggregations consoleCORE+CLOUDAll (custom-role perms Enterprise)M/cubejs-system/v1/pre-aggregations/*, Orchestration API, log events
Performance InsightsCORE+CLOUDPremium+S–MCore events, Cube Store statsd, container metrics
Monitoring integrations (Vector logs/metrics + 6 vendor guides)CORE+CLOUDEnterpriseSstdout JSON logs, logger hook, own collector
Usage AnalyticsCLOUD-ONLYPremium+ (admins)MTelemetry tables, Cube model over them
Chat history (+ export)CLOUD-ONLYAll (export Enterprise, preview)S–MChat backend storage
AlertsCLOUD-ONLYPremium+S/readyz, /livez, log events, Alertmanager/email
Audit LogCLOUD-ONLYEnterpriseS–MYour control plane, sanitizer
Auth methods & SAML SSO (Google/Okta/Entra)CLOUD-ONLYEnterprise (SAML)MIdP/SAML lib, user DB, JWT minting / jwk_url
SCIM provisioning (Okta/Entra)CLOUD-ONLYEnterpriseMSCIM server, users/groups/attributes tables
User managementCLOUD-ONLYAllS–MUsers table, invites, JWT revocation
Built-in roles, permission matrix, download controlsCLOUD-ONLYAllS–MApp RBAC, context_to_api_scopes
Custom rolesCLOUD-ONLYEnterpriseM–LPolicy engine, role-builder UI
User groupsCORE+CLOUDAll (group roles preview)Scontext_to_groups, access policies
User attributesCORE+CLOUDAllSsecurityContext.cubeCloud.userAttributes, access policies
API keys (personal, deployment/endpoint scope)CLOUD-ONLYAllSKey store, check_auth / token exchange
AI tokens, quotas, spending limitsCLOUD-ONLYAllS–MLLM gateway metering (e.g. LiteLLM)
Pricing / CCUs / billing FAQCLOUD-ONLYn/an/a (L if reselling)Metering, Stripe
SupportCLOUD-ONLYTieredn/an/a
App themeCLOUD-ONLYAll (admin)S–MUI theming, font/logo validation
Chart palettesCLOUD-ONLYAllSCharting layer
Dashboard themesCLOUD-ONLYAllSDashboard renderer

Counts: 33 features. CORE 0, CORE+CLOUD 9, CLOUD-ONLY 24, UNCLEAR 0.

Pages read (43) ​

  • pages/admin/ai/index.md
  • pages/admin/ai/bring-your-own-model.md
  • pages/admin/ai/rules.md
  • pages/admin/ai/certified-queries.md
  • pages/admin/ai/skills.md
  • pages/admin/ai/multi-agent.md
  • pages/admin/ai/memory-isolation.md
  • pages/admin/ai/mcp-connectors.md
  • pages/admin/ai/evals.md
  • pages/admin/monitoring/query-history.md
  • pages/admin/monitoring/query-history-export.md
  • pages/admin/monitoring/pre-aggregations.md
  • pages/admin/monitoring/usage-analytics.md
  • pages/admin/monitoring/chats-history.md
  • pages/admin/monitoring/alerts.md
  • pages/admin/monitoring/audit-log.md
  • pages/admin/monitoring/performance.md
  • pages/admin/monitoring/monitoring-integrations/index.md
  • pages/admin/monitoring/monitoring-integrations/cloudwatch.md
  • pages/admin/monitoring/monitoring-integrations/datadog.md
  • pages/admin/monitoring/monitoring-integrations/grafana-cloud.md
  • pages/admin/monitoring/monitoring-integrations/gcs.md
  • pages/admin/monitoring/monitoring-integrations/new-relic.md
  • pages/admin/monitoring/monitoring-integrations/s3.md
  • pages/admin/sso/index.md
  • pages/admin/sso/google-workspace.md
  • pages/admin/sso/okta/saml.md
  • pages/admin/sso/okta/scim.md
  • pages/admin/sso/microsoft-entra-id/saml.md
  • pages/admin/sso/microsoft-entra-id/scim.md
  • pages/admin/users-and-permissions/manage-users.md
  • pages/admin/users-and-permissions/user-groups.md
  • pages/admin/users-and-permissions/user-attributes.md
  • pages/admin/users-and-permissions/roles-and-permissions.md
  • pages/admin/users-and-permissions/custom-roles.md
  • pages/admin/account-billing/billing-faq.md
  • pages/admin/account-billing/api-keys.md
  • pages/admin/account-billing/support.md
  • pages/admin/account-billing/ai-tokens.md
  • pages/admin/account-billing/pricing.md
  • pages/admin/customization/app-theme.md
  • pages/admin/customization/chart-palettes.md
  • pages/admin/customization/dashboard-themes.md

Also consulted for Core evidence (not in slice): pages/reference/configuration/config.md (logger, telemetry, context_to_groups), pages/reference/configuration/environment-variables.md (CUBEJS_LOG_LEVEL, CUBEJS_LOG_REDACTION, CUBEJS_SQL_INCLUDE_TRACE_ID, CUBESTORE_METRICS_*), specs/scim.yaml, api.txt.