TwinBI 🐝: An Agentic Digital Twin for Efficient Augmented Interactions with Business Intelligence Dashboards
TwinBI 🐝 is a research prototype for studying agentic interaction with business intelligence dashboards. It combines dashboard manipulation, contextual memory, and augmented chat-based reasoning to help an agent solve analytical tasks more effectively than a dashboard-only baseline.
The first goal of the project is to develop a Digital Twin system that fuses a Chat Interface with Business Intelligence dashboards, so that analytical interaction is not limited to direct widget manipulation alone.
The second goal is framed as a research question:
Can an augmented BI interface reduce brittle dashboard interaction and improve task completion on realistic analytical queries?
TwinBI supports two main operating settings:
- a dashboard-only agent that works directly on a Superset dashboard through screenshot- and DOM-grounded actions
- an augmented TwinBI setting that uses a Streamlit application with an embedded dashboard and chat interface for synthesis and guidance
TwinBI provides an environment for:
- creating business intelligence benchmark tasks
- running browser-based agents over dashboards
- combining dashboard context with chat-based reasoning
- tracing actions, screenshots, and memory across runs
- comparing different interface settings through controlled A/B experiments
In practice, the repository includes:
- a synthetic sales dataset and semantic layer setup
- Superset dashboards for BI interaction
- a FastAPI backend for orchestration and chat
- a Streamlit application that embeds dashboards and exposes the TwinBI interface
- experimental runners for dashboard-only and augmented settings
- benchmark queries, gold answers, and evaluation scripts
TwinBI follows a five-layer architecture:
Presentation Layer: combines a chat interface with embedded BI dashboards so users can switch between natural-language interaction and direct visual manipulation.Orchestration Layer: manages the agent system, tool routing, and unified analytical context by combining dialogue history, dashboard logs, and tool outputs.Semantic Layer: defines measures, dimensions, hierarchies, and valid join paths so both conversational and dashboard interactions share the same business semantics.BI Tool Layer: uses Apache Superset as the executable dashboard environment and replays chart queries through tool APIs when context-grounded answers are needed.Data Layer: stores analytical data in DuckDB and exposes it only through the semantic layer to preserve consistent metric definitions and aggregation behavior.
data/: generated datasets, database files, and Cube configurationsrc/create_db_data.py: synthetic data generationsrc/schema_processor.py: schema graph generationsrc/hierarchy_duckdb.py: hierarchy construction
superset/: Superset source checkoutfastapi/: backend APIs and orchestration logicstreamlit-app/: Streamlit frontend with embedded dashboard support
experiments/: benchmark queries, gold answers, runners, and experiment documentationsimulation/: legacy and active simulation scripts, traces, and comparison outputs
The project can be understood as the following pipeline:
- Generate or load a BI dataset
- Expose the data through Cube and Superset
- Build dashboards for analytical interaction
- Run either:
- a dashboard-only agent
- or the TwinBI augmented interface
- Record traces, screenshots, and answers
- Compare results against gold answers
This makes the repository useful for:
- agent evaluation
- interaction design experiments
- prompt and policy tuning
- failure analysis on dashboard tasks
For the experiment-specific guide, see:
At a high level:
sales.dbor other generated data acts as the analytical backend- Cube provides a semantic/query layer over the data
- Superset provides dashboard authoring and dashboard execution
- FastAPI provides orchestration, APIs, and chat-related backend logic
- Streamlit provides the TwinBI user interface with embedded dashboards
- Playwright-based runners automate benchmark execution for evaluation
python3.12
uv
duckdb
docker
docker-compose
docker network create agent4olap_netuv venv
source .venv/bin/activate
uv sync
echo -e "UID=$UID\nGID=$GID\nCUBEJS_TESSERACT_SQL_PLANNER=true" > .env
uv run src/create_db_data.py --type sales --rows 5000 --db_path "data/sales/database/sales.db"Clone and set up Superset:
git clone --depth=1 https://github.com/apache/superset.git superset
cd superset
git fetch --tags --depth=1
git checkout 6.0.0Modify superset/docker/pythonpath_dev/superset_config.py and add:
FEATURE_FLAGS = {"ALERT_REPORTS": True, "DRILL_BY": True, "EMBEDDED_SUPERSET": True}
TALISMAN_ENABLED = False
GUEST_TOKEN_JWT_AUDIENCE = "superset"
GUEST_TOKEN_HEADER_NAME = "X-GuestToken"
GUEST_ROLE_NAME = "Gamma"
GUEST_TOKEN_JWT_ALGO = "HS256"
GUEST_TOKEN_JWT_SECRET = "ifJCllwMr-7vPky1kysSn1qRWjgYVKt-SAZt2edE9je5fob5MKKp0yWZJ0o41h2nAjpyjAC6vH30g_qL4iCBEA"
GUEST_TOKEN_JWT_EXP_SECONDS = 3600
OVERRIDE_HTTP_HEADERS = {
"X-Frame-Options": "ALLOWALL",
}Start Superset:
cp ../docker-compose.superset.yml ./docker-compose.superset.yml
docker-compose -f ./docker-compose.superset.yml up -duv run src/create_db_data.py --type sales --rows 5000 --db_path "data/sales/database/sales.db"
docker-compose -f ./docker-compose.sales.yml up -d --build
uv run src/schema_processor.py --db_type sales --create_graphs
uv run src/hierarchy_duckdb.py --db_type salesIn the Superset web UI at http://localhost:8088, create a database connection for the generated sales DB:
Host: host.docker.internal
Port: 35432
Database name: sales
Username: admin
Password: admin
Name: Sales-DuckDB
Then create a dashboard and enable embedding:
In the dashboard, click '...' -> Embed Dashboard -> Enable Dashboard Embedding -> copy the UUID
Also update the Gamma role to include required permissions, including dataset and Sales-DuckDB related permissions.
Configure API keys in .env:
OPENAI_API_KEY=your_openai_api_keyRun FastAPI:
docker-compose -f ./docker-compose.fastapi.yml up -d --buildRun Streamlit:
docker-compose -f ./docker-compose.streamlit.yml up -d --buildOr run the full stack:
docker compose -f docker-compose.sales.yml -f docker-compose.streamlit.yml -f docker-compose.fastapi.yml up -d --buildExperiment assets and instructions live under:
Start there for:
- benchmark queries
- answer files
- batch runners
- experiment README and project guide
cd superset/superset-frontend
npm ci
npm run build
cd ..
docker compose -f docker-compose.superset.yml up -d --buildcd streamlit-app/superset_embed_component/frontend
npm install
npm run builddocker exec -it superset_db psql -U superset -d supersetTRUNCATE TABLE logs RESTART IDENTITY;