This project implements a production-ready multi-agent customer service system for an e-commerce platform.
It supports multi-turn conversations and enforces business policies for:
- Order Cancellation (with 24-hour rule)
- Order Tracking
- Product Information (knowledge base)
- Session-based memory and state management
- Structured and predictable outputs
- Observability with logging
- Mock external APIs using Beeceptor
- Dockerized deployment
No third-party agent frameworks (LangChain, AutoGen, etc.) are used.
All agents are built from scratch in Python.
Validates order ID format: ORD-XXXX
Calls /order-details to check order age
Enforces 24-hour cancellation policy
Calls /order-cancel only if eligible
Validates order ID
Calls /order-track
Returns order status and estimated delivery date
app/
├── main.py
├── agents.py
├── state.py
├── ml_intent.py
├── product_knowledge.json
Dockerfile
docker-compose.yml
requirements.txt
README.md
architecture.png
This project includes an optional lightweight ML component to improve intent routing in the OrchestratorAgent.
Instead of relying only on keyword rules (e.g., checking if the message contains the word "cancel" or "track"), the orchestrator can use a small TF-IDF + Naive Bayes model to classify the user’s intent into one of:
cancel→ route toOrderCancellationAgenttrack→ route toOrderTrackingAgentproduct→ route toProductInfoAgent
This makes routing more robust for messages like:
- “I want a refund for my purchase” →
cancel - “Where is my package?” →
track
app/ml_intent.py→ trains a small classifier and exposespredict_intent(message)app/main.py→ callspredict_intent()inside the Orchestrator routing logic
In app/main.py:
- Set
USE_ML_INTENT = Trueto enable - Set
USE_ML_INTENT = Falseto disable and use keyword routing only
Send these requests to POST /chat (via Swagger UI at /docs or curl):
Cancel intent (no "cancel" keyword):
{"session_id":"ml1","message":"I want a refund for my purchase ORD-1234"}
### Compliance with Challenge Requirements
Multi-agent architecture: ✅
Order cancellation & tracking policies: ✅
24-hour rule: ✅
Multi-turn state management: ✅
Structured outputs: ✅
Observability (logging): ✅
Mock APIs (Beeceptor): ✅
Dockerized: ✅
No third-party agent frameworks used: ✅
Supports multi-turn context via last_product