A demonstration of AI-powered ERP (Enterprise Resource Planning) system integration using an agentic architecture. This project showcases how large language models can interpret natural language queries and execute business operations against mock ERP data.
This project implements a multi-agent system that:
- Accepts natural language queries via REST API or WebSocket chat
- Routes requests through a pipeline of specialized AI agents
- Executes ERP operations (inventory, orders, customers)
- Evaluates responses for quality and completeness
User Query -> Frontline -> Orchestrator -> Worker -> Evaluator -> Response
| ^
[ERP Services] |
| |
[Mock Data] (feedback loop)
- Frontline Agent - Initial routing decision (handle directly or send to orchestrator)
- Orchestrator Agent - Analyzes intent and selects appropriate worker
- Worker Agents - Execute specialized tasks:
- ERP Worker - Inventory queries, stock transfers, order management
- Search Worker - Web searches
- Email Worker - Email composition
- General Worker - Conversation and simple queries
- Evaluator Agent - Validates worker output against success criteria
The project includes a complete mock ERP with:
- Inventory Management - Stock levels, locations, transfers, reorder alerts
- Order Management - Order creation, status tracking, fulfillment
- Customer Data - Customer records and order history
- Reporting - Low stock alerts, dead stock analysis
- Node.js 22+
- Docker & Docker Compose
- OpenAI API key
# Clone the repository
git clone <repo-url>
cd erp-use-cases
# Copy environment file
cp .env.example .env
# Add your OPENAI_API_KEY to .env
# Start with Docker Compose
docker compose upPOST /api/ai/query
Content-Type: application/json
{
"query": "What's the stock level for WIDGET-001?",
"session_id": "demo-session"
}GET /api/inventory- List all inventoryGET /api/inventory/:sku- Get stock by SKUPOST /api/inventory/transfer- Transfer stock between locationsGET /api/orders- List ordersPOST /api/orders- Create orderGET /api/reports/low-stock- Low stock alerts
ws://localhost:8000/ws
Models are configured in src/llm-models/modelConfig.json:
{
"frontline": { "model": "gpt-5-chat-latest" },
"orchestrator": { "model": "gpt-5" },
"evaluator": { "model": "gpt-5" },
"workers": {
"erp": { "model": "gpt-5-mini" },
"search": { "model": "gpt-5-mini" },
"email": { "model": "gpt-5-mini" },
"general": { "model": "gpt-5-mini" }
}
}modules/agent/
├── src/
│ ├── llm-models/ # Centralized model configuration
│ ├── lib/ # Agent factory and utilities
│ ├── prompts/ # System prompts for each agent
│ ├── workers/ # Worker implementations
│ ├── mocks/
│ │ ├── controllers/ # REST API routes
│ │ ├── services/ # Business logic
│ │ ├── repositories/ # Data access
│ │ └── data/ # JSON data files
│ ├── frontline.ts # Initial routing agent
│ ├── orchestrator.ts # Worker coordination
│ ├── evaluator.ts # Output validation
│ └── server.ts # Express + WebSocket server
├── docs/ # Architecture documentation
└── tests/ # Test files
docs/mocks-architecture.md- REST API architecture diagramsdocs/mocks-ai-rest-architecture.md- AI REST endpoint flowdocs/mocks-chat-ai-architecture.md- WebSocket chat flowdocs/mocks-business-context.md- Business challenges addresseddocs/agent-control-flow.md- Agent pipeline diagrams
"What's the stock level for WIDGET-001?"
"Show me all pending orders"
"Transfer 10 units of GADGET-002 from WH-EAST to WH-WEST"
"Which items are below their reorder point?"
"Give me an order analytics summary"
"What is the demand forecast for WIDGET-001 for the next 30 days?"
"Which products are at risk of stockout? Show me recommendations"
"Analyze the seasonal demand patterns for SEASONAL-005"
# Run tests
npm test
# Type check
npm run typecheckImport postman_collection.json for pre-configured API requests including AI query examples.
MIT