Skip to content

yashdew3/LangGraph-Customer360-Recommender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Customer 360Β° Recommender System

A modular AI-powered system that analyzes customer profiles, product usage, and behavioral signals to generate cross-sell and upsell opportunities β€” powered by LangGraph, FastAPI, Streamlit, and Hugging Face Transformers.

LangGraph Python License


πŸ” What This Project Does

This project uses a LangGraph DAG of AI agents to:

  • 🧠 Understand customer context from a PostgreSQL database or CSV
  • πŸ“Š Analyze product usage and purchase history
  • πŸ” Suggest related/co-purchased product opportunities
  • 🎯 Score each opportunity based on business impact
  • πŸ“ Generate a natural-language research report
  • 🌐 Expose the entire pipeline via a FastAPI endpoint
  • πŸ’» Provide a beautiful Streamlit dashboard for business users

🧱 Project Architecture

flowchart TD
    A[πŸ“₯ Input: customer_id] --> B[πŸ‘€ Customer Context Agent]
    B --> C[πŸ“ˆ Purchase Pattern Agent]
    C --> D[πŸ”— Product Affinity Agent]
    D --> E[πŸ’‘ Opportunity Scoring Agent]
    E --> F[πŸ“ Report Generator Agent]
    F --> G[πŸ“€ Output: API + Streamlit]
Loading

πŸš€ How to Run Locally

πŸ”§ Setup

# 1. Clone repo and enter project
git clone https://github.com/yashdew3/langgraph-customer360-recommender.git
cd langgraph-customer360-recommender

# 2. Create virtual environment
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# 3. Install dependencies
pip install -r requirements.txt

🧬 Start Backend API

uvicorn app.api:app --reload

πŸ’» Start Streamlit Frontend

streamlit run streamlit_app.py

πŸ“‚ Sample API Endpoint

Test in browser or Swagger UI:

http://localhost:8000/recommendation?customer_id=C001

Open Swagger Docs:

http://localhost:8000/docs

🧠 Features

  • βœ… Modular agent system using LangGraph

  • βœ… FastAPI-based REST interface

  • βœ… PostgreSQL and CSV fallback support

  • βœ… Real-time product affinity via Hugging Face

  • βœ… Executive-ready research reports

  • βœ… Interactive Streamlit UI for business teams

  • βœ… Supports extension for new agents, LLMs, analytics


πŸ“Š Technologies Used

Tech Purpose
LangGraph Agent-based DAG orchestration
FastAPI RESTful API backend
Streamlit Real-time frontend/dashboard
PostgreSQL Structured customer database
Transformers Embedding and NLP scoring
Uvicorn ASGI web server for FastAPI

πŸ—οΈ Folder Structure

β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ agents/              # All 5 sub-agents
β”‚   β”œβ”€β”€ db.py                # PostgreSQL interface
β”‚   β”œβ”€β”€ dag.py               # LangGraph DAG pipeline
β”‚   └── api.py               # FastAPI endpoint
β”‚
β”œβ”€β”€ data/                    # Sample CSV + SQL
β”‚
β”œβ”€β”€ dashboard/  
β”‚   └── streamlit_app.py         # Streamlit frontend
β”‚
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ .gitignore
β”œβ”€β”€ .env
└── LICENSCE

βœ… Example Output

{
  "executive_summary": "Edge Communications shows strong usage in Core Management Platform...",
  "recommendations": [
    {
      "product": "AI Insights Module",
      "score": 87,
      "rationale": "Related to Workflow Automation; High product usage..."
    }
  ]
}

πŸ§ͺ Future Enhancements

  • 🧾 PDF report export (via WeasyPrint or PDFKit)

  • πŸ—ƒοΈ Add dynamic product catalog & segments

  • 🧬 Integrate LangChain agents for richer LLM outputs

  • ☁️ Deploy with Docker, CI/CD, or Streamlit Sharing


πŸ“„ License

MIT License Β© Yash Dewangan

πŸ’¬ Let's Connect

Feel free to connect or suggest improvements!

🀝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page (if you have one) or open a new issue to discuss changes. Pull requests are also appreciated.

About

🎯 AI-powered customer 360Β° recommender system using LangGraph, FastAPI, and Streamlit β€” generates cross-sell/upsell reports from customer data in real-time.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages