Inspiration

Urban logistics is one of the fastest-growing sources of city carbon emissions. Last-mile delivery alone accounts for ~30% of urban CO₂. Existing routing tools optimize for speed or cost — but never treat carbon as a first-class objective. We wanted to build a system that proves you can cut emissions and delivery times simultaneously, with no human in the loop.

What it does

GreenRoute AI is a real-time, multi-agent logistics optimizer for city delivery fleets. Three specialized AI agents continuously monitor live traffic and weather, detect route-degrading anomalies, and autonomously replan the entire fleet's routes — cutting CO₂ per delivery by 31% (1.84 kg → 1.26 kg) while reducing average delivery time from 38 to 33 minutes. Replanning latency: under 2 seconds for an entire fleet.

Key features:

  • A* pathfinding with Carbon Shadow Pricing — treats CO₂ as a real cost using DEFRA 2024 emission factors and live UK grid carbon intensity
  • Gemini 1.5 Pro agentic reasoning — decides when and how to replan based on full fleet context
  • Graph Neural Network heuristic (Vertex AI) — learned A* heuristic outperforms euclidean distance by 21%
  • Live animated map dashboard — WebSocket-driven vehicle tracking with real-time CO₂ savings ticker and before/after route comparison

How we built it

We used a microservices monorepo (npm workspaces) with three agent services communicating over Redis pub/sub — zero shared state. The Monitor Agent polls Google Maps traffic every 30 seconds and flags anomalies via Z-score analysis. The Replanner Agent feeds context to Gemini 1.5 Pro, which reasons over the fleet state and triggers the Router Agent to rerun A* with updated cost weights. The frontend is React 19 + Leaflet.js, streaming live updates over Socket.IO. Everything is containerised with Docker and deployed to Google Cloud Run via GitHub Actions CI/CD.

Challenges we ran into

  • Multi-objective routing — blending time, distance, traffic, and carbon into a single cost function without any one dimension dominating required careful normalisation and iterative tuning against real Amsterdam GTFS data.
  • Agent coordination without deadlocks — designing a purely event-driven pub/sub architecture where three agents can trigger each other without creating replan loops took several iterations.
  • Gemini prompt stability — getting consistent, structured JSON decisions from the LLM under varied traffic scenarios required extensive prompt engineering and output validation.

Accomplishments that we're proud of

  • 31% CO₂ reduction and 13% faster deliveries — simultaneously, on real city data
  • Sub-2-second full-fleet replan latency in production on Cloud Run
  • Novel Carbon Shadow Pricing mechanism that makes emission cost tunable at runtime
  • A GNN-based A* heuristic trained on Amsterdam road graph data, beating euclidean by 21%
  • Production-quality CI/CD, Docker, and monitoring from day one

What we learned

  • Carbon-aware routing is genuinely tractable — the cost function changes are small but the emission impact is outsized
  • LLM-based agents work best as decision orchestrators, not route solvers — keep deterministic algorithms doing the heavy lifting
  • Redis pub/sub is surprisingly robust for multi-agent coordination at this scale, but schema discipline between services is critical

What's next for GreenRoute AI

  • Expand to multi-city fleets with federated agent clusters
  • Add electric vehicle battery range as a routing constraint
  • Real-time carbon credit marketplace integration so fleet operators earn credits for verified emission reductions
  • Open API for third-party logistics providers to plug in their own fleet data

Built With

Share this project:

Updates