Integrating an AI agent into Apache Superset dashboards allows users to query data directly from the interface. Instead of switching to SQL or external chat services, users can open a chat window embedded via an iframe in a Markdown block to ask questions about the current dashboard.
The implementation requires configuring Superset's security settings, specifically adjusting the HTML sanitizer to allow iframe tags and updating the Content Security Policy (CSP) to permit the agent's domain. The agent itself must provide a compact /embed/chat page and support the frame-ancestors header to allow embedding.
To provide context, a script extracts metadata from Superset via its REST API, generating Markdown files for dashboards and datasets. When a user asks a question, the agent uses the dashboard_id to retrieve relevant information about charts, tables, and filters, enabling it to generate accurate SQL queries.
This approach works on Superset versions 2.0.1 and later. While native AI features are expected in future releases like Superset 7.0, this iframe-based method allows for immediate integration without modifying the core Superset codebase or building custom plugins.




