Inspiration

73% of supply-chain disruptions are discovered after the damage is done. When a port closes or a supplier fails, teams find out from the news, then scramble across spreadsheets and phone calls. We wanted to flip that: see every risk, and act on it, before it becomes a crisis.

What it does

REROUTE — Risk Evaluation & Route Optimization Using Twin Emulation — is an AI Digital Twin Control Tower for supply-chain resilience. You model your network (drag-and-drop or CSV/Excel import) and see it as a graph and on a live world map. Autonomous Google ADK + Gemini agents scan global news, weather, and geopolitical events and pin each disruption to the exact node it threatens. Every alert is grounded — it shows a confidence score, its sources, and a "needs-review" flag. Then you act from one screen: reroute, generate an AI mitigation plan, and resolve — with a full audit trail.

How we built it

  • Frontend: Next.js 16 (App Router) + React 19, a token-driven design system (light/dark, responsive, accessible), a React Flow canvas, Leaflet map, and Recharts.
  • Intelligence: 13 specialized agents via Google ADK on Gemini 2.5 Flash, each wrapped in tracing + audit logging, with multi-key quota routing and rate-limit fallbacks.
  • Data & scale: Supabase (Postgres + Row-Level Security) for multi-tenant isolation, Upstash Redis for dedup/cooldowns, Mem0 for memory; deployed stateless on Google Cloud Run with a server-driven cron scan sweep.

Our guiding principle — the AI explains, the math decides — is literal. Rerouting is a real weighted shortest-path, not an LLM guess. For a disrupted node f, we remove it from the graph (G=(V,E)) and, for each broken segment (predecessor p → f → successor s), compute the minimum-cost bypass:

$$ P^{\star} = \arg\min_{P:\; p \rightsquigarrow s,\; f \notin P} \; \sum_{(u,v)\in P} c_{uv} $$

using Dijkstra's algorithm in (O(V^2)), then report the exact trade-off versus the original route:

$$ \Delta_{cost} = \left( \sum_{(u,v)\in P^{\star}} c_{uv} \right) - \left( c_{p,f} + c_{f,s} \right) $$

If no bypass exists, we say so honestly instead of inventing one.

Grounding works the same way. Each source has a credibility (c_i \in [0,1]); when the agent doesn't report its own confidence, we take the mean over its (n) sources:

$$ \bar{c} = \frac{1}{n} \sum_{i=1}^{n} c_i $$

An alert is flagged for human review when (\bar{c} < 0.6), or when there are no sources at all.

Challenges we ran into

  • Trust in AI output. LLMs sound confident even when wrong. We split the system so the model only writes narrative while routing and impact are deterministic — then surfaced the confidence score and its sources so users know what to rely on.
  • Correct rerouting. Replacing "ask the model for a path" with a real shortest-path meant handling directed graphs, missing cost data, and honest "no bypass available" cases — all unit-tested.
  • Making it feel real. True-to-twin maps (no mock data), an honest empty state, and a complete detect → decide → act loop instead of a pretty dashboard.

What we learned

The highest-leverage AI decision was restraint: let deterministic algorithms own the math ((O(V^2)), sub-millisecond, provable) and use the LLM for explanation and orchestration. It made the product both more trustworthy and faster and it's the reason we can back every number in the UI with a test.

What's next

Live ERP/TMS/carrier connectors, a durable job queue at higher scale, and human-in-the-loop approvals for automated reroutes.

Built With

Share this project:

Updates

Submission history