How manu-sal-07/mandisensi_agents works
MandiSense AI is a Bengaluru–Kolar agricultural decision-support product for farmers and traders. Farmers enter crop, location and selling context, then receive price forecasts and evidence-backed market/holding recommendations; traders use analytical desk tools to inspect supply, relationships and risk. The frontend reaches a FastAPI API, with forecasting, market-choice and specialist analytics behind it. Chat, AI explanations and cognition add evidence and reasoning capabilities. Relationships below are limited to README statements and source-index references; several subsystems are represented by their exact source directories because their implementation was not sampled.
Main entry points: farmer_router.py Farmer routes · main.py FastAPI application · pipeline.py Forecast pipeline · trader_router.py Trader analytics routes
Components 31
User experience
- Farmer web app
frontend/src/app/page.tsx - Trader tools
frontend/src/app/trader-tools/page.tsx - Chat interface
frontend/src/components/chat/ChatDock.tsx
API and orchestration
- FastAPI application
api/main.py - Farmer routes
api/farmer_router.py - Chat routes
api/chat_router.py - Trader analytics routes
api/trader_router.py - Query orchestrator
backend/app/routes/query.py - Model loader
backend/app/services/model_loader.py
Farmer decisions
- Farmer data world
mandisense_ai/farmer/world.py - Market registry
mandisense_ai/farmer/registry.py - Farmer advice
mandisense_ai/farmer/alerts.py - Hold-or-rot advice
mandisense_ai/farmer/storage.py - Market choice
mandisense_ai/market_choice/service.py - Choice engine
mandisense_ai/market_choice/engine.py
Forecasts and trader analytics
- Forecast reader
mandisense_ai/forecasting/service.py - Forecast store
mandisense_ai/forecasting/store.py - Forecast pipeline
mandisense_ai/forecasting/pipeline.py - Forecast configuration
mandisense_ai/forecasting/config.py - Forecast decisions
mandisense_ai/forecasting/decision.py - Forecast ledger
mandisense_ai/forecasting/ledger.py - Quantile bands
mandisense_ai/forecasting/quantile.py - Trader analytics
mandisense_ai/trader - Supply shock analysis
mandisense_ai/shock/service.py - Commodity spillovers
mandisense_ai/spillover/service.py
Evidence and reasoning
- AI Brief and explanations
mandisense_ai/intelligence/service.py - Tool-assisted chat
mandisense_ai/chat/engine.py - Cognition engine
mandisense_ai/cognition/engine.py - Cognition state
mandisense_ai/cognition/state_store.py
Other components
- Farmer
- Trader
Connections 32
- Farmer → Farmer web app: uses
README.md - Trader → Trader tools: uses
README.md - Farmer web app → FastAPI application: requests decisions
- Trader tools → FastAPI application: requests analytics
- Chat interface → Chat routes: sends questions
- FastAPI application → Farmer routes: registers routes
api/main.py - FastAPI application → Chat routes: registers routes
api/main.py - FastAPI application → Trader analytics routes: registers routes
api/main.py - Farmer routes → Farmer data world: uses
api/farmer_router.py - Farmer routes → Market registry: uses
api/farmer_router.py - Farmer routes → Farmer advice: calls
api/farmer_router.py - Farmer routes → Hold-or-rot advice: calls
api/farmer_router.py - Farmer routes → Market choice: calls
api/farmer_router.py - Market choice → Choice engine: uses
mandisense_ai/market_choice/service.py - Market choice → AI Brief and explanations: uses explanations
mandisense_ai/market_choice/service.py - Market choice → Supply shock analysis: uses shock data
mandisense_ai/market_choice/service.py - Farmer data world → Forecast reader: provides reader
mandisense_ai/farmer/world.py - Forecast reader → Forecast store: reads
mandisense_ai/forecasting/service.py - Forecast pipeline → Forecast configuration: uses
mandisense_ai/forecasting/pipeline.py - Forecast pipeline → Forecast store: publishes forecasts
mandisense_ai/forecasting/pipeline.py - Forecast pipeline → Quantile bands: runs backtest
mandisense_ai/forecasting/pipeline.py - Forecast pipeline → Forecast decisions: calibrates policy
mandisense_ai/forecasting/pipeline.py - Forecast pipeline → Forecast ledger: scores claims
mandisense_ai/forecasting/pipeline.py - Trader analytics routes → Trader analytics: serves tools
- Trader analytics routes → Supply shock analysis: serves analysis
- Trader analytics routes → Commodity spillovers: serves analysis
- Chat routes → Tool-assisted chat: calls
- Tool-assisted chat → AI Brief and explanations: uses grounding
- FastAPI application → Cognition engine: exposes cognition
api/main.py - Cognition engine → Cognition state: updates state
mandisense_ai/cognition/engine.py - Query orchestrator → Model loader: loads through
backend/app/routes/query.py - Model loader → Query orchestrator: configures
backend/app/services/model_loader.py