smartlook.mp4
SmartLook is a generative business intelligence and text-to-SQL agent that analyzes datasets from an e-commerce company, detects trends, and generates accurate SQL queries and visualizations to support business analysis tasks. The system features an intuitive React interface that accelerates insight generation, automates exploratory analysis, and reduces manual effort for analysts.
Try it out here: SmartLook AI Agent
- AI-Powered Analysis: Leverages LangGraph for structured reasoning and decision-making
- Automated SQL Generation: Creates accurate SQL queries using few-shot learning techniques
- Interactive Visualizations: Creates dynamic charts and graphs with Plotly.js
- Fast Insights: Accelerates data exploration and reduces manual analysis time
- Modern Web Interface: Clean, intuitive UI built with vanilla JavaScript for seamless interaction
- BigQuery Integration: Direct connection to Google Cloud BigQuery for scalable data processing
- Conversational AI: Natural language interface for data queries
- Export Capabilities: Download visualizations as PNG and data as CSV for further analysis
SmartLook uses a multi-agent architecture powered by LangGraph:
- Data Analyst Agent: Analyzes data patterns and generates insights
- SQL Agent: Translates natural language queries into optimized SQL
- Reasoning Flow: Structured decision-making process for complex analysis
- Few-Shot Learning: Learns from examples to improve query accuracy
- Flask 3.0.0 - Web framework for API endpoints
- LangGraph 0.0.26 - Agent orchestration and workflow management
- LangChain Core 0.1.40 - Foundation for LLM integration
- LangChain Groq 0.1.0 - Fast LLM inference
- Google Cloud BigQuery 3.15.0 - Cloud data warehouse
- Pandas 2.2.3 - Data manipulation and analysis
- Plotly 5.18.0 - Interactive data visualizations
- Vanilla JavaScript - Interactive frontend logic
- HTML5 - Semantic markup structure
- CSS3 - Modern styling with gradients and animations
- Plotly.js - Interactive data visualizations
- Gunicorn 21.2.0 - Production WSGI server
- Flask-CORS 4.0.0 - Cross-origin resource sharing
- Google Auth 2.23.0 - Authentication for GCP services
smartlook-ai-agent/
│
├── templates/ # HTML templates
│ ├── assets/ # Static assets (CSS, JS, images)
│ └── index.html # Main frontend interface
│
├── agent.py # AI agent implementation
├── app_flask.py # Flask application
├── requirements.txt # Python dependencies
├── Procfile # Deployment configuration
├── .gitignore # Git ignore rules
└── README.md # Project documentation
- Python 3.8+
- Google Cloud Platform account with BigQuery access
- Groq API key (or other LLM provider)
- Clone the repository:
git clone https://github.com/RafiqNaufal/smartlook-ai-agent.git
cd smartlook-ai-agent- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Set up environment variables:
cp .env.example .env
# Edit .env with your credentials:
# - GROQ_API_KEY
# - GOOGLE_APPLICATION_CREDENTIALS
# - BIGQUERY_PROJECT_ID
# - BIGQUERY_DATASET_ID- Run the Flask application:
python app_flask.pyThe application will be available at http://localhost:5000
flask==3.0.0
flask-cors==4.0.0
langchain-groq==0.1.0
langchain-core==0.1.40
langgraph==0.0.26
google-cloud-bigquery==3.15.0
pandas==2.2.3
requests==2.31.0
db-dtypes==1.1.1
plotly==5.18.0
kaleido==0.2.1
gunicorn==21.2.0
google-auth==2.23.0
sqlparse==0.4.4- User: "What are the top 5 best-selling products?"
- SmartLook: Generates SQL query, executes it, and presents results with insights
- User: "Create a stacked bar chart of quarterly revenue share by the top 5 countries in 2025"
- SmartLook: Creates visualization and identifies key patterns
- User: "Perform a cohort-based user retention analysis in 2025"
- SmartLook: Performs cohort analysis and detects patterns with actionable recommendations
- User: "Show me the SQL query to find the best-selling product in 2025"
- SmartLook: Generates SQL query based on user request and validates it
SmartLook learns from a curated set of query examples to improve accuracy:
- Domain-specific SQL patterns
- Business logic understanding
- Context-aware query generation
LangGraph enables step-by-step reasoning:
- Query understanding
- Data source identification
- SQL generation
- Data visualization
- Result validation
- Insight extraction
Robust error handling and recovery:
- SQL syntax validation
- Query optimization suggestions
- Fallback strategies
- 80% reduction in time spent writing SQL queries
- Improved accuracy through AI-powered validation
- Faster insights for data-driven decision making
- Automated analysis of recurring business questions
- Democratized data access for non-technical stakeholders
- Secure authentication with Google Cloud
- Role-based access control
- Query sanitization and validation
- Encrypted data transmission
- Audit logging for compliance
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- LangChain team for the excellent LLM framework
- Google Cloud for BigQuery infrastructure
- Groq for fast LLM inference
- Open-source community
For questions, issues, or feature requests:
- Open an issue on GitHub
- Start a discussion in the repository
This project is licensed under the MIT License - see the LICENSE file for details.
If you find SmartLook useful, please consider giving it a star! ⭐
Built with dedication for data analysts everywhere 🚀



