https://github.com/dhanashripatil11/retail-multiagent
A collaborative multi-agent system powered by local LLMs (Ollama) for real-time retail inventory optimization and demand-supply balancing.
https://github.com/dhanashripatil11/retail-multiagent
ai aiagentsframework ml multiagents ollama pandas-python python retailinventory
Last synced: 11 months ago
JSON representation
A collaborative multi-agent system powered by local LLMs (Ollama) for real-time retail inventory optimization and demand-supply balancing.
- Host: GitHub
- URL: https://github.com/dhanashripatil11/retail-multiagent
- Owner: DhanashriPatil11
- Created: 2025-04-06T12:04:55.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-04-06T12:24:21.000Z (11 months ago)
- Last Synced: 2025-04-09T22:05:58.507Z (11 months ago)
- Topics: ai, aiagentsframework, ml, multiagents, ollama, pandas-python, python, retailinventory
- Language: Python
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
```bash
git clone https://github.com/your-username/multi-agent-inventory.git
cd multi-agent-inventory
```
### 2. Create a Virtual Environment (Optional but Recommended)
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```
### 3. Install Dependencies
```bash
pip install -r requirements.txt
```
### 4. Download Ollama and Run the Model
- Install [Ollama](https://ollama.com/)
- Pull the Phi model:
```bash
ollama run phi
```
- Keep Ollama running locally at `http://localhost:11434`
---
## ๐ How to Run Agents
### Main File
```bash
python agents/main.py
```
### Store Agent
```bash
python agents/store_agent.py
```
### Warehouse Agent
```bash
python agents/warehouse_agent.py
```
### Supplier Agent
```bash
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:
```python
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**
๐ง  patil.dhanashrik@gmail.com
๐  [DhanashriPatil11](https://github.com/DhanashriPatil11)
๐  [dhanashri-patil24](https://www.linkedin.com/in/dhanashri-patil24/)
---
> This project was built as part of the Hackathon challenge: **Optimizing Retail Inventory with Multi Agents** ๐ก