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.
cd Repos/dashboard-agent
uv sync # installs all deps from pyproject.toml
export ANTHROPIC_API_KEY=sk-...# 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 dashWrites two files:
output/dashboard.py— the runnable dashboardoutput/VERIFY.md— metric definitions + verification queries
# Streamlit
streamlit run output/dashboard.py
# Dash
uv run python output/dashboard.py
# then open http://127.0.0.1:8050The 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?"
uv run python verify_agent.pyReads 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
| 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 |
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.mddashboard-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
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)