Building Needflare: An Autonomous Disaster Intelligence & Logistics Agent with Gemini 3.7, Gemma 4 & Google Veo
DEV Community

Building Needflare: An Autonomous Disaster Intelligence & Logistics Agent with Gemini 3.7, Gemma 4 & Google Veo

This article was created for the purposes of entering the Google Cloud: All Things Agentic Hackathon. In catastrophic natural disasters like flash floods, hurricanes, and earthquakes, cellular networks collapse and emergency dispatchers are overwhelmed with thousands of fragmented, panic-driven field messages. Volunteers trying to coordinate over open radio frequencies or mesh airwaves risk leaking sensitive Personally Identifiable Information (PII) such as phone numbers, names, and vulnerable home addresses. To solve both bottlenecks, I built Needflare - an autonomous, privacy-first emergency intelligence and logistics agent running on Google Cloud. Here is how the system was built, how it operates asynchronously in the background, and how it unifies three cutting-edge Google AI models: Gemini 3.7 Flash, Google Gemma 4, and Google Veo 3.1. ๐Ÿ“บ Live Demo & Video Walkthrough Watch the complete 3-minute technical demonstration in action: - GitHub Repository: vero-code/needflare - Project on Devpost: software/needflare ๐Ÿ—๏ธ Architecture Overview Needflare operates across three decoupled, failure-tolerant tiers: - Edge Tier (Volunteer Terminal): Local-First client application that scrubs PII on-device before queuing packets in an offline store-and-forward buffer. - Asynchronous Ingestion Tier (Google Cloud Pub/Sub): High-throughput queue that burst-syncs buffered reports upon network recovery. - Autonomous Taskmaster Tier (Google Cloud Run + GenKit + Gemini 3.7 Flash): Asynchronous background agent that evaluates crisis severity, computes Sphere-compliant humanitarian aid payloads, and auto-dispatches logistics convoys without human dispatch delays. - Universal Visual Guidance Tier (Google Veo 3.1 Fast): Automated synthesis of non-verbal, zero-text survival video broadcasts for disaster victims facing extreme shock or language barriers. 1. Edge Intelligence: Google Gemma 4 PII Scrubbing In disaster situations, zero data leakage is mandatory. When volunteers draft field reports, Needflare executes real-time data cleansing directly on the device: - Online Mode: Calls Google's hosted gemma-4-26b-a4b-it endpoint for high-precision category classification (water ,medical ,shelter ,rescue ,food ,power ) and urgency scoring. - Offline Mode: If cellular or satellite signal is completely lost, Needflare seamlessly falls back to on-device regex heuristics that redact names, phone numbers, and street addresses into safe sector codes ( [SECTOR_ALPHA_SNAP] ), storing reports in an encrypted local buffer. 2. Asynchronous Event Pipeline: Google Cloud Pub/Sub & Cloud Run When intermittent connectivity (LoRa mesh, satellite, or restored 4G) reconnects, the volunteer triggers a burst sync: - Reports are published directly to a dedicated Google Cloud Pub/Sub topic ( needflare-reports ). - The backend agent is containerized and hosted on Google Cloud Run, configured to scale down to zero when idle to conserve compute costs, while scaling out instantly during disaster traffic spikes. - Persistent state is maintained in Google Cloud Firestore Native database ( needflare-db ) across three synchronized collections:reports ,tasks , andveo_guides . 3. Autonomous Taskmaster: Gemini 3.7 Flash via Google GenKit Traditional emergency dispatchers spend crucial hours calculating supply quotas. Needflare eliminates this bottleneck using Gemini 3.7 Flash orchestrated through Google GenKit v1.41: Instead of an open-ended conversational chat loop, the agent executes an event-driven reasoning flow (needflareTriageFlow ) with strict tool execution: - triageSectorTool : Dynamically elevates or de-escalates sector threat levels. - createLogisticsTaskTool : Auto-dispatches supply convoy tasks to Firestore, calculating required payloads based on humanitarian Sphere standards (e.g. 15L of potable water per person per day). - triggerVeoVisualGuideTool : Triggers visual survival video synthesis when acute survival challenges are detected. 4. Universal Visual Guidance: Google Veo 3.1 Fast Under extreme trauma or panic, victims often cannot parse dense text instructions. Needflare integrates Google Veo 3.1 Fast (veo-3.1-fast-generate-preview ) to generate zero-text, high-contrast 8-second instructional video broadcasts (such as floodwater purification using charcoal and fabric, or emergency thermal shelter construction). The server polls the long-running generation operation, downloads the verified MP4, and registers the protocol in Firestore for immediate playback across tactical coordinator dashboards. ๐Ÿ’ก Conclusion Building Needflare demonstrated the immense power of pairing Google's agentic ecosystem - GenKit, Gemini 3.7 Flash, Gemma 4, and Google Veo - with serverless Google Cloud infrastructure. In emergency response, every second saved saves lives. Top comments (1) Hello Glad to see you, I am Kane Lim from Hong Kong. I have over 10 years of development experience. I am writing this because your post was interesting. Needflare is a compelling architecture because the real innovation is not simply combining Gemini, Gemma, and Veo, but designing graceful degradation around unreliable infrastructure. The local first ingestion model is particularly important for disaster environments. I would push the architecture further with deterministic policy enforcement between model inference and autonomous actions. Gemini should produce structured decisions, but a policy engine should validate severity thresholds, resource constraints, Sphere calculations, authorization boundaries, and duplicate dispatches before any irreversible operation. For resilience, I would also introduce idempotent event processing, Pub Sub dead letter queues, replayable event logs, regional failover, encrypted local storage with key rotation, and explicit model confidence thresholds. If confidence falls below the threshold, the system should downgrade to rule based triage rather than hallucinate logistics decisions. The multimodal pipeline is impressive. With proper observability around inference latency, queue depth, model confidence, dispatch success, and recovery time, this could become a genuinely robust disaster response platform. Excellent engineering direction.

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.