Inspiration
CORE: Compliance-Optimized Rerouting Engine — Devpost Project Story
Global supply chains are fragile. A single port closure — triggered by a labor strike, a geopolitical crisis, or a natural disaster — can strand multi-million-dollar cargo mid-ocean. When that happens, a human supply chain manager has to manually cross-reference live vessel positions, cargo manifests, and hundreds of pages of international customs law to find a legally compliant alternative destination.
That process takes days. During those days, the shipping company bleeds money in demurrage fees, spoilage risk climbs, and the entire logistics network downstream grinds to a halt.
We built CORE because we believe that decision should take seconds, not days — and that AI agents are now capable enough to handle the full complexity of that problem: geospatial reasoning, regulatory interpretation, cost optimization, and human-in-the-loop escalation, all wired together.
What it does
CORE is a multi-agent autonomous system that responds to port closure events and reroutes an entire fleet automatically.
When a port closes:
The Trigger Agent (Level 1) receives the disruption event from the UI, scopes the affected fleet, and spawns parallel sub-sessions — one per vessel. The Root Agent (Level 2) takes over each vessel. It reads live vessel data, cargo details, and nearby port options from MongoDB Atlas via the official MongoDB MCP server. It then calls a custom Rules MCP server to calculate route costs and identify the closest alternative ports. The Compliance Sub-Agent — a fully separate Gemini instance wrapped as an AgentTool — reads raw regulatory text for each candidate port and returns a verdict: APPROVED or REJECTED, with an exact legal citation. The Root Agent synthesizes all of this into a legally-approved rerouting manifest, which is written back to MongoDB and surfaced in the Streamlit dashboard for human review. If every alternative port fails compliance, the system escalates with a full record of why each option was rejected.
The operator can then chat directly with the Root Agent inside the UI to ask why a specific decision was made.
How we built it
Agent Framework: Google ADK (google-adk) LLM: Gemini 2.5 Flash via Vertex AI Database: MongoDB Atlas MongoDB MCP: @modelcontextprotocol/server-mongodb (npx stdio) Custom MCP: FastMCP (rules_server.py) on Cloud Run UI: Streamlit on Cloud Run Deployment: Google Cloud Build + Cloud Run
The architecture is deliberately layered. The Root Agent is not given a workflow — it is given values and constraints (via its system prompt), and Gemini's native ReAct loop decides what tools to call, in what order, and when to stop. The Compliance Sub-Agent is a genuine black-box tool from the Root Agent's perspective: it receives a port name and cargo type, and returns a verdict. The Root Agent never sees the sub-agent's internal reasoning.
MongoDB connectivity runs through the official MongoDB MCP server, wired in as an MCPToolset via ADK. Read operations use the MCP find tool; the final manifest is committed with insert-many. The custom Rules MCP (FastMCP) handles deterministic business logic: cost calculation, closest-port lookup, and manifest/escalation record construction.
Everything is deployed to Google Cloud Run via Cloud Build, with two services: the Rules MCP server and the Streamlit dashboard.
Challenges we ran into
Challenges We Ran Into
Multi-agent coordination with ADK was the steepest learning curve. Wiring an AgentTool (the Compliance Sub-Agent) correctly so that the Root Agent could call it as an opaque tool — without the two agents sharing state or context — required careful session management and prompt design.
MCP server chaining presented real debugging challenges. The Root Agent connects to two MCP servers simultaneously (MongoDB and the custom Rules server). Getting both MCPToolset connections stable in the same ADK runner, especially under Cloud Run's cold-start behavior, took significant iteration.
Regulatory text interpretation is genuinely hard. The Compliance Sub-Agent has to read unstructured regulation documents and return a structured APPROVED/REJECTED verdict with a legal citation. Prompt engineering to make that output reliable and parseable — without hallucination — was painstaking.
Parallel fleet dispatch required building a Trigger Agent that could fan out to multiple Root Agent sub-sessions and aggregate results without blocking the UI. Coordinating that with Streamlit's single-threaded rendering model was non-trivial.
Accomplishments that we're proud of
A genuinely agentic system — not a pipeline dressed up as an agent. The Root Agent makes real decisions about tool call order and stopping conditions. End-to-end compliance checking grounded in actual regulatory text, with exact legal citations in every rejection. A working human-in-the-loop interface where operators can interrogate the agent's reasoning in natural language after the fact. Full cloud deployment on Google Cloud Run with a clean CI/CD pipeline via Cloud Build. The demo scenario — a Singapore port closure stranding $16M of temperature-sensitive pharmaceuticals — resolves (or escalates with full justification) in seconds.
What we learned
Google ADK's AgentTool abstraction is powerful but demands careful prompt design at the boundary. The calling agent must be told explicitly what the tool returns and what to do with rejections. MCP as a data access layer for agents is a genuinely better pattern than raw function tools for database reads/writes. The MongoDB MCP server gave the agent a clean, discoverable interface to the database without us writing custom tool wrappers. ReAct loops in production need guardrails. Without a well-scoped system prompt, the agent will over-call tools or get stuck in reasoning loops. Constraints matter as much as capabilities. Streamlit is fast to build with but requires deliberate architecture choices when paired with async agent runners — you have to manage state carefully to avoid race conditions.
What's next for CORE: Compliance-Optimized Rerouting Engine
Live AIS integration — connect to real-time Automatic Identification System vessel tracking data so CORE responds to actual maritime disruptions, not seeded demo scenarios. Expanded regulatory corpus — currently the compliance agent works against a seeded MongoDB regulations collection. The next step is ingesting real customs and trade law documents at scale. Multi-commodity reasoning — CORE handles a single cargo type per vessel. Real fleets carry mixed cargo; the compliance logic needs to handle composite manifests. Cost model integration — plug in live bunker fuel prices, port tariff APIs, and insurance rate feeds so the cost optimization is grounded in real market data. Operator approval workflow — today the human reviews and approves in the UI chat. A proper approval workflow with audit trail, role-based access, and ERP integration would make this production-ready.
Log in or sign up for Devpost to join the conversation.