How monishp-eng/optistock-ai-an-autonomous-multi-agent-inventory-intelligence-demand-forecasting-system works
OptiStock is an inventory intelligence product for small businesses. Users authenticate, enter or import stock and sales data, then review inventory, forecasts, recommendations, supplier information, and agent activity through the React dashboard. The frontend calls a FastAPI REST service backed by SQLite. The backend also coordinates specialized agents for monitoring, anomalies, procurement, pricing, supplier scoring, alerts, and reporting. The README documents these capabilities; several backend implementations and routes were not sampled, so only documented or indexed relationships are shown.
Main entry points: api.py REST API · orchestrator.py Agent orchestrator · api.js API client · App.jsx App shell
Components 28
Dashboard
- App shell
optistock/frontend/src/App.jsx - Session state
optistock/frontend/src/context/AuthContext.jsx - Inventory views
optistock/frontend/src/pages/Inventory.jsx - Business dashboard
optistock/frontend/src/pages/Dashboard.jsx - Analysis views
optistock/frontend/src/pages/Analysis.jsx - Agent hub
optistock/frontend/src/pages/AgentHub.jsx - Sales entry
optistock/frontend/src/pages/SalesEntry.jsx - Supplier views
optistock/frontend/src/pages/Suppliers.jsx - API client
optistock/frontend/src/services/api.js
API and intelligence
- REST API
optistock/src/api.py - Authentication
optistock/src/auth.py - Hybrid forecasting
optistock/src/advanced_forecasting.py - Stock optimization
optistock/src/inventory_optimizer.py - Natural language queries
optistock/src/nl_query_engine.py - AI advice
optistock/src/agent_logic.py - Supplier scoring
optistock/src/supplier_scoring.py
Agent system
- Agent orchestrator
optistock/src/agents/orchestrator.py - Agent runtime
optistock/src/agents/base_agent.py - Inventory monitor
optistock/src/agents/inventory_monitor_agent.py - Anomaly detection
optistock/src/agents/anomaly_detection_agent.py - Auto procurement
optistock/src/agents/auto_procurement_agent.py - Dynamic pricing
optistock/src/agents/dynamic_pricing_agent.py - Supplier intelligence
optistock/src/agents/supplier_intelligence_agent.py - Alert notifications
optistock/src/agents/alert_notification_agent.py - Scheduled reports
optistock/src/agents/scheduled_reporting_agent.py
Persistence
- SQLite database
optistock/src/database.py
Other components
- Shop manager
- Google Gemini
Connections 40
- Shop manager → App shell: uses
- App shell → Session state: provides session
optistock/frontend/src/App.jsx - App shell → Business dashboard: routes to
optistock/frontend/src/App.jsx - App shell → Inventory views: routes to
optistock/frontend/src/App.jsx - App shell → Analysis views: routes to
optistock/frontend/src/App.jsx - App shell → Agent hub: routes to
optistock/frontend/src/App.jsx - Inventory views → API client: requests inventory
optistock/frontend/src/pages/Inventory.jsx - Business dashboard → API client: requests inventory
optistock/frontend/src/pages/Dashboard.jsx - Analysis views → API client: requests analysis
optistock/frontend/src/pages/Analysis.jsx - Agent hub → API client: controls agents
optistock/frontend/src/pages/AgentHub.jsx - Sales entry → API client: submits sales
- Supplier views → API client: requests suppliers
optistock/frontend/src/pages/Suppliers.jsx - Session state → REST API: validates token
optistock/frontend/src/context/AuthContext.jsx - API client → REST API: calls REST endpoints
- REST API → Authentication: authenticates requests
- Authentication → SQLite database: looks up users
optistock/src/auth.py - REST API → SQLite database: persists business data
- REST API → Hybrid forecasting: forecasts demand
- REST API → Stock optimization: calculates reorder levels
- REST API → Natural language queries: handles natural-language queries
- REST API → AI advice: generates business advice
- REST API → Supplier scoring: scores suppliers
- AI advice → Google Gemini: requests language generation
- Agent orchestrator → Inventory monitor: runs
optistock/src/agents/orchestrator.py - Agent orchestrator → Anomaly detection: runs
optistock/src/agents/orchestrator.py - Agent orchestrator → Auto procurement: runs
optistock/src/agents/orchestrator.py - Agent orchestrator → Dynamic pricing: coordinates
optistock/src/agents/orchestrator.py - Agent orchestrator → Supplier intelligence: coordinates
optistock/src/agents/orchestrator.py - Agent orchestrator → Alert notifications: coordinates
optistock/src/agents/orchestrator.py - Agent orchestrator → Scheduled reports: coordinates
optistock/src/agents/orchestrator.py - Inventory monitor → Agent runtime: inherits runtime
optistock/src/agents/inventory_monitor_agent.py - Anomaly detection → Agent runtime: inherits runtime
- Auto procurement → Agent runtime: inherits runtime
optistock/src/agents/auto_procurement_agent.py - Alert notifications → Agent runtime: inherits runtime
optistock/src/agents/alert_notification_agent.py - Scheduled reports → Agent runtime: inherits runtime
optistock/src/agents/scheduled_reporting_agent.py - Auto procurement → Hybrid forecasting: uses predictions
optistock/src/agents/auto_procurement_agent.py - Auto procurement → Stock optimization: calculates replenishment
optistock/src/agents/auto_procurement_agent.py - Inventory monitor → Stock optimization: checks stock thresholds
optistock/src/agents/inventory_monitor_agent.py - Alert notifications → SQLite database: records alerts
optistock/src/agents/alert_notification_agent.py - Scheduled reports → SQLite database: reads business records
optistock/src/agents/scheduled_reporting_agent.py