Early Stage Development: This project is in very early stage development and is intended for demonstration and experimental purposes only. It is not production-ready and APIs, features, and architecture may change significantly. Use at your own risk.
An AI-powered data analysis tool that enables users to query BigQuery data using natural language. Built with Google ADK (Agent Development Kit), FastAPI, React, and Apache ECharts.
- Natural Language Queries: Ask questions about your data in plain English
- Smart SQL Generation: Automatically converts questions to optimized SQL
- Uncertainty Handling: Agent asks clarifying questions when queries are ambiguous
- Proactive Insights: Automatically surfaces trends, anomalies, and suggestions
- Interactive Visualizations: Toggle between table, bar, line, area, and pie charts
- SQL Transparency: View the generated SQL for every query
- Auto-display Results: Query results automatically appear in a side panel
- Python 3.11+ (with
uvrecommended for package management) - Node.js 18+
- Google Cloud Project with:
- BigQuery API enabled
- Vertex AI API enabled
- A BigQuery dataset with data to query
- Google Cloud authentication configured (ADC recommended)
cd data-insights-agent
# Backend configuration
cp backend/.env.example backend/.envEdit backend/.env with your settings:
GOOGLE_CLOUD_PROJECT=your-project-id
GOOGLE_CLOUD_REGION=global
BIGQUERY_DATASET=your_dataset_name
gcloud auth application-default logincd backend
# Using uv (recommended)
uv venv
source .venv/bin/activate
uv pip install -r requirements.txt
# Or using pip
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
# Run the server
uvicorn main:app --host 0.0.0.0 --port 8088 --reloadIn a new terminal:
cd frontend
npm install
npm run devOpen http://localhost:5173 in your browser.
Try these queries:
- "What tables are available?"
- "Show me all data from the states table"
- "How many chipotle stores are in California?"
- "Show me the top 10 movies by rating"
The agent will:
- Understand your question
- Ask for clarification if needed
- Generate and execute the SQL query
- Present results in an interactive data table
- Allow you to visualize data as charts (bar, line, pie, area)
data-insights-agent/
├── backend/
│ ├── agent/ # ADK agent configuration
│ │ ├── agent.py # Main agent definition
│ │ ├── config.py # Configuration management
│ │ ├── prompts.py # System prompts
│ │ └── tools.py # Custom BigQuery tools
│ ├── api/ # FastAPI routes and models
│ ├── services/ # Session management
│ ├── main.py # Application entry point
│ └── requirements.txt
├── frontend/
│ ├── src/
│ │ ├── components/ # React components
│ │ │ ├── Chat/ # Chat interface
│ │ │ ├── Results/ # Results panel & charts
│ │ │ └── Layout/ # App layout
│ │ ├── hooks/ # Custom React hooks
│ │ └── types/ # TypeScript types
│ └── package.json
└── README.md
| Endpoint | Method | Description |
|---|---|---|
/api/health |
GET | Health check |
/api/chat |
POST | Send a message to the agent |
/api/sessions |
GET/POST | List or create chat sessions |
/api/schema/tables |
GET | List available tables |
| Variable | Required | Default | Description |
|---|---|---|---|
GOOGLE_CLOUD_PROJECT |
Yes | - | GCP project ID |
BIGQUERY_DATASET |
Yes | - | Default BigQuery dataset |
GOOGLE_CLOUD_REGION |
No | global | Vertex AI region |
PORT |
No | 8088 | Server port |
DEBUG |
No | true | Enable debug mode |
CORS_ORIGINS |
No | localhost:5173 | Allowed CORS origins |
- Ensure your GCP credentials have BigQuery Data Viewer and Vertex AI User roles
- Run
gcloud auth application-default loginagain
- Verify Vertex AI API is enabled in your project
- Check the backend logs:
tail -f /tmp/backend.log
- Ensure
GOOGLE_CLOUD_REGION=globalin your.envfile - The app uses
gemini-3-flash-previewmodel
This software is provided as-is for demonstration and educational purposes. It is in early stage development and should not be used in production environments. The authors make no warranties about the suitability of this software for any purpose.
MIT License