Warden is an AI-powered supply chain risk management platform. It monitors disruptions, calculates risk, suggests mitigations, and drafts actions for the user company. Monorepo with frontend/ (Next.js) and backend/ (FastAPI).
npm run dev # Dev server on http://localhost:3000 (Turbopack)
npm run build # Production build
npm run lint # ESLint (eslint v9, flat config)pip install -r requirements.txt
python main.py # Uvicorn dev server on http://localhost:8000 (auto-reload)Requires .env with GOOGLE_API_KEY for ADK/Gemini. Falls back to demo mode if agent fails.
- Orchestrator (
agents/orchestrator.py): Root agent using Gemini 2.5 Flash, routes to 4 sub-agents by intent:perception_agent— news/disruptions/signalsrisk_engine_agent— risk scores/revenue impact/inventoryplanning_agent— strategy/simulation/mitigationaction_agent— drafting emails/POs/escalations
- Routes:
agent.py(SSE chat + demo fallback),dashboard.py,actions.py,company.py,upload.py - Tools (
tools/): ADK tools for news, email, ERP, simulation, supplier lookup, MCP integration - State: In-memory, no database (Supabase client exists in requirements but not primary)
- App Router with
"use client"directives on interactive components - Path alias:
@/maps tofrontend/src/ - State: Zustand store (
lib/store.ts) — singleuseWardenStorewith company, dashboard, actions, chat, disruptions - API client (
lib/api.ts): REST + SSE streaming for chat. SSE events:thinking,token/response,action_generated,done - Styling: Tailwind CSS 4 with CSS custom properties (
--w-ob-*theme tokens,--w-blueaccent)
- 3D Visualizations: Pure Three.js via
useRef/useEffect(not R3F declarative). Factory functions in.tsfiles, thin React wrappers for lifecycle.SupplyGlobe— globe with supply chain routesStockRoom— 3D warehouse using CSS2DRenderer for HTML overlays on WebGL
- ReactFlow graph (
components/visualization/): Custom nodes (Supplier, Part, Order, Customer, Event) with expanded overlay views - Navigation:
NavigationBarwithViewTabtype controls tab switching ("graph" | "globe" | "stockroom")
Frontend streamChat() → POST /agent/chat → Backend streams SSE events → Frontend parses data: lines, dispatches to onToken/onEvent callbacks, updates Zustand store via updateLastAssistantMessage.
CORS_ORIGINS— Comma-separated allowed origins (default:http://localhost:3000)BACKEND_HOST/BACKEND_PORT— Backend bind address (default:0.0.0.0:8000)GOOGLE_API_KEY— Required for ADK/Gemini agents