Skip to content

Hongxia555/dashboard-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dashboard Builder Agent

An AI agent that takes a natural language prompt and generates a complete, runnable Streamlit or Dash dashboard — including an in-dashboard AI chat assistant and a metric verification doc.

Setup

cd Repos/dashboard-agent
uv sync           # installs all deps from pyproject.toml
export ANTHROPIC_API_KEY=sk-...

Usage

Step 1 — Generate a dashboard

# Streamlit (default)
uv run python agent.py "Build a dashboard exploring penguin body measurements by species"

# Dash
uv run python agent.py "Compare iris petal and sepal dimensions by species" --framework dash

Writes two files:

  • output/dashboard.py — the runnable dashboard
  • output/VERIFY.md — metric definitions + verification queries

Step 2 — Run the dashboard

# Streamlit
streamlit run output/dashboard.py

# Dash
uv run python output/dashboard.py
# then open http://127.0.0.1:8050

The dashboard includes a sidebar AI chat panel. Ask it questions like:

  • "Why is Chinstrap average bill length higher than Adelie?"
  • "What does the y-axis represent?"

Step 3 — Verify metrics

uv run python verify_agent.py

Reads output/VERIFY.md, runs DuckDB/Pandas queries against the raw dataset, and prints a pass/fail report:

  ✓ [PASS    ] Average Bill Length by Species
             Value: {'Adelie': 38.791, 'Chinstrap': 48.833, 'Gentoo': 47.505}
  ✓ [PASS    ] Total Penguin Count
             Value: 344.0

Available Datasets

Package Datasets
seaborn iris, tips, titanic, penguins, flights, diamonds, mpg
plotly.express gapminder, iris, tips, wind, stocks, election, carshare
sklearn.datasets iris, breast_cancer, california_housing

Examples

Hand-curated reference outputs in examples/:

# Streamlit reference
streamlit run examples/iris_streamlit.py

# Dash reference (shows callback pattern)
uv run python examples/iris_dash.py

# Verify the example metrics
uv run python verify_agent.py --verify-md examples/iris_VERIFY.md

Project Structure

dashboard-agent/
├── agent.py            # Dashboard Agent (entry point)
├── verify_agent.py     # Verification Agent
├── DESIGN.md           # Design decisions and trade-offs
├── pyproject.toml      # Dependencies
├── output/             # Generated files (git-ignored)
│   ├── dashboard.py
│   └── VERIFY.md
└── examples/           # Hand-curated reference outputs
    ├── iris_streamlit.py
    ├── iris_dash.py
    └── iris_VERIFY.md

Options

python agent.py --help
  prompt              Natural language description of the dashboard
  --framework         streamlit (default) or dash

python verify_agent.py --help
  --tolerance FLOAT   Allowed relative error between SQL and pandas (default: 0.01)
  --verify-md PATH    Path to VERIFY.md (default: output/VERIFY.md)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages