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.
git clone https://github.com/your-username/multi-agent-inventory.git
cd multi-agent-inventorypython -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activatepip install -r requirements.txt- Install Ollama
- Pull the Phi model:
ollama run phi- Keep Ollama running locally at
http://localhost:11434
python agents/main.pypython agents/store_agent.pypython agents/warehouse_agent.pypython agents/supplier_agent.pyYou can simulate a particular day by modifying the simulate_day(day_number) function call.
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 (
phimodel) - 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
)[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.
Dhanashri Patil
📧 patil.dhanashrik@gmail.com
🐙 DhanashriPatil11
🔗 dhanashri-patil24
This project was built as part of the Hackathon challenge: Optimizing Retail Inventory with Multi Agents 💡