Enterprise Insights Copilot is a sophisticated AI-powered data analytics platform that transforms raw data into actionable business insights through an intelligent multi-agent workflow. Built with modern web technologies and featuring a stunning glassmorphism design, the platform provides an intuitive interface for data analysis, visualization, and report generation.
Current Status: β PRODUCTION READY - Complete implementation featuring a fully functional Next.js 15.3.5 frontend with glassmorphism design, FastAPI backend with 8 specialized AI agents, interactive data workflow with real-time status tracking, comprehensive file upload with CSV preview, and integrated chat interface. All systems are tested, documented, and ready for deployment.
Latest Updates (2025-07-16):
- β Enhanced agent workflow with dropdown interactions and real data processing
- β Working CSV data preview with responsive table display
- β Real-time agent status updates and sequential processing
- β Interactive agent cards with expand/collapse functionality
- β Professional output display with contextual agent results
- β Complete 2-column responsive layout with glassmorphism styling
- β Comprehensive TypeScript implementation with error-free compilation
- π€ Intelligent Data Upload: Drag-and-drop interface with CSV/XLSX/JSON support and instant preview
- π€ 8-Agent AI Pipeline: Specialized agents for file processing, data profiling, analysis planning, insights discovery, visualization creation, quality critique, perspective debate, and comprehensive reporting
- π¬ Interactive Chat Interface: Natural language queries with RAG-powered responses and context awareness
- π Real-time Visualizations: Interactive charts, graphs, and dashboards with D3.js integration
- π Automated Report Generation: Professional PDF/DOCX reports with executive summaries
- π¨ Modern Glassmorphism UI: Stunning design with smooth animations and responsive layout
- β‘ Live Agent Tracking: Real-time status updates and workflow progress monitoring
- π Transparent Processing: Detailed agent outputs and reasoning visibility
- π± Full Responsive Design: Optimized for desktop, tablet, and mobile devices
- π Enterprise Security: Input validation, error handling, and secure file processing
Enterprise Insights Copilot/ (Production Ready Implementation)
βββ frontend/ # Next.js 15.3.5 React Application β
COMPLETE
β βββ public/ # Static assets and themed SVG icons
β βββ src/
β β βββ app/ # Next.js App Router with main dashboard
β β βββ components/ # Reusable UI components (glassmorphism)
β β β βββ layout/ # Navbar and structural components
β β β βββ upload/ # File upload with preview functionality
β β β βββ icons/ # Custom SVG icon components
β β βββ lib/ # Utilities and API services
β β βββ styles/ # Tailwind CSS and global styles
β βββ package.json # Dependencies: Next.js, React, TypeScript
β βββ tailwind.config.js # Glassmorphism theme configuration
βββ backend/ # FastAPI Python Server β
COMPLETE
β βββ app/
β β βββ api/ # REST API endpoints for data processing
β β β βββ v1/
β β β βββ endpoints/ # REST endpoints organized by resource
β β β β βββ agents.py # Agent operations and workflow control
β β β β βββ auth.py # Authentication and user management
β β β β βββ chat.py # Chat interface and query handling
β β β β βββ files.py # File upload and management
β β β β βββ health.py # Health checks and system status
β β β β βββ preview.py # Data preview and visualization
β β β β βββ vector.py # Vector database operations
β β β β βββ websocket.py # Real-time communication
β β β βββ api.py # Central router configuration
β β βββ services/ # Business logic and file handling
β β βββ agents/ # 8 AI agents implementation
β β β βββ file_upload/ # File validation and preprocessing
β β β βββ data_profile/ # Data analysis and quality assessment
β β β βββ planning/ # Strategy creation and roadmap
β β β βββ insight/ # Pattern discovery and insights
β β β βββ visualization/ # Chart and graph generation
β β β βββ critique/ # Analysis quality review
β β β βββ debate/ # Alternative perspective exploration
β β β βββ report/ # Comprehensive report compilation
β β βββ workflow/ # Agent orchestration and coordination
β β βββ main.py # FastAPI application entry point
β βββ requirements.txt # Python dependencies (FastAPI, LangChain)
β βββ tests/ # Comprehensive test suite
βββ files/ # Project verification tables and file listings
βββ structure/ # Project requirements and specifications
βββ understanding/ # Detailed architecture documentation
βββ changelogs/ # Complete development history (50+ entries)
βββ test/ # Testing utilities and validation scripts
βββ logs/ # Application and development logs
βββ markdown/ # Additional technical documentation
βββ README.md # This comprehensive documentation
- Node.js: 18.0.0 or higher
- npm: 9.0.0 or higher
- Git: Latest version
- Python: 3.9+ with pip
- PostgreSQL: 13+ (optional, for production deployments)
The backend provides the following API endpoints:
- POST
/api/files/upload
: Upload a file for analysis- Accepts: CSV, XLSX, JSON, TXT, PDF files
- Returns: File ID, metadata, and Pinecone test results
- GET
/api/files/list
: List all uploaded files - GET
/api/files/{file_id}
: Get file metadata and status
- POST
/api/agents/{agent_type}/run
: Run a specific agent- Path parameter
agent_type
: Type of agent to run (e.g.,file_upload
) - Body:
{ "query": "string", "file_id": "string", "context_data": {} }
- Path parameter
- POST
/api/agents/workflow/run
: Run the complete agent workflow - POST
/api/agents/pipeline/start
: Start an agent pipeline - GET
/api/agents/pipeline/{pipeline_id}/status
: Check pipeline status - WebSocket
/api/agents/pipeline/{pipeline_id}/ws
: Real-time pipeline updates
- GET
/health
: Check server health status - GET
/api/docs
: Interactive API documentation (if enabled) - GET
/api/redoc
: ReDoc API documentation (if enabled)
-
Clone the repository
git clone <repository-url> cd JUL7PROJECT
-
Install frontend dependencies
cd frontend npm install
-
Install backend dependencies
cd ../backend pip install -r requirements.txt
-
Start development servers
For Windows:
# From project root .\start_servers.bat
For Unix/Linux/Mac:
# From project root python start.py
Or manually:
# Terminal 1 - Frontend cd frontend npm run dev # Terminal 2 - Backend cd backend uvicorn app.main:app --reload --port 8000
-
Open your browser
- Frontend: Navigate to
http://localhost:3000
- Backend API: Navigate to
http://localhost:8000/docs
for Swagger documentation
- Frontend: Navigate to
# Frontend Commands (in frontend directory)
# Development server
npm run dev
# Production build
npm run build
# Start production server
npm start
# Run tests
npm test
# Run linting
npm run lint
# Type checking
npm run type-check
# Backend Commands (in backend directory)
# Start development server
uvicorn app.main:app --reload --port 8000
# Start production server
uvicorn app.main:app --host 0.0.0.0 --port 8000
# Run tests
pytest
# Automated start (from project root)
python start.py # Unix/Linux/Mac
start_servers.bat # Windows
-
Upload Data
- Drag and drop a CSV file into the upload area
- Wait for data profiling and validation
- Review data preview and quality metrics
-
Ask Questions
- Type natural language queries like:
- "Show me sales trends by region"
- "What are the top performing products?"
- "Generate a quarterly revenue report"
- Type natural language queries like:
-
Monitor Agent Pipeline
- Watch real-time progress of 8 specialized agents
- Expand agent cards to view detailed logs
- Review intermediate results and reasoning
-
Download Reports
- Access generated PDF reports from chat interface
- Export visualizations in multiple formats
- Share insights with stakeholders
- Custom Queries: Complex analytical questions
- Multi-perspective Analysis: Debate agent provides different viewpoints
- Quality Assurance: Critique agent validates all outputs
- Narrative Generation: Human-readable explanations of findings
- Framework: Next.js 15.3.5 with App Router and TypeScript
- Language: TypeScript 5.0+ for comprehensive type safety
- Styling: Tailwind CSS 3.4+ with custom glassmorphism design system
- UI Components: Custom glassmorphism components with SVG icon library
- State Management: React hooks with optimized re-rendering patterns
- File Upload: Real drag-and-drop with instant CSV preview and validation
- Data Display: Responsive tables with first 10 rows preview functionality
- Agent Interface: Interactive workflow cards with expand/collapse functionality
- Real-time Updates: Live agent status tracking and progress monitoring
- Chat System: Message-based interface with query submission
- Responsive Design: Mobile-first approach with 2-column desktop layout
- Animations: Smooth transitions and hover effects throughout
- Error Handling: Comprehensive error boundaries and user feedback
- Testing: Jest and React Testing Library with coverage reporting
- Performance: Optimized bundle size and lazy loading strategies
- Framework: FastAPI with async/await support and automatic documentation
- Language: Python 3.9+ with comprehensive type hints and validation
- API Architecture: RESTful endpoints with OpenAPI/Swagger integration
- Agent System: 8 specialized AI agents with LangChain/LangGraph orchestration
- File Processing: Pandas and NumPy for advanced data manipulation
- AI/ML Stack: LangChain integration with LLaMA models and RAG capabilities
- Vector Database: Pinecone integration for semantic search and retrieval
- Database: PostgreSQL with SQLAlchemy ORM for data persistence
- Authentication: JWT-based security with role-based access control
- Real-time Communication: WebSocket support for live agent updates
- Data Preview: Intelligent CSV parsing with column type detection
- Error Handling: Structured error responses with detailed logging
- CORS Configuration: Secure cross-origin request handling
- Production Deployment: Docker containerization and cloud-ready setup
- Testing: Pytest with comprehensive test coverage and mocking
- Version Control: Git with comprehensive changelog management (50+ entries)
- Package Management: npm (frontend) and pip (backend) with lockfiles
- Code Quality: ESLint, Prettier, TypeScript strict mode, Python Black
- Documentation: Extensive markdown documentation with diagrams
- Cross-platform Scripts: Automated start scripts for Windows and Unix
- Development Workflow: Hot reloading and real-time development servers
- Production Deployment: Multi-platform deployment guides and configurations
- Logging System: Structured logging with centralized log management
- Performance Monitoring: Built-in performance tracking and optimization
The Enterprise Insights Copilot features a sophisticated 8-agent AI workflow that processes data through specialized, sequential stages. Each agent is designed for a specific aspect of data analysis, ensuring comprehensive and thorough insights.
graph TD
A[π File Upload Agent] --> B[π Data Profile Agent]
B --> C[π― Planning Agent]
C --> D[π‘ Insight Agent]
D --> E[π Viz Agent]
E --> F[π Critique Agent]
F --> G[π¬ Debate Agent]
G --> H[π Report Agent]
Purpose: Validates, processes, and prepares uploaded files for analysis
- Input: Raw CSV/XLSX/JSON files from user uploads
- Processing: File validation, format detection, data cleaning, structure analysis
- Output: Cleaned data with metadata, column types, quality assessment
- Status Updates: Upload progress, validation results, preprocessing completion
- Real-time Display: "File processed successfully: 1,000 rows, 8 columns detected"
Purpose: Analyzes data structure, quality, and statistical properties
- Input: Processed data from File Upload Agent
- Processing: Statistical analysis, null value detection, data type inference, outlier identification
- Output: Comprehensive data profile with quality metrics and recommendations
- Key Metrics: Row/column counts, data types, null percentages, quality scores
- Real-time Display: "Data Profile Complete: Quality Score 94%, 5 high-quality columns identified"
Purpose: Creates comprehensive analysis strategy and execution roadmap
- Input: Data profile and business context
- Processing: Strategy formulation, methodology selection, analysis prioritization
- Output: Detailed analysis plan with recommended approaches and expected outcomes
- Strategic Focus: Business objectives alignment, analytical methodology selection
- Real-time Display: "Analysis Strategy Created: 4 key insights to explore, visualization roadmap defined"
Purpose: Discovers patterns, trends, and actionable business insights
- Input: Data and analysis strategy from previous agents
- Processing: Pattern recognition, trend analysis, correlation discovery, anomaly detection
- Output: Detailed insights with business implications and confidence scores
- Intelligence Types: Descriptive, diagnostic, predictive, and prescriptive analytics
- Real-time Display: "Key Insights Discovered: 3 critical patterns found, 2 actionable recommendations"
Purpose: Generates interactive visualizations and dashboard components
- Input: Insights and data patterns from previous analysis
- Processing: Chart type selection, interactive dashboard creation, visual design optimization
- Output: Interactive charts, graphs, and dashboard components with explanatory context
- Visualization Types: Bar charts, line graphs, scatter plots, heatmaps, distribution plots
- Real-time Display: "Visualizations Created: 5 interactive charts, 1 comprehensive dashboard"
Purpose: Reviews analysis quality and identifies improvement opportunities
- Input: Complete analysis results from all previous agents
- Processing: Quality assessment, methodology validation, bias detection, accuracy evaluation
- Output: Quality report with validation results and improvement recommendations
- Quality Dimensions: Data accuracy, methodology soundness, insight validity, visualization clarity
- Real-time Display: "Quality Review Complete: Analysis validated, 2 enhancement suggestions provided"
Purpose: Explores alternative perspectives and validates conclusions
- Input: Analysis results and critique feedback
- Processing: Alternative viewpoint generation, assumption challenging, scenario analysis
- Output: Alternative interpretations, risk assessments, and balanced perspective reports
- Perspective Types: Optimistic/pessimistic scenarios, alternative methodologies, contrarian viewpoints
- Real-time Display: "Alternative Analysis Complete: 3 different perspectives explored, balanced view provided"
Purpose: Compiles comprehensive final report with executive summary
- Input: All previous agent outputs and analyses
- Processing: Report compilation, executive summary creation, recommendation prioritization
- Output: Professional PDF/DOCX reports with executive summary and detailed findings
- Report Sections: Executive summary, methodology, key findings, recommendations, appendices
- Real-time Display: "Final Report Generated: 12-page comprehensive analysis with executive summary ready"
- Visual Indicators: Each agent displays current status (βΈοΈ Waiting, π Processing, β Complete, π’ Ready)
- Progress Monitoring: Live updates as agents move through processing stages
- Interactive Cards: Click any agent to expand and view detailed outputs
- Intelligent Orchestration: Agents process in logical sequence with proper dependencies
- Data Flow: Each agent receives optimal input from previous stages
- Error Handling: Robust error recovery and graceful degradation
- Contextual Results: Each agent provides relevant, actionable insights
- Formatted Output: Professional presentation with structured information
- Expandable Details: Users can explore detailed reasoning and intermediate results
interface AgentState {
status: 'waiting' | 'processing' | 'completed' | 'ready';
output: string;
isExpanded: boolean;
}
- LangChain Integration: Professional agent coordination with LangGraph
- Async Processing: Non-blocking workflow execution with status updates
- Error Recovery: Intelligent retry logic and fallback strategies
The 8-agent system ensures comprehensive, professional data analysis with transparency and user control throughout the entire workflow.
frontend/
βββ public/ # Static assets
β βββ icons/ # Custom SVG icons
β βββ images/ # Image assets
βββ src/
β βββ app/ # Next.js 14 App Router
β β βββ globals.css # Global styles
β β βββ layout.tsx # Root layout
β β βββ page.tsx # Home page
β βββ components/ # Reusable components
β β βββ ui/ # Base UI components
β β βββ features/ # Feature-specific components
β βββ features/ # Main application features
β β βββ upload/ # File upload functionality
β β βββ chat/ # RAG chat interface
β β βββ agents/ # Agent workflow components
β β βββ visualization/ # Data visualization
β βββ hooks/ # Custom React hooks
β βββ lib/ # Utility libraries
β βββ styles/ # Additional styling
β βββ types/ # TypeScript definitions
β βββ __tests__/ # Component tests
βββ package.json # Dependencies and scripts
βββ next.config.js # Next.js configuration
βββ tailwind.config.js # Tailwind CSS config
βββ tsconfig.json # TypeScript config
βββ jest.config.js # Jest testing config
backend/
βββ app/ # Application package
β βββ main.py # FastAPI application entry point
β βββ api/ # API endpoints and routers
β β βββ v1/ # API version 1
β β βββ api.py # API router configuration
β β βββ endpoints/ # API endpoint modules
β β βββ agents.py # Agent workflow endpoints
β β βββ auth.py # Authentication endpoints
β β βββ chat.py # Chat/RAG endpoints
β β βββ files.py # File upload/management endpoints
β β βββ health.py # Health check endpoint
β β βββ preview.py # File preview endpoint
β βββ agents/ # Agent implementations
β β βββ base.py # Base agent class
β β βββ critique_agent.py
β β βββ data_profile_agent.py
β β βββ debate_agent.py
β β βββ file_upload_agent.py
β β βββ insight_agent.py
β β βββ planning_agent.py
β β βββ report_agent.py
β β βββ viz_agent.py
β βββ core/ # Core application modules
β β βββ auth.py # Authentication utilities
β β βββ config.py # Application configuration
β βββ db/ # Database models and utilities
β β βββ crud.py # CRUD operations
β β βββ database.py # Database connection
β β βββ models.py # SQLAlchemy models
β βββ llm/ # Language model integration
β β βββ llm_client.py # LLM client implementation
β βββ rag/ # RAG system implementation
β β βββ document_processor.py
β β βββ document_store.py
β β βββ embeddings.py
β β βββ rag_system.py
β βββ schemas/ # Pydantic data schemas
β β βββ chat.py # Chat request/response schemas
β β βββ file.py # File upload/metadata schemas
β βββ services/ # Business logic services
β β βββ chat_service.py # Chat handling service
β β βββ file_service.py # File processing service
β βββ utils/ # Utility functions
β β βββ logger.py # Logging configuration
β β βββ prompts.py # LLM prompt templates
β βββ workflow/ # Agent workflow orchestration
β βββ agent_workflow.py
βββ tests/ # Test suite
βββ requirements.txt # Python dependencies
βββ DEPLOYMENT.md # Deployment documentation
βββ IMPLEMENTATION_SUMMARY.md # Implementation details
The backend implements the following RESTful API endpoints:
POST /api/v1/files/upload
- Upload a new fileGET /api/v1/files
- List all uploaded filesGET /api/v1/files/{file_id}
- Get file metadataDELETE /api/v1/files/{file_id}
- Delete a fileGET /api/v1/data/preview/{file_id}
- Get file preview with sample data
POST /api/v1/agents/start
- Start an agent workflowGET /api/v1/agents/status/{workflow_id}
- Get workflow statusPOST /api/v1/agents/{agent_type}/run
- Run a specific agent
POST /api/v1/chat/message
- Send a chat messageGET /api/v1/chat/history/{session_id}
- Get chat history
POST /api/v1/auth/login
- User loginPOST /api/v1/auth/refresh
- Refresh access tokenGET /api/v1/auth/user
- Get current user info
GET /api/v1/health
- System health check
## π§ͺ Testing
### Running Tests
```bash
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage
# Run specific test file
npm test upload-section.test.tsx
frontend/src/__tests__/
βββ components/ # Component unit tests
βββ features/ # Feature integration tests
βββ hooks/ # Custom hook tests
βββ lib/ # Utility function tests
βββ __mocks__/ # Test mocks and fixtures
- Unit Tests: Individual component and function testing
- Integration Tests: Feature workflow testing
- Accessibility Tests: WCAG compliance verification
- Performance Tests: Loading time and interaction benchmarks
The application features a modern glassmorphism design with:
- Transparency Effects: Backdrop blur with semi-transparent backgrounds
- Layered Depth: Subtle shadows and borders for visual hierarchy
- Smooth Animations: 300ms transitions on all interactive elements
- Dark-First Design: Optimized for dark backgrounds with light accents
/* Primary Colors */
--primary-blue: #3B82F6
--primary-blue-light: #60A5FA
--primary-blue-dark: #1D4ED8
/* Accent Colors */
--accent-purple: #8B5CF6
--accent-emerald: #10B981
--accent-amber: #F59E0B
--accent-red: #EF4444
/* Glass Effects */
--glass-white: rgba(255, 255, 255, 0.1)
--glass-border: rgba(255, 255, 255, 0.2)
- Headers: Inter font family with systematic sizing
- Body Text: Consistent line height and spacing
- Code: Fira Code for technical content
Create a .env.local
file in the frontend directory:
# Application
NEXT_PUBLIC_APP_NAME="Enterprise Insights Copilot"
NEXT_PUBLIC_APP_URL="http://localhost:3000"
# API Configuration (when backend is ready)
NEXT_PUBLIC_API_URL="http://localhost:8000"
NEXT_PUBLIC_API_VERSION="v1"
# Feature Flags
NEXT_PUBLIC_ENABLE_ANALYTICS=true
NEXT_PUBLIC_ENABLE_DEBUG=false
The application supports extensive customization through:
- Tailwind Configuration: Modify
tailwind.config.js
for design tokens - Component Themes: Update glassmorphism utilities in
globals.css
- Agent Configuration: Adjust pipeline settings in agent components
- Chart Styling: Customize visualization themes and colors
-
Create Feature Branch
git checkout -b feature/agent-enhancement
-
Follow Coding Standards
- Use TypeScript for type safety
- Follow the established component patterns
- Add comprehensive tests for new features
- Update documentation for API changes
-
Commit Guidelines
git commit -m "feat: add advanced chart interactions" git commit -m "fix: resolve upload validation issue" git commit -m "docs: update API documentation"
-
Create Pull Request
- Provide detailed description of changes
- Include screenshots for UI changes
- Ensure all tests pass
- Request code review from team members
- TypeScript: Strict mode enabled with comprehensive type coverage
- Components: Functional components with hooks
- Styling: Tailwind CSS with semantic class names
- Testing: Jest with React Testing Library
- Documentation: JSDoc comments for all public APIs
The project follows 14 specific rules for consistency:
- Changelog Management: Timestamped logs for all changes
- File Headers: Consistent metadata in all files
- Directory Organization: Logical grouping by functionality
- Naming Conventions: Lowercase with hyphens/underscores
- Documentation: Detailed docstrings and comments
- Command Syntax: Semicolon separators for commands
- Code Quality: Proper indentation and style guidelines
- Version Control: Meaningful commit messages
- Development Order: Frontend first, then backend
- Test Organization: Dedicated test and logs directories
- Documentation Structure: Comprehensive README and markdown files
Detailed documentation is available in the markdown/
directory:
- Agent Architecture - Details on the LangChain/LangGraph agent system
- API Reference - Complete FastAPI endpoint documentation
- Deployment Guide - Production deployment instructions
- Troubleshooting - Common issues and solutions
- Performance Optimization - Tuning for high-traffic scenarios
- RAG System Guide - Pinecone integration and retrieval optimization
- LangChain Integration - Advanced agent configuration
- LangGraph Workflows - Agent orchestration patterns
- Llama 3.1 Configuration - Model selection and prompt engineering
- Security Guidelines - Authentication and data protection
For comprehensive understanding of the project architecture, see the understanding/
directory containing detailed analysis documents including:
- 01-project-overview.txt - High-level project concepts
- 02-architecture.txt - System architecture design
- 03-ui-ux-design.txt - UI/UX principles and guidelines
- 04-agent-system.txt - Detailed agent implementation
- 05-rag-system.txt - RAG system architecture
The Enterprise Insights Copilot is production-ready with comprehensive deployment options for various hosting environments.
- β Frontend: Next.js 15.3.5 optimized build with SSR/SSG support
- β Backend: FastAPI production server with async capabilities
- β Database: PostgreSQL integration with SQLAlchemy ORM
- β Security: JWT authentication, input validation, CORS configuration
- β Testing: Comprehensive test suites for frontend and backend
- β Documentation: Complete API documentation with Swagger/OpenAPI
- β Monitoring: Structured logging and health check endpoints
- β Cross-platform: Windows, Linux, macOS deployment scripts
# Option 1: Vercel (Recommended for Next.js)
cd frontend
npm run build
vercel --prod
# Option 2: Static Export
npm run build
npm run export
# Deploy the 'out' directory to any static hosting
# Option 3: Production Build
npm run build
npm start
# Self-hosted with production optimization
# Option 1: Production Server (Recommended)
cd backend
pip install -r requirements.txt
uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 4
# Option 2: Docker Container
docker build -t enterprise-insights-backend ./backend
docker run -p 8000:8000 enterprise-insights-backend
# Option 3: Cloud Platforms (AWS, GCP, Azure)
# Compatible with most cloud platforms supporting Python/FastAPI
# Complete system deployment with Docker Compose
docker-compose up -d --build
# Includes:
# - Frontend (Next.js production build)
# - Backend (FastAPI with Gunicorn)
# - PostgreSQL database
# - Redis cache (optional)
# - Nginx reverse proxy (optional)
Frontend (.env.production):
NEXT_PUBLIC_API_URL=https://your-backend-domain.com
NEXT_PUBLIC_ENVIRONMENT=production
Backend (.env):
DATABASE_URL=postgresql://user:password@host:port/dbname
JWT_SECRET_KEY=your-secure-secret-key
PINECONE_API_KEY=your-pinecone-api-key
OPENAI_API_KEY=your-openai-api-key # If using OpenAI models
- Frontend: Code splitting, image optimization, SSR/SSG
- Backend: Async endpoints, connection pooling, caching
- Database: Indexed queries, connection optimization
- Monitoring: Application performance monitoring (APM) ready
- Documentation: Check the
understanding/
directory for detailed guides - Implementation: Review
IMPLEMENTATION_SUMMARY.md
for implementation details - Issues: Create GitHub issues for bugs and feature requests
- Discussions: Use GitHub Discussions for questions and ideas
- Contributing: See contribution guidelines above
- API Connection: Verify backend URL in frontend environment variables
- File Upload: Check file size limits and MIME type validation
- CSV Preview: Ensure CSV files are properly formatted with headers
- Build Errors: Ensure Node.js and Python version compatibility
- Styling Issues: Verify Tailwind CSS configuration
- Type Errors: Check TypeScript configuration and imports
- Performance: Review component optimization and bundle size
This project is licensed under the MIT License. See the LICENSE file for details.
- Next.js Team: For the excellent React framework
- FastAPI: For the high-performance Python web framework
- Tailwind CSS: For the utility-first CSS framework
- Shadcn/ui: For accessible component patterns
- OpenAI: For AI/ML capabilities and agent system
- LangChain: For agent orchestration framework
- D3.js: For advanced data visualization
- β Complete Implementation: All planned features fully implemented
- π End-to-End Integration: Seamless frontend-backend connection
- π¨ Polished UI: Dark glassmorphism theme with custom components
- π Real Data Processing: Functional CSV preview and data analysis
- π Production Ready: Complete deployment pipeline and documentation
- π Comprehensive Documentation: Full technical documentation and guides
Built with β€οΈ by the Enterprise Insights Team
Last updated: July 9, 2025
For more information, see our understanding documents, implementation summary, and changelogs for detailed project evolution.
As of July 9, 2025, all project components have been implemented and verified as complete:
- Frontend Components: 124 files - 100% complete
- Backend Components: 42 files - 100% complete
- Total Project Files: 166 files - 100% complete
See the detailed verification table in files/frontend_verification_table.md for a comprehensive listing of all project files and their status.
-
File Upload Flow:
- Frontend
FileUpload
component connects to backend/api/v1/files/upload
endpoint - Upload progress tracking with real-time updates
- Backend generates file metadata and stores uploaded files
- Frontend
-
File Preview:
- Frontend requests preview via
/api/v1/data/preview/{file_id}
endpoint - Backend parses CSV/Excel files and returns structured column/row data
- Frontend displays structured table with column types and sample rows
- Frontend requests preview via
-
Agent Workflow:
- Frontend initiates workflows via agent-specific endpoints
- Backend orchestrates agent execution and returns statuses
- Frontend displays real-time agent progress and outputs
-
Error Handling:
- Frontend implements fallbacks for backend unavailability
- Backend provides detailed error responses with appropriate HTTP status codes
- Logging implemented on both sides for diagnostics
Our Enterprise Insights Copilot leverages a sophisticated multi-agent architecture powered by Meta's Llama 3.1, LangChain, and LangGraph. The system uses a directed acyclic graph (DAG) of specialized agents, each with specific responsibilities in the data analysis pipeline.
-
π Data Profile Agent
- Purpose: Analyzes dataset structure, types, distributions
- Model: Llama 3.1 70B
- Key Features:
- Automated schema detection
- Statistical profiling (mean, median, variance, etc.)
- Data quality assessment (missing values, outliers)
- Dataset metadata generation
-
π§Ή File Upload Agent
- Purpose: Handles file ingestion, validation, and preprocessing
- Model: Llama 3.1 8B
- Key Features:
- Multiple format support (CSV, Excel, JSON)
- Data validation and error detection
- Column type inference
- Initial data cleaning
-
π― Planning Agent
- Purpose: Orchestrates the entire workflow, plans analysis strategy
- Model: Llama 3.1 70B
- Key Features:
- User query decomposition
- Task planning and sequencing
- Agent selection and coordination
- Workflow monitoring and adjustment
-
π‘ Insight Agent
- Purpose: Discovers key insights and patterns in data
- Model: Llama 3.1 70B with enhanced reasoning
- Key Features:
- Pattern recognition
- Anomaly detection
- Correlation analysis
- Business context application
-
βοΈ Critique Agent
- Purpose: Validates insights, identifies flaws, ensures quality
- Model: Llama 3.1 70B with specialized prompting
- Key Features:
- Statistical validation
- Logical consistency checking
- Bias detection
- Alternative hypothesis exploration
-
π€ Debate Agent
- Purpose: Explores multiple perspectives on the data
- Model: Dual Llama 3.1 70B instances with contrasting viewpoints
- Key Features:
- Multiple perspective generation
- Dialectical reasoning
- Weighted insight ranking
- Uncertainty quantification
-
π Viz Agent
- Purpose: Creates appropriate visualizations for insights
- Model: Llama 3.1 8B with visualization specialization
- Key Features:
- Chart type selection
- D3.js configuration generation
- Visual narrative creation
- Color scheme and accessibility optimization
-
π Report Agent
- Purpose: Compiles insights into coherent reports
- Model: Llama 3.1 70B
- Key Features:
- Narrative generation
- Insight prioritization
- Report structure creation
- Executive summary generation
The agents are orchestrated using LangGraph, which provides:
- Directed Workflows: Sequential and parallel processing paths
- State Management: Persistent context across agent interactions
- Conditional Routing: Dynamic workflow adjustments based on data characteristics
- Parallel Processing: Concurrent execution when possible
- Error Handling: Graceful failure recovery and workflow continuation
# Example LangGraph agent workflow configuration
from langchain_core.runnables import ConfigurableField
from langgraph.graph import StateGraph, END
def create_agent_graph():
graph = StateGraph(state_schema=WorkflowState)
# Add nodes for each agent
graph.add_node("planning_agent", planning_agent)
graph.add_node("data_profile_agent", data_profile_agent)
graph.add_node("insight_agent", insight_agent)
graph.add_node("critique_agent", critique_agent)
graph.add_node("viz_agent", viz_agent)
graph.add_node("report_agent", report_agent)
# Define edges
graph.add_edge("planning_agent", "data_profile_agent")
graph.add_conditional_edges(
"data_profile_agent",
route_based_on_data_quality,
{
"high_quality": "insight_agent",
"needs_cleaning": "file_upload_agent"
}
)
graph.add_edge("insight_agent", "critique_agent")
graph.add_edge("critique_agent", "viz_agent")
graph.add_edge("viz_agent", "report_agent")
graph.add_edge("report_agent", END)
return graph.compile()
The Retrieval-Augmented Generation (RAG) system enhances the agents with contextual information:
-
Document Processor
- Purpose: Prepares documents for indexing
- Key Features:
- Text extraction from multiple formats
- Chunk optimization with overlap
- Metadata extraction and enrichment
- Document structure preservation
-
Vector Database (Pinecone)
- Purpose: Stores and retrieves document embeddings
- Key Features:
- High-dimensional vector storage
- Semantic similarity search
- Metadata filtering
- Low-latency querying
- Index management
-
Embedding System
- Purpose: Converts text to semantic vectors
- Model: BAAI/bge-large-en-v1.5
- Key Features:
- High-quality semantic representation
- Optimized for English business text
- 1024-dimensional embedding space
- Context window optimization
-
RAG Orchestrator
- Purpose: Combines retrieval with generation
- Key Features:
- Query rewriting for better retrieval
- Multi-query strategies
- Document reranking
- Context window management
- Retrieved content fusion
# Example RAG system configuration
from langchain.vectorstores import Pinecone
from langchain.embeddings import HuggingFaceEmbeddings
from langchain.retrievers import ContextualCompressionRetriever
from langchain.retrievers.document_compressors import LLMChainExtractor
# Initialize embeddings
embeddings = HuggingFaceEmbeddings(model_name="BAAI/bge-large-en-v1.5")
# Initialize Pinecone
pinecone_index = Pinecone.from_existing_index(
index_name="enterprise-insights-index",
embedding=embeddings,
namespace="customer_data"
)
# Create retriever with contextual compression
base_retriever = pinecone_index.as_retriever(
search_type="similarity",
search_kwargs={"k": 5}
)
compressor = LLMChainExtractor.from_llm(llm)
compression_retriever = ContextualCompressionRetriever(
base_compressor=compressor,
base_retriever=base_retriever
)
LangChain provides the foundation for agent capabilities:
- Chain Composition: Sequential processing of data through multiple LLM interactions
- Tool Integration: API calls, database access, and function execution
- Memory Systems: Short and long-term memory for context retention
- Prompt Templates: Specialized prompting strategies for each agent role
- Output Parsing: Structured extraction of insights and metadata
# Example LangChain agent configuration
from langchain.agents import AgentExecutor, create_structured_chat_agent
from langchain.prompts import ChatPromptTemplate
prompt = ChatPromptTemplate.from_messages([
("system", INSIGHT_AGENT_SYSTEM_PROMPT),
("human", "{input}"),
("ai", "{agent_scratchpad}")
])
insight_agent = create_structured_chat_agent(llm, tools, prompt)
insight_executor = AgentExecutor(agent=insight_agent, tools=tools, verbose=True)
This architecture provides a robust foundation for complex data analysis tasks while maintaining flexibility to adapt to different domains and data types.