🛡️ Inspiration

Global maritime supply chains carry over 80% of the world's commerce, yet they are incredibly fragile. When a crisis strikes—such as the Suez Canal blockade, severe draft limits at the Panama Canal, typhoons, or labor strikes—the logistics response is manual, fragmented, and slow. Operators spend days on phone calls, emails, and spreadsheet negotiations trying to reroute cargo and hedge margins while millions of dollars are lost in demurrage and delays.

SovereignCommand (SovereignLogistics) transitions shipping logistics from reactive panic to autonomous, optimized orchestration.


🏗️ What it Does

SovereignCommand is an autonomous shipping and commerce command center powered by a Vertex AI multi-agent swarm and a secure MongoDB Atlas ledger:

  • The Swarm Debate: When a crisis occurs, a collaborative four-agent swarm (Port Controller, Shipping Coordinator, Vessel Captain, and Commodity Trader) debates operational overrides in real time.
  • Auto-Consensus Execution: Gemini resolves the debate and extracts structured JSON execution commands (reroute and trade). The backend automatically alters vessel headings, recalculates water-safe routes, and executes port cargo trades.
  • Model Context Protocol (MCP): A fully compliant stdio JSON-RPC MCP server is exposed, allowing external AI clients (like Claude Desktop) to directly inspect, control, and execute trades on the MongoDB Atlas database.
  • Quantified ROI Dashboard: Real-time business metrics show the quantified financial value saved, including transit hours gained, demurrage losses averted, and commodity hedging yields.

🛠️ How We Built It

We built a modern, responsive Node.js and WebSocket architecture:

  • Generative AI Swarm: Powered by Google Cloud Vertex AI (Gemini 2.5 Flash) REST gateways using local credentials authentication.
  • Database Ledger: Built on MongoDB Atlas for persistent simulator states, transaction ledgers, and conversation logs.
  • Atlas Vector Search (RAG): When a new crisis is injected, the swarm runs an Atlas $vectorSearch query over historical debate trails to retrieve context and base decisions on past resolutions.
  • Dynamic Cartography: Interactive map UI rendering dynamic route calculations and real-time vessel vectors using Leaflet.js.
  • Acoustic feedback: Real-time speech synthesis for agent voice narration and custom chimes via the Web Audio API.

🚧 Challenges We Faced

  • Atlas Free-Tier Limits: Standard MongoDB connection pools default to 100 connections. To prevent EADDRINUSE or connection pool crashes on the Atlas Free Tier (M0 Sandbox) during Cloud Run scaling, we capped connection pools strictly to maxPoolSize: 5.
  • International Date Line Wrap-Around: Cartesian distance math breaks down near the 180° meridian (e.g. comparing 179° to -179°), causing ships to sail backwards. We solved this by wrapping longitude differences across the Date Line.
  • Cross-Site WebSocket Hijacking (CSWSH): Restricting WebSocket connections to authorized origins (localhost and *.run.app domains) to prevent hijacking.
  • Visual Rubber-Banding: Synchronizing the local simulation loop updates with optimistic database write limits to prevent vessel coordinates from visually flickering on lock failures.

💡 What We Learned

We learned how to design highly robust, self-healing agent systems. We established a Hot-Standby Cache in-memory fallback so the application survives Atlas database disconnections, and built a custom local semantic keyword parser to protect API credit quotas.


🚀 What's Next for SovereignCommand

We plan to scale the platform by integrating real-time IoT cargo sensors (temperature, seal integrity) and deploying secondary swarms to automate inland warehouse allocations and local trucking dispatch networks.

Built With

Share this project:

Updates