An autonomous pharmacy ecosystem powered by a multi-agent AI. Customers order medications through natural voice or text conversation in English, German, Arabic, and Hindi. The system predicts refill needs, enforces prescription rules, and autonomously executes backend procurement — with minimal human intervention.
| Feature | Description |
|---|---|
| 🎤 Voice & Text Ordering | Natural conversation with multi-turn context understanding |
| 🌍 Multi-Language | English, Deutsch, العربية, हिन्दी — auto-detected |
| 🤖 Multi-Agent Architecture | Ordering, Safety, Forecast & Procurement agents |
| 💊 Safety Enforcement | Prescription (RX) validation, no medical advice, Tier-1 alternatives only |
| 📈 Predictive Refills | Learns from order history, predicts depletion dates, auto-suggests refills |
| 🏭 Warehouse Fulfillment | Webhook-triggered fulfillment with auto-procurement on low stock |
| 📊 Observability | Full Langfuse tracing — every agent decision is logged and inspectable |
| 🛒 Cart & Checkout | Complete ordering flow with Cash on Delivery (COD) |
┌──────────────────────────────────────────┐
│ Frontend (React + Vite) │
│ Chat UI · Voice · Admin · Predictions │
└─────────────────┬────────────────────────┘
│ REST API
┌─────────────────┴────────────────────────┐
│ FastAPI Backend │
│ │
│ Ordering Agent ──► Safety Agent │
│ │ │
│ Orchestrator ──► Forecast Agent │
│ │ │
│ Tool Executor ──► Procurement Agent ──► Webhooks
│ │
│ SQLite · ChromaDB · Langfuse │
└──────────────────────────────────────────┘
| Agent | Role |
|---|---|
| Ordering Agent | LLM-powered conversational agent. Understands intent, manages cart, handles multi-turn context |
| Safety Agent | Validates inputs, enforces prescription rules, blocks medical advice, checks drug safety |
| Forecast Agent | Predicts stock depletion using sales velocity analysis. Triggers proactive alerts |
| Procurement Agent | Auto-generates purchase orders, sends webhooks to suppliers, updates inventory |
| Layer | Technology |
|---|---|
| Frontend | React 18 + Vite + Tailwind CSS |
| Backend | Python FastAPI |
| Database | SQLite |
| Vector Store | ChromaDB + sentence-transformers |
| LLM (Primary) | Groq — Llama 3.3 70B |
| LLM (Fallback) | OpenRouter — Gemma 3 27B |
| Voice | Web Speech API (STT / TTS) |
| Observability | Langfuse |
- Python 3.10+
- Node.js 18+
- API Keys (Groq, Langfuse)
git clone https://github.com/jadhavkrushna/mediloon.git
cd mediloon
cp .env.example .env
# Fill in your API keys in .envRequired .env variables:
GROQ_API_KEY=gsk_...
OPENROUTER_API_KEY=sk-or-...
LANGFUSE_PUBLIC_KEY=pk-lf-...
LANGFUSE_SECRET_KEY=sk-lf-...
LANGFUSE_HOST=https://cloud.langfuse.comcd backend
python -m venv venv
# Windows
venv\Scripts\activate
# Mac / Linux
source venv/bin/activate
pip install -r requirements.txt
python main.pyBackend runs at http://localhost:8000
cd frontend
npm install
npm run devFrontend runs at http://localhost:5173
mediloon/
├── backend/
│ ├── agents/
│ │ ├── orchestrator.py # Main pipeline
│ │ ├── ordering_agent.py # LLM conversational agent
│ │ ├── safety_agent.py # Input/output guardrails
│ │ ├── forecast_agent.py # Stock depletion predictions
│ │ └── procurement_agent.py # Auto-procurement + webhooks
│ ├── routes/ # FastAPI endpoints
│ ├── tools/ # Cart, query, trace tools
│ ├── db/ # SQLite database + seed data
│ ├── vector/ # ChromaDB vector search
│ ├── observability/ # Langfuse client
│ └── main.py # Server entry point
├── frontend/
│ └── src/
│ ├── components/ # UI components
│ ├── hooks/ # useSpeech, useRefillPredictions
│ ├── i18n/ # Language context + translations
│ └── pages/ # AdminDashboard
├── data/ # Excel source files
├── .env.example # Environment variables template
└── README.md
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/chat |
Main chat endpoint (text & voice) |
GET |
/api/cart/{session_id} |
Get session cart |
GET |
/api/forecast/low-stock |
Predicted stock-outs |
GET |
/api/refill/predictions/{id} |
Customer refill predictions |
POST |
/api/procurement/generate |
Auto-generate purchase order |
GET |
/api/admin/medications |
List all medications |
- ✅ Prescription (RX) enforcement from source data
- ✅ No medical advice, diagnoses, or dosage recommendations
- ✅ No antibiotic suggestions
- ✅ Tier-1 alternatives only (same active ingredient)
- ✅ All medications sourced from database only — no hallucination
- ✅ Input & output guardrails on every agent turn
Every agent turn is traced via Langfuse:
- Safety Check → Input validation result
- Ordering Agent → LLM reasoning, action chosen, model used
- Tool Execution → Search results, cart operations
- Output Guard → Final safety check
Access live traces at cloud.langfuse.com
Krushna Jadhav
GitHub