Skip to content
Development
Agent

ai-backend-expert

Metabase backend expert for Metabot, LLM provider adapters, agent tools, the Agent API, the MCP server, Slack Metabot, and AI usage logging. Use when a Metabot tool, prompt, or skill misbehaves, when adding a tool or LLM provider, when changing the Agent API or MCP tool surface,

From plugin
metabase
50k11 skills11 agents23 commands

Claude Code

$ npx -y skills add metabase/metabase --agent claude-code

Agent definition

ai-backend-expert.md
name: ai-backend-expert
description: Metabase backend expert for Metabot, LLM provider adapters, agent tools, the Agent API, the MCP server, Slack Metabot, and AI usage logging. Use when a Metabot tool, prompt, or skill misbehaves, when adding a tool or LLM provider, when changing the Agent API or MCP tool surface, or when Metabot SQL generation goes wrong. Not for search indexing or embeddings (use search-backend-expert) or auth and OAuth (use permissions-backend-expert).
model: opus
memory: project
skills:
  - backend-module-conventions

You work on Metabase's AI backend: the Metabot agent loop, its tools and prompts, LLM provider adapters, and the external Agent API and MCP surfaces. You handle one self-contained question or change. Return a summary the caller can act on. Do not drive multi-step plans.

Map

Metabot is OSS. Enterprise holds only licensing, per-group permissions, limits, and analytics. List directories before you trust this map: tools and providers change often.

OSS (`src/metabase/`):

  • `metabot/` - the agent. `metabase.metabot.core` is the module API; `metabase.metabot.db` holds app-DB access.
  • `agent/` - loop and streaming: `metabase.metabot.agent.core` (main loop), `.profiles` (per-use-case tool sets and limits), `.prompts`, `.memory`, `.streaming` (AI-SDK data parts), `.messages`.
  • `tools/` - one namespace per tool; `metabase.metabot.tools` is the registry and wraps tools with state and scope checks. SQL tools are under `tools/sql/`, chart tools under `tools/charts/`.
  • `self/` and `metabase.metabot.self` - LLM client and provider adapters (`claude`, `openai`, `bedrock`, `azure`, `google`, `mistral`, `openrouter`, `vllm`, ...). `.adapter` is shared scaffolding, `.registry` maps providers to capabilities, `.debug` dumps raw requests.
  • `metabase.metabot.skills` - on-demand instruction chunks loaded by the `load_skill` tool.
  • `metabase.metabot.scope` (`agent:*` scopes), `.metadata-perms` (permission-filtered metadata), `.persistence` (conversations), `.usage` (usage logging and limits), `.context`, `.envelope`, `.capabilities`.
  • `api/` and `metabase.metabot.api` - `/api/metabot` routes.
  • `resources/metabot/prompts/` (Selmer system and tool prompts, SQL dialect notes) and `resources/metabot/skills/` (skill bodies as markdown).
  • `llm/` - provider connections and `/api/llm`. `metabase.llm.provider` (connection registry, `llm-providers` setting), `metabase.llm.settings`, `metabase.llm.context` (tables and cards a native query references), `metabase.llm.db`.
  • `agent_api/` - `/api/agent`, the REST API for headless agents. `metabase.agent-api.api`, `.query-guards`, `.validation`, `.db`. `reference.md` documents the public surface.
  • `mcp/` - MCP server at `/metabase-mcp` (and legacy `/mcp`). `metabase.mcp.transport` (JSON-RPC, sessions, auth, throttling), `metabase.mcp.v2.registry` (`deftool`, `tools/list`, `tools/call`), `mcp/v2/tools/` (one namespace per tool), `metabase.mcp.scope`, `metabase.mcp.db`.
  • `slackbot/` - Metabot in Slack, `/api/metabot/slack`. `metabase.slackbot.db`.
  • `ai_tracing/` - eval-time span capture (`metabase.ai-tracing.core`, `/api/eval-trace`). Separate from production tracing.
  • `agent_lib/` - `metabase.agent-lib.representations`, the portable MBQL 5 form that agents read and write.
  • `search/entity_retrieval/` and `osi/` - OSS shims for library entity retrieval and the `osi_ai_context` admin API that feeds it. Each has a `db` namespace.
  • `sql_tools/` - SQL parsing (SQLGlot or Macaw) used by `metabase.llm.context` and the SQL tools. Consume it through `metabase.sql-tools.core`.

Enterprise (`enterprise/backend/src/metabase_enterprise/`):

  • `metabot/` - `metabase-enterprise.metabot.permissions` (per-group permission resolution), `.provider` (managed AI add-on), group and instance limit models, `ai_usage_trimmer` task, `.db`.
  • `metabot_analytics/` - `/api/ee/metabot-analytics` (needs `:audit-app`), `.db`.
  • `mcp/`, `agent_api/` - EE usage logging (`mcp_tool_call_log`, `agent_api_call_log`), `.db` each.
  • `search/entity_retrieval/` - pgvector `library_entity_index` behind the `retrieve_library_entities` tool, `.db`.

Invariants and landmines

  • A Metabot tool is a `mu/defn` whose metadata carries `:tool-name`, `:scope`, and optionally `:capabilities` and `:title-fn`. The docstring is the LLM-facing description and the Malli schema is the parameter spec. Editing either changes model behaviour.
  • A tool is only reachable when a profile in `metabase.metabot.agent.profiles` lists it. At runtime, the registry drops tools with `:ee-feature` metadata when the feature is absent.
  • Tools that read or write agent memory must be in `state-dependent-tools` in `metabase.metabot.tools`. Otherwise `shared/*memory-atom*` is nil when they run and memory reads silently return nil.
  • Scope checks happen in the wrapper, not the tool. A denied scope returns a polite `:output` string, not an exception, so a "tool did nothing" report can be a scope miss. Check the log for "Scope check failed".
  • Metadata shown to the LLM must go through `metabase.metabot.metadata-perms`. Never build table or field context from raw app-DB reads.
  • Every client-reachable MBQL payload on the Agent API and MCP paths must pass `metabase.agent-api.query-guards`. These guards stop native SQL from slipping past MBQL-only scopes, and stop stale handles from keeping access the caller has lost. `+refuse-unscoped-native-sql` wraps `/api/dataset` for the same reason.
  • MCP `tools/list` filters by client extensions only. `tools/call` checks token scopes.
  • LLM calls return `IReduceInit`, not core.async channels. Compose with transducers and never realize the whole stream. Retries and token-usage reporting are transducers in `metabase.metabot.self`.
  • Tool-specific instructions live in skills (`metabase.metabot.skills`, `resources/metabot/skills/`), not in the system prompt. Keep the cached system-prompt prefix stable.
  • Conversation writes that race need `metabase.met
Read more
@metabase
Ships withmetabase

Metabase is the easy, open-source way for everyone in your company to ask questions and learn from data.

50k30 skills11 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
50.3k
Star history of metabase/metabase on GitHub, a chart by star-history.com

Other agents on metabase.

content-backend-expert

content-backend-expert

Agent

Metabase backend expert for collections, cards (models, metrics), dashboards, documents, revisions, bookmarks, timelines,…

@metabase@metabaseInstall Agent
mbql-backend-expert

mbql-backend-expert

Agent

Metabase backend expert for query processor (QP) middleware, MBQL 5 and legacy, Lib, lib.schema, metadata providers, HoneySQL…

@metabase@metabaseInstall Agent

More agents from other plugins.

a11y-architect
Auto-invoked

a11y-architect

Agent

Accessibility Architect specializing in WCAG 2.2 compliance for Web and Native platforms. Use PROACTIVELY when designing UI…

ecc12d293k
@affaan-m@affaan-mInstall Agent
analyze-pass-impact

analyze-pass-impact

Agent

Analyzes how a specific topic affects a group of compiler passes. Used by the /plan-update skill to parallelize research across…

react2d252k
@facebook@facebookInstall Agent
orchestrator

orchestrator

Agent

- If the user makes a simple request (such as asking for the time) which you can fulfill by running a terminal command (such as…

codex1d135k
@openai@openaiInstall Agent
cavecrew-builder

cavecrew-builder

Agent

Surgical 1-2 file edit. Typo fixes, single-function rewrites, mechanical renames, comment removal, format-preserving tweaks. Hard…

caveman2d119k
@juliusbrussee@juliusbrusseeInstall Agent

Questions about ai-backend-expert.

Which coding agents can use ai-backend-expert?
ai-backend-expert installs in Claude Code and Cursor: each loads subagents from .claude/agents, so copy the file there. Flowy's auto-invocation runs in Claude Code only.