Inspiration
Floods in Bengaluru and other Indian cities turn into a slow chain of phone calls: someone has to work out what people need, find who can supply it, and arrange payment. I had already built an AI-based Urban Early Warning System, and I wanted to see what happens when an AI agent takes the next step: from "a flood is happening" to "here is a priced relief order, ready to pay".
What it does
RELIEF-X AI is an emergency relief command center with a human-approved AI agent.
- Detect: incidents from an early-warning feed appear on a live map with severity ratings.
- Understand: the AI (Google Gemini) reads the incident and a live rainfall forecast (Open-Meteo) and returns structured JSON: severity, affected households and the quantity of each relief item (water, food kits, first-aid, blankets), with its reasoning.
- Procure: a matching engine ranks suppliers on price, distance, rating and stock coverage. The AI explains its choice in plain language.
- Approve: the agent only proposes the order. A human reviews it and clicks Approve. A per-order spending cap is enforced in code.
- Pay: PayPal Sandbox (Orders v2 API) creates an order for exactly the proposed amount, the approver pays at PayPal, and the app captures the payment.
- Track: the dashboard shows each order, its PayPal capture ID and an audit trail of every step.
How I built it
Node.js and Express backend, a vanilla JS dashboard with a Leaflet map, Gemini for needs estimation and explanations, deterministic code for supplier ranking and spending checks, and PayPal Orders v2 for create and capture. Model output is validated (known item types only, capped quantities), and if the AI call fails the app falls back to a clearly labelled rule-based estimate. The model decides what is needed; code decides who supplies it and checks the money.
Challenges
- Keeping an agent that moves money safe: proposal-only, human approval, spending cap and an audit trail.
- Getting reliable structured output from the model and handling bad responses.
- Making PayPal central to the workflow, so the order the agent builds is the order PayPal charges, not a separate checkout button.
- Finishing a working end-to-end flow in a short time.
What I learned
Agents become much more credible with human approval and hard limits around money. Splitting the work between the model (judgement) and plain code (rules) made it easier to test.
Honest scope notes
Incidents are sample data standing in for an early-warning feed. The suppliers are fictional with seeded prices and stock. Delivery progress is simulated. All payments run in PayPal Sandbox; no real money moves.
What's next
Connect the real early-warning feed, onboard real suppliers with their own PayPal accounts, add PayPal Payouts for supplier settlement, and add multi-approver rules for large orders.
AI tools used
- Google Gemini API: relief-needs estimation and supplier-choice explanation (runtime).
- AI-assisted development: [Claude] was used to help write and debug the code.
Built With
- express.js
- google-gemini
- html5
- javascript
- leaflet.js
- node.js
- open-meteo
- openstreetmap
- paypal
- paypal-orders-api
- render