Skip to content

A collaborative multi-agent system powered by local LLMs (Ollama) for real-time retail inventory optimization and demand-supply balancing.

Notifications You must be signed in to change notification settings

shripatil70/retail-multiagent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi-Agent Retail Inventory Optimization System

📌 Project Overview

This project leverages a multi-agent architecture integrated with local LLMs (Ollama) to optimize retail inventory management. Three autonomous agents—StoreAgent, WarehouseAgent, and SupplierAgent—collaborate to:

  • Monitor sales trends and inventory levels
  • Forecast demand and suggest pricing strategies
  • Automate decision-making for reordering and supplier communication

The agents use structured data and dynamic prompts to interact with a locally hosted LLM (phi via Ollama) for context-aware retail decisions.


⚙️ Setup Instructions

1. Clone the Repository

git clone https://github.com/your-username/multi-agent-inventory.git
cd multi-agent-inventory

2. Create a Virtual Environment (Optional but Recommended)

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

3. Install Dependencies

pip install -r requirements.txt

4. Download Ollama and Run the Model

  • Install Ollama
  • Pull the Phi model:
ollama run phi
  • Keep Ollama running locally at http://localhost:11434

🚀 How to Run Agents

Main File

python agents/main.py

Store Agent

python agents/store_agent.py

Warehouse Agent

python agents/warehouse_agent.py

Supplier Agent

python agents/supplier_agent.py

You can simulate a particular day by modifying the simulate_day(day_number) function call.


🧠 Ollama Integration

The agents communicate with the local Ollama LLM via REST API. Each agent:

  • Extracts daily data from CSV files
  • Formats a natural language prompt
  • Sends the prompt to the Ollama server (phi model)
  • Parses the streaming NDJSON response for decision output

Example API call:

response = requests.post(
    "http://localhost:11434/api/generate",
    json={"model": "phi", "prompt": prompt},
    stream=True
)

📊 Example Output

[StoreAgent] Day 1 Decision:
Based on high sales volume and good customer reviews, consider a slight price increase and marketing promotion.

[WarehouseAgent] Day 1 Decision:
Stock levels are low and close to the reorder point. Reorder today to avoid stockouts.

[SupplierAgent] Day 1 Decision:
Prepare a shipment based on historical lead times and warehouse capacity. Ensure timely dispatch.

📬 Contact

Dhanashri Patil
📧 Email patil.dhanashrik@gmail.com
🐙 GitHub DhanashriPatil11
🔗 LinkedIn dhanashri-patil24


This project was built as part of the Hackathon challenge: Optimizing Retail Inventory with Multi Agents 💡

About

A collaborative multi-agent system powered by local LLMs (Ollama) for real-time retail inventory optimization and demand-supply balancing.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages