Skip to content

HarishDvs/chainly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logistics Intelligence Platform

An AI-powered multi-agent system for warehouse inventory management. Upload an inventory CSV and three specialized agents automatically analyze stock levels, forecast 30-day demand, and generate purchase orders — all orchestrated with LangGraph and powered by Groq's Llama 3.3 70B.

Live demo: Deployed on AWS Elastic Beanstalk


How It Works

The system runs three agents in sequence via a LangGraph state graph:

Inventory CSV Upload
        │
        ▼
┌───────────────────┐
│   Agent 1         │  Parses inventory, identifies at-risk
│   Inventory &     │  and critical items using LLM analysis
│   Alert Agent     │
└────────┬──────────┘
         │ always
         ▼
┌───────────────────┐
│   Agent 2         │  Forecasts 30-day demand per item
│   Demand          │  using 90-day sales history
│   Forecast Agent  │
└────────┬──────────┘
         │ only if critical items exist
         ▼
┌───────────────────┐
│   Agent 3         │  Scores suppliers, sizes orders using
│   Supplier &      │  forecast data, generates Purchase Orders
│   PO Agent        │
└───────────────────┘

Each agent receives and updates a shared AgentState TypedDict — no agent re-fetches data the previous one already computed.


Tech Stack

Layer Technology
Backend FastAPI + Uvicorn
Agent Orchestration LangGraph
LLM Groq — Llama 3.3 70B Versatile
Data Processing Pandas
Frontend Vanilla HTML/CSS/JS (served by FastAPI)
ML Notebook Jupyter (scikit-learn, pandas)
Deployment AWS Elastic Beanstalk

Features

  • Inventory analysis — upload any CSV with item_id, item_name, current_stock, reorder_point, max_stock columns; Agent 1 classifies every item as critical / high / medium risk
  • Demand forecasting — Agent 2 generates a 30-day daily forecast with trend direction and confidence rating per item
  • Auto purchase orders — Agent 3 scores available suppliers on price, reliability, and lead time, then generates timestamped POs sized to the forecast
  • Conditional routing — Agent 3 only fires when Agent 1 finds critical items (cost-efficient LLM usage)
  • Sample data — downloadable sample inventory CSV at /download/sample-inventory.csv

Project Structure

├── backend/
│   ├── main.py           # FastAPI app, REST endpoints, static file serving
│   ├── graph.py          # LangGraph workflow definition and routing logic
│   ├── state.py          # Shared AgentState TypedDict
│   └── agents/
│       ├── inventory.py  # Agent 1 — stock analysis & alert detection
│       ├── forecast.py   # Agent 2 — 30-day demand forecasting
│       └── supplier.py   # Agent 3 — supplier scoring & PO generation
├── frontend/
│   ├── index.html        # Landing page
│   ├── agent1.html       # Inventory agent UI
│   ├── agent2.html       # Forecast agent UI
│   └── agent3.html       # Purchase orders UI
├── scripts/
│   ├── generate_graphs.py        # Chart generation utilities
│   ├── prepare_walmart_data.py   # Kaggle M5 dataset → sample inventory CSV
│   └── generate_report.py        # Report generation
├── data/sample/          # Sample inventory CSV and sales history JSON
├── deploy/               # Elastic Beanstalk config and Procfile
├── CPPE_ML_Model.ipynb   # ML model notebook (exploratory analysis)
├── .env.example          # Environment variable template
└── requirements.txt

Running Locally

1. Clone and install dependencies

git clone https://github.com/HarishDvs/logistics-agentic-project.git
cd logistics-agentic-project
python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
pip install -r requirements.txt

2. Set environment variables

cp .env.example .env
# Add your GROQ_API_KEY — get one free at console.groq.com

3. Start the server

uvicorn backend.main:app --reload

Open http://localhost:8000


API Endpoints

Method Endpoint Description
POST /api/agent1/analyze Upload inventory CSV — runs full pipeline
POST /api/agent2/forecast Run forecast only (JSON body with item IDs)
POST /api/agent3/purchase-orders Alias for full pipeline, returns POs
GET /api/sample-inventory Returns sample inventory CSV as JSON
GET /download/sample-inventory.csv Download sample CSV file
GET /health Health check + Groq config status

Deployment

The app is configured for AWS Elastic Beanstalk with a single-instance Python environment. The Procfile and .ebextensions/python.config wire up the WSGI path.

eb deploy

Set GROQ_API_KEY and LOW_STOCK_THRESHOLD (default: 20%) as EB environment variables in the console.


Sample CSV Format

item_id,item_name,current_stock,reorder_point,max_stock
ITEM001,Widget A,45,100,500
ITEM002,Gadget B,12,50,300

Any item where current_stock < reorder_point or stock percentage is below the threshold triggers an alert.

About

3-agent AI pipeline for warehouse management — inventory alerts, 30-day demand forecasting, and automated purchase orders. LangGraph · Groq · FastAPI · AWS.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages