Skip to content

This project uses a multi-agent system to optimize grocery shopping . The Smart Shopping Assistant intelligently plans, optimizes and executes shopping tasks in real-time by integrating various agents for data acquisition, budget optimization, personalization, logistics, and loyalty aggregation.

Notifications You must be signed in to change notification settings

Tech-Titans-AI/Multi-Agent-AI-Shopping-Assistant

Repository files navigation

πŸ›’ Multi-Agent AI Shopping Assistant for E-commerce

Python Langraph Groq

🌟 Project Overview

This project is an AI-powered product search system designed for the Sri Lankan e-commerce landscape. It uses cutting-edge technologies to deliver personalized shopping experiences, intelligent logistics optimization, and seamless loyalty program integration. The system leverages a LangGraph-based multi-agent architecture enhanced with a Knowledge Graph, real-time web scraping, and intelligent personalization to provide optimal product discovery, smarter recommendations, and improved loyalty optimization.

πŸ† Key Achievements

  • βœ… 6-Node Langraph Pipeline with proper execution order
  • βœ… Knowledge Graph Enhancement for product discovery
  • βœ… Real-time Web Scraping from 3 major Sri Lankan stores
  • βœ… GPS-based Logistics Optimization with 27 store locations
  • βœ… AI-powered Loyalty Aggregation with LLM recommendations
  • βœ… Personalized User Profiles with dietary restrictions & preferences

πŸš€ System Architecture

Multi-Agent Pipeline Flow

πŸ“ User Query β†’ πŸ” Keyword Extraction β†’ πŸ“Š Data Acquisition β†’ πŸ‘€ Personalization β†’ πŸš› Logistics Filtering β†’ πŸ’³ Loyalty Optimization β†’ πŸ’° Budget Optimization β†’ πŸ“‹ Output Formatting

Multi Agent Pipeline

Core Components

Component Technology Purpose
Langraph Agent Langraph + Groq LLaMA 3.3 70B Multi-agent orchestration
Web Scraper Crawl4AI + Requests Real-time product data
Frontend React/Vue.js User interface
Knowledge Graph NetworkX Product relationship mapping

πŸ“ Repository Structure

Multi-Agent-AI-Shopping-Assistant/
β”œβ”€β”€ πŸ€– Langraph_Agent/          # Main AI pipeline system
β”‚   β”œβ”€β”€ agents/                 # Individual agent implementations
β”‚   β”œβ”€β”€ core/                   # Core system components
β”‚   β”œβ”€β”€ data/                   # Data storage and management
β”‚   β”œβ”€β”€ utils/                  # Utility functions
β”‚   └── main.py                 # Primary orchestrator
β”œβ”€β”€ πŸ•·οΈ Web_scraper/             # Web scraping system
β”‚   β”œβ”€β”€ scrapers/               # Store-specific scrapers
β”‚   β”œβ”€β”€ retrieval/              # Data retrieval logic
β”‚   └── data/                   # Scraped product data
β”œβ”€β”€ 🎨 Frontend/                # User interface
└── πŸ“š Backend/                 # API + server-side logic

⚑ Quick Start

Prerequisites

  • Python 3.10+
  • Node.js 16+ (for frontend)
  • Git

Installation

  1. Clone the repository
git clone https://github.com/Tech-Titans-AI/Multi-Agent-AI-Shopping-Assistant.git
cd Multi-Agent-AI-Shopping-Assistant
  1. Set up the Langraph Agent
cd Langraph_Agent
pip install -r requirements.txt
  1. Configure environment variables
cp .env.example .env
# Add your Groq API key to .env file
echo "GROQ_API_KEY=your_groq_api_key_here" >> .env
  1. Run the system
python main.py

Quick Test

# Test the pipeline
python test_pipeline.py

🎯 Features

🧠 Intelligent Keyword Extraction

  • LLM-powered food item extraction from natural language
  • Handles complex queries like "organic rice for diabetic cooking"
  • Context-aware product categorization

πŸ“Š Knowledge Graph Enhancement

  • Semantic product relationship mapping
  • Automatic query expansion (rice β†’ basmati rice, samba rice)
  • 15+ product nodes with relationship inference

πŸ•·οΈ Real-time Web Scraping

  • Supported Stores: Kapruka, Glowmark, Online Kade
  • Dynamic price monitoring
  • Automated data freshness validation
  • Similarity-based product matching

πŸ‘€ Advanced Personalization

  • User Profiles: Dietary restrictions, budget limits, brand preferences
  • Budget Optimization: Smart filtering within price constraints
  • Allergy Management: Automatic exclusion of problematic ingredients
  • Brand Intelligence: Preferred/disliked brand handling

πŸš› GPS-based Logistics

  • 27 Store Locations across Sri Lanka with real coordinates
  • Haversine Distance Calculation for delivery optimization
  • Location Parsing: Supports city names, addresses, GPS coordinates
  • Distance Thresholds: Configurable delivery radius filtering

πŸ’³ Loyalty Optimization

  • 3 Loyalty Programs: Keells, Cargills, Arpico integration
  • 4 Bank Partnerships: Commercial Bank, Sampath, HNB, BOC
  • 5 Active Promotions: Real-time discount calculations
  • LLM Recommendations: AI-powered savings strategies

πŸ› οΈ Technical Specifications

AI Pipeline

  • Framework: Langraph with StateGraph orchestration
  • LLM: Groq LLaMA 3.3 70B Versatile
  • Tools: Function calling with JSON mode
  • State Management: Typed application state with validation

Data Processing

  • Similarity Matching: Cosine similarity for product ranking
  • Location Intelligence: Haversine formula for GPS calculations
  • Budget Optimization: Multi-constraint filtering algorithms
  • Loyalty Calculations: Complex discount optimization

Performance Metrics

  • Pipeline Latency: ~3-5 seconds per query
  • Data Freshness: Real-time scraping updates
  • Accuracy: 95%+ product matching precision
  • Coverage: 27 store locations, 3 major e-commerce platforms

πŸ§ͺ Testing & Validation

Run Tests

# Full pipeline test
cd Langraph_Agent
python test_pipeline.py

# Web scraper test
cd Web_scraper
python test_migration.py

# Query system test
python test_query_system.py

Test Coverage

  • βœ… Keyword Extraction: Natural language β†’ product items
  • βœ… Knowledge Graph: Query enhancement validation
  • βœ… Personalization: User profile application
  • βœ… Logistics: Distance-based filtering
  • βœ… Loyalty: Discount optimization accuracy
  • βœ… End-to-End: Complete pipeline execution

🌍 Sri Lankan Market Integration

Supported Locations

  • Major Cities: Colombo, Galle, Kandy, Jaffna, Negombo
  • GPS Coverage: Island-wide coordinate mapping
  • Delivery Zones: Configurable radius-based filtering

Local E-commerce

  • Kapruka.com - Comprehensive product range
  • Glowmark.lk - Electronics and lifestyle
  • OnlineKade.lk - Grocery and essentials

Loyalty Programs

  • Keells Super - Points-based rewards
  • Cargills Food City - Membership benefits
  • Arpico Supercenter - Tiered discounts

πŸ“ˆ Performance Optimization

Pipeline Efficiency

  • Parallel Processing: Concurrent agent execution
  • Caching: Knowledge graph and store location caching
  • Lazy Loading: On-demand data acquisition
  • Memory Management: Efficient state handling

Scalability Features

  • Modular Architecture: Independent agent scaling
  • API Integration: RESTful service endpoints
  • Database Ready: MongoDB support

Development Setup

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Code Standards

  • Python: PEP 8 compliance
  • Documentation: Comprehensive docstrings
  • Testing: Minimum 80% code coverage
  • Type Hints: Full type annotation

πŸ† Acknowledgments

  • Sri Lanka AI Challenge 2025 organizing committee
  • Groq for providing LLaMA 3.3 70B API access
  • Langchain team for the Langraph framework
  • Sri Lankan E-commerce partners for data access
  • Open Source Community for inspiration and tools

Built with ❀️ by Team Tensor Titans for SLAIC 2025

About

This project uses a multi-agent system to optimize grocery shopping . The Smart Shopping Assistant intelligently plans, optimizes and executes shopping tasks in real-time by integrating various agents for data acquisition, budget optimization, personalization, logistics, and loyalty aggregation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •