Unsprawl: The Fully-Autonomous Urbanist Platform 🌍

Gemini 3 NVIDIA Warp Architecture License

🩸 Core Premise: The Mathematics of Survival

“Gridlock is not just an inconvenience. It is a biological decay function.”

In emergency medicine, the “Golden Hour” is a myth. For cardiac arrest, we only have minutes. According to peer-reviewed longitudinal studies, the probability of survival for a sudden cardiac arrest victim drops by 7-10% for every single minute of delay in defibrillation.

  • Minute 0: 90% chance of survival.

  • Minute 5: 50% chance of survival.

  • Minute 10: <5% chance of survival.

Traffic congestion in major urban centers adds an average of 10 minutes to emergency response times—effectively guaranteeing mortality for critical patients before an ambulance even arrives.

Unsprawl exists to buy back those minutes. By using differentiable physics to part traffic like the Red Sea, we don’t just improve ETA; we mathematically increase the probability of human survival.

Citations:

  1. Holmberg, M., et al. (2015). “Survival in Out-of-Hospital Cardiac Arrest.” New England Journal of Medicine. (Establishment of the 10% decay rule).

  2. Wilde, E.T. (2013). “Do Emergency Medical System Response Times Matter for Health Outcomes?” Health Economics. (Quantifying the 1-minute marginal value).

  3. Menard, T. (2025). “The Growing Challenge of Traffic Congestion on Emergency Response.” Smart Cities Dive. (Traffic adding ~10m delays).

Unsprawl is an Autonomous Neuro-Symbolic Urbanist Optimizer. It combines the probabilistic reasoning of Gemini 3 with the deterministic, differentiable physics of NVIDIA Warp to create a closed-loop system that can ingest messy data, detect inefficiencies, and autonomously engineer solutions.


♊ Powered by Gemini 3: Technical Execution

Unsprawl leverages the advanced capabilities of the google-genai SDK to function as a fully autonomous agent, not just a chatbot.

Module

Gemini SDK Feature

Implementation Details

Refinery

Code Execution (tools.code_execution)

Autonomous ETL. It doesn’t “guess” schemas; it inspects raw CSV/JSON headers, reasons about mapping, and executes generated Python adapters in a sandbox to guarantee type safety before ingestion.

Sentinel

Async Live API (client.aio.live)

Uses the Bi-directional WebSocket protocol to maintain a real-time, stateful “Voice & Vision” session. Sentinel interrupts the user when simulation telemetry spikes, pushing insights proactively.

Solver

Context Caching (client.caches)

Ingests massive regulatory documents (e.g., Singapore Master Plan 2025) into the context cache. This allows the Solver to check infrastructure proposals against thousands of pages of zoning laws with zero latency.

Core

Thinking Models (thinking_level="HIGH")

Used for multi-step diagnostic reasoning. Before changing a traffic light, Sentinel “thinks silently” to weigh the economic trade-offs of the intervention.


⚡ Innovation: Differentiable Urban Physics

Most city simulators (SUMO, Unity) are “Forward Simulators”—you guess parameters and see what happens.

Unsprawl is a Differentiable Simulator. Because we write our physics kernels in NVIDIA Warp, we can run the simulation backward.

  1. Define Loss: Loss = Total_Commute_Time + Carbon_Emissions

  2. Differentiate: We calculate the gradient of the Loss with respect to city parameters (Traffic Light Timing, Road Width, Bus Frequency).

  3. Optimize: Unsprawl uses Gradient Descent to mathematically find the optimal configuration for the city.

We don’t guess the solution. We solve for it.


🏗️ System Architecture

The system follows a “Trinity” architecture, separating Data, Operations, and Policy.

        flowchart TD
    subgraph "Unsprawl"
        R[RefineryAgent] -->|Thinking + Code Exec| CSV[(CSV Data)]
        S[SentinelAgent] -->|Live WebSocket| GEMINI[Gemini API]
        SO[SolverAgent] -->|Context Cache| PDF[(Master Plan)]

        subgraph "NVIDIA Warp"
            DT[DifferentiableTraffic]
            DT -->|wp.Tape| GRAD[Gradients]
            GRAD -->|Update| TIMERS[Signal Timers]
        end

        S -->|Tool Call| DT
    end
    
        %%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#BB2528', 'edgeLabelBackground':'#1f1f1f', 'tertiaryColor': '#fff'}}}%%
graph LR
    %% --- STYLING DEFINITIONS ---
    classDef agent fill:#2a0a45,stroke:#8e44ad,stroke-width:2px,color:#fff,stroke-dasharray: 5 5;
    classDef engine fill:#0a3d15,stroke:#76b900,stroke-width:3px,color:#fff;
    classDef intelligence fill:#1c2833,stroke:#3498db,stroke-width:2px,color:#fff;
    classDef frontend fill:#421205,stroke:#e74c3c,stroke-width:2px,color:#fff;
    classDef data fill:#333,stroke:#666,stroke-width:1px,color:#aaa,stroke-dasharray: 2 2;

    %% --- SUBGRAPH: EXTERNAL INTELLIGENCE ---
    subgraph Cloud [Google Cloud Platform]
        Gemini[🧠 Gemini Pro Vision <br/> Multimodal Reasoning Core]:::intelligence
    end

    %% --- SUBGRAPH: DATA SOURCES ---
    subgraph Data Layer [External Data Sources]
        OSM[(OpenStreetMap <br/> Public Geo Data)]:::data
        DarkData[(Mock Gov Portal <br/> "Dark" HTML Data)]:::data
    end

    %% --- SUBGRAPH: THE UNSPRAWL BACKEND ---
    subgraph Backend [Unsprawl Core - Python/FastAPI]

        %% THE TRINITY AGENTS
        subgraph The Trinity [Neuro-Symbolic Agents]
            Refinery[🏗️ Refinery <br/> The Builder / ETL Daemon]:::agent
            Sentinel[🛡️ Sentinel <br/> The Guardian / OODA Daemon]:::agent
            Solver[⚖️ Solver <br/> The Judge / Compliance Daemon]:::agent
        end

        %% MCP TOOLING
        MCP[MCP Server <br/> Tools: Puppeteer, Code Interpreter]:::intelligence

        %% THE SIMULATOR ENGINE
        subgraph Advect Simulator [⚡ Advect Engine]
            Warp[NVIDIA Warp Kernel <br/> Differentiable Physics & Fluid Dynamics]:::engine
        end
    end

    %% --- SUBGRAPH: FRONTEND ---
    subgraph UI [React Frontend - "The Glass Brain"]
        DeckGL[🖥️ Deck.gl Canvas <br/> 3D Visualization Layer]:::frontend
        HUD[📟 HUD Overlay <br/> Thought Logs & Metrics]:::frontend
    end

    %% ================= CONNECTIONS =================

    %% --- 1. REFINERY (Genesis Phase) ---
    Refinery -- "1. Instructs extraction" --> Gemini
    Gemini -- "2. Generates Scraper Code" --> MCP
    MCP -- "3. Scrapes (Puppeteer/OSMnx)" --> OSM & DarkData
    MCP -- "4. Returns Raw Data" --> Refinery
    Refinery -- "5. Builds/Updates Static Mesh Graph" --> Warp

    %% --- 2. THE RUNTIME LOOP (Sentinel & Solver) ---
    Warp == "6. Streams Real-time State (T) <br/> (Positions, Velocities)" ==> Sentinel

    Sentinel -- "7. Detects Anomaly <br/> (e.g., Ambulance Stuck)" --> Gemini
    Gemini -- "8. Formulates Optimization Strategy" --> Sentinel

    Sentinel -- "9. Proposes Fix (e.g., Green Wave)" --> Solver
    Solver -- "10. Validates against Laws/Ethics" --> Gemini
    Gemini -- "11. Returns Compliance Verdict" --> Solver

    Solver -- "12. APPROVED Signal" --> Sentinel

    Sentinel == "13. Applies Inverse Parameters (T-1) <br/> (Differentiable Gradient Update)" ==> Warp

    %% --- 3. VISUALIZATION FLOW ---
    Warp -- "FastAPI WebSocket <br/> (Raw Binary Stream / Float32Array)" --> DeckGL
    Sentinel & Solver -- "WebSocket <br/> (Thought Logs JSON)" --> HUD

    %% --- INTER-AGENT ---
    Refinery -.->|"Notify Mesh Update"| Sentinel
    

🧠 The Core Modules

1. Refinery (The Builder)

  • Problem: “The Cold Start.” It takes months to clean data for a new city simulation. There is also the issue of “dark data”, whereby datasets are not always readily available in an ingestible format.

  • Solution: A Schema-Driven Autonomous Agent. The agent ingests raw CSV/JSON data, infers the schema, uses agentic workflows to perform ETL and data cleaning, and writes the cleaning code in a sandbox. It then verifies the code against our Pydantic models and hands over the data to the simulator.

2. Sentinel (The Analyst)

  • Problem: “Information Overload.” Dashboards have too many charts; humans can’t react fast enough.

  • Solution: A Multimodal OODA Loop. Sentinel monitors the simulation and responds to stimuli. When, for instance, density hits a critical threshold, it triggers a “Tool Call” to the Solver, fixes the traffic, and verbally reports the action to the user via the Live API.

3. Solver (The Differentiable Optimizer and Policy Engine)

  • Problem: “Regulatory Hallucination.” AI suggests buildings that are illegal to build.

  • Solution: Grounded RAG. Solver caches the city’s Zoning Laws. When you ask to build a station, it cross-references the cached PDF logic with the physics engine’s cost model to propose valid, optimal infrastructure.


📂 Project Structure (TBC)

unsprawl/
├── web/            # React + Deck.gl Visualization
├── advect/          # NVIDIA Warp Differentiable Kernels
│   ├── engine.py        # Forward Simulation
│   └── optimizer.py     # Backward Pass (Gradient Descent)
├── unsprawl/            # Gemini Agents
│   ├── sentinel.py      # AsyncLive WebSocket Handler
│   ├── refinery.py      # CodeExecution ETL Logic
│   └── solver.py        # ContextCaching Policy Engine
└── docs/                # Architectural Decision Records

🔮 Future Roadmap

  • Global Expansion: Scaling Pandana routing to continental scale (OpenStreetMap Planet file).

  • Climate Digital Twin: Integrating differentiable fluid dynamics (CFD) to optimize city layouts for wind flow and cooling, thus potentially solving climate change.

  • Participatory Planning: Mobile interface for citizens to vote on Solver proposals.


Built for the Gemini 3 Hackathon.