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.
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
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]
# 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.txtuvicorn app.api:app --reloadstreamlit run streamlit_app.pyTest in browser or Swagger UI:
http://localhost:8000/recommendation?customer_id=C001Open Swagger Docs:
http://localhost:8000/docs-
β 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
| 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 |
βββ 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
{
"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..."
}
]
}-
π§Ύ 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
MIT License Β© Yash Dewangan
Feel free to connect or suggest improvements!
- Built by Yash Dewangan
- πGithub: YashDewangan
- π§Email: yashdew06@gmail.com
- πLinkedin: YashDewangan
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.