Vikram30069/RescueNet-AI
GitHub: Vikram30069/RescueNet-AI
基于多智能体编排的实时灾难响应系统,将原始事故报告自动转化为包含幸存者优先级排序和资源调度的完整救援方案。
Stars: 0 | Forks: 0
# 🚨 RescueNet AI
### _When Every Second Counts, AI Coordinates_
**A 10-Agent AI Orchestrator for Real-Time Disaster Response, Survivor Prioritization & Automated Rescue Dispatch**
[](.)
[](.)
[](.)
[](.)
[](.)
[](.)
[](.)
[](.)
## 📋 Table of Contents
- [🌋 The Problem](#-the-problem)
- [⚡ The Solution](#-the-solution)
- [🏗️ System Architecture](#️-system-architecture)
- [🤖 The 10-Agent AI Pipeline](#-the-10-agent-ai-pipeline)
- [☁️ AWS Infrastructure](#️-aws-infrastructure)
- [📱 Twilio Automation Layer](#-twilio-automation-layer)
- [🗺️ Real Research Datasets — Telangana](#️-real-research-datasets--telangana)
- [🛠️ Tech Stack](#️-tech-stack)
- [🚀 Quick Start](#-quick-start)
- [📂 Repository Structure](#-repository-structure)
- [🔌 API Reference](#-api-reference)
- [⚙️ Configuration](#️-configuration)
- [📚 Key Documents](#-key-documents)
- [🗺️ Roadmap](#️-roadmap)
## 🌋 The Problem
When disasters strike — **floods, earthquakes, fires, industrial accidents** — emergency responders face an overwhelming information crisis:
| Pain Point | Impact |
|---|---|
| 🔴 **Siloed Communication** | Fire, medical, and police systems operate on separate channels → delayed coordination |
| 🔴 **Cognitive Overload** | Human commanders process thousands of fragmented reports → critical decision delays |
| 🔴 **Capacity Blindness** | Teams dispatched without real hospital bed data → transport bottlenecks |
| 🔴 **No Survivor Scoring** | No quantitative model to rank who needs help first → rescue by guesswork |
| 🔴 **Manual Alert Drafting** | Operators hand-write SMS and call scripts under extreme stress → errors, delays |
## ⚡ The Solution
RescueNet AI is a **fully automated multi-agent orchestration system** that transforms a raw incident report into a complete, dispatched rescue plan — entirely through AI collaboration.
📡 INCIDENT REPORTED
↓ (seconds)
🧠 10 AI AGENTS COLLABORATE IN SEQUENCE
↓
📊 SURVIVOR RISK SCORES GENERATED
↓
🚒 HOSPITALS & RESOURCES MATCHED FROM REAL DATASETS
↓
📋 STRUCTURED RESCUE PLAN JSON PRODUCED
↓
📱 AUTOMATED ALERTS DISPATCHED (SMS · WhatsApp · Voice · Dashboard)
**End-to-End Time**: `< 1 second (mock)` | `10–45 seconds (live LLM)`
## 🏗️ System Architecture
┌──────────────────────────────────────────────────────────────────────────────────┐
│ RESCUENET AI — FULL SYSTEM ARCHITECTURE │
└──────────────────────────────────────────────────────────────────────────────────┘
👤 FIELD TEAMS / COMMANDERS / DISPATCHERS
│ Browser / Mobile / API
▼
┌────────────────────────────────────────────────────────────────────────────┐
│ AWS AMPLIFY (CDN) │
│ Next.js 14 Frontend — App Router / TypeScript │
│ Dashboard · Incident Form · Live Map · Rescue Plan Viewer │
└──────────────────────────────────────┬─────────────────────────────────────┘
│ REST API (HTTPS)
▼
┌────────────────────────────────────────────────────────────────────────────┐
│ AMAZON EC2 + DOCKER + ECR │
│ FastAPI Backend — Python 3.11 — Pydantic v2 │
│ │
│ ┌───────────────┐ ┌──────────────────┐ ┌────────────────────────┐ │
│ │ REST Routers │ │ Service Layer │ │ DB Repository Layer │ │
│ │ /incidents │ │ (Orchestration │ │ PostgreSQL / Neon │ │
│ │ /agents │ │ & Business │ │ · incidents │ │
│ │ /hospitals │ │ Logic) │ │ · rescue_requests │ │
│ │ /resources │ │ │ │ · agent_decisions │ │
│ │ /rescue-plan │ │ │ │ · alert_logs │ │
│ └───────────────┘ └──────────────────┘ └────────────────────────┘ │
└──────────────────────────────────────┬─────────────────────────────────────┘
│ Python function call
▼
┌────────────────────────────────────────────────────────────────────────────┐
│ CREWAI MULTI-AGENT ORCHESTRATION ENGINE │
│ │
│ Agent 1 ──▶ Agent 2 ──▶ Agent 3 ──▶ Agent 4 ──▶ Agent 5 │
│ Disaster Incident Survivor Medical Priority │
│ Intelligence Understanding Probability Triage Ranking │
│ │ │
│ ┌────────────────┬──────────────┘ │
│ ▼ ▼ │
│ Agent 6 Agent 7 │
│ Resource Hospital │
│ Allocation Coordination │
│ │ │ │
│ └────────┬───────┘ │
│ ▼ │
│ Agent 8 │
│ Risk Prediction │
│ │ │
│ ▼ │
│ Agent 9 │
│ Communication │
│ │ │
│ ▼ │
│ Agent 10 │
│ Command Orchestrator │
│ │ │
│ ┌───────▼───────┐ │
│ │ RESCUE PLAN │ │
│ │ JSON OUTPUT │ │
│ └───────────────┘ │
│ │
│ LLM Provider (env-configurable): │
│ ● AWS Bedrock (Claude 3 Sonnet) ● OpenAI GPT-4o │
│ ● Google Gemini Pro ● Ollama (local) ● Mock (offline) │
└──────────────────────────────────────┬─────────────────────────────────────┘
│
┌─────────────────────────┼──────────────────────────┐
▼ ▼ ▼
┌────────────────────┐ ┌────────────────────────┐ ┌───────────────────────┐
│ TWILIO LAYER │ │ AWS SERVICES │ │ REAL DATASETS (DB) │
│ │ │ │ │ │
│ · SMS to field │ │ · S3 (plan storage) │ │ 547 Hospitals │
│ teams via REST │ │ · SNS (fan-out alerts) │ │ 63 Blood Banks │
│ · WhatsApp alerts │ │ · Bedrock (LLM API) │ │ 78 Fire Stations │
│ · Voice calls to │ │ · Secrets Manager │ │ 108 Ambulance Hubs │
│ hospital admin │ │ · ECR (Docker registry)│ │ 33 NDRF Units │
│ · TwiML voice │ │ · CloudWatch (logs) │ │ 47 Police Stations │
│ scripts │ │ · IAM (auth) │ │ 29 Disaster Offices │
└────────────────────┘ └────────────────────────┘ └───────────────────────┘
## 🤖 The 10-Agent AI Pipeline
┌──────────────────────────────────────────────────────────────────────────────────┐
│ RESCUENET AI — 10-AGENT PIPELINE DETAIL │
└──────────────────────────────────────────────────────────────────────────────────┘
📡 RAW INCIDENT REPORT (title, description, location, type)
│
▼
╔══════════════════════════════════════════════════════════════════════════╗
║ AGENT 1 — DISASTER INTELLIGENCE ANALYST ║
║ Role: Classify incident type, severity, and geographic impact zone ║
║ Input: Raw incident report ║
║ Output: Disaster type · Severity band (1–5) · Impact radius (km) ║
╚══════════════════════════════════════════════════════════════════════════╝
│ ↓ passes: {disaster_type, severity, impact_radius}
▼
╔══════════════════════════════════════════════════════════════════════════╗
║ AGENT 2 — INCIDENT COMPREHENSION SPECIALIST ║
║ Role: Parse fragmented reports into normalized structured data ║
║ Input: Classified incident from Agent 1 ║
║ Output: GPS coordinates · Affected population · Infrastructure damage ║
╚══════════════════════════════════════════════════════════════════════════╝
│ ↓ passes: {coordinates, affected_population, damage_level}
▼
╔══════════════════════════════════════════════════════════════════════════╗
║ AGENT 3 — SURVIVOR RISK ESTIMATION SPECIALIST ║
║ Role: Calculate survivor probability and people needing rescue ║
║ Input: Structured incident object, severity score ║
║ Output: Survivor probability (0–1) · Estimated count · Time-sensitivity ║
╚══════════════════════════════════════════════════════════════════════════╝
│ ↓ passes: {survivor_probability, estimated_survivors, time_sensitivity}
▼
╔══════════════════════════════════════════════════════════════════════════╗
║ AGENT 4 — MEDICAL EMERGENCY TRIAGE COORDINATOR ║
║ Role: Assess medical needs and recommend response level ║
║ Input: Survivor probability data, incident type ║
║ Output: Priority level (critical/high/medium/low) · Trauma types · Resources ║
╚══════════════════════════════════════════════════════════════════════════╝
│ ↓ passes: {medical_priority, trauma_types, resource_needs}
▼
╔══════════════════════════════════════════════════════════════════════════╗
║ AGENT 5 — EMERGENCY RESPONSE PRIORITIZATION OFFICER ║
║ Role: Rank incident and determine dispatch urgency ║
║ Input: Triage output + survivor probability + incident queue ║
║ Output: Priority rank (P1–P5) · Urgency score · Response window ║
╚══════════════════════════════════════════════════════════════════════════╝
│ ↓ branches into parallel tracks:
├─────────────────────────────────┐
▼ ▼
╔═══════════════════════════╗ ╔═══════════════════════════════════════╗
║ AGENT 6 — RESOURCE ║ ║ AGENT 7 — HOSPITAL COORDINATION ║
║ ALLOCATION COORDINATOR ║ ║ LIAISON & BED CAPACITY COORD. ║
║ ║ ║ ║
║ Optimal mix of rescue ║ ║ Best hospitals by proximity, ║
║ teams, vehicles, equip. ║ ║ capacity & specialization ║
║ ║ ║ ║
║ Output: ║ ║ Output: ║
║ · 12 ambulances ║ ║ · Gandhi Hospital (2.1km, 120 beds) ║
║ · 2 rescue helicopters ║ ║ · Osmania Hospital (3.8km, 80 beds) ║
║ · 4 NDRF fire teams ║ ║ · Patient routing plan ║
╚═══════════════════════════╝ ╚═══════════════════════════════════════╝
│ │
└──────────────┬──────────────────┘
▼
╔══════════════════════════════════════════════════════════════════════════╗
║ AGENT 8 — DISASTER RISK FORECASTING ANALYST ║
║ Role: Assess secondary risks (aftershocks, flooding, fire spread) ║
║ Input: Incident type + location + historical data ║
║ Output: Risk evolution score · Secondary risk flags · Precautions ║
╚══════════════════════════════════════════════════════════════════════════╝
│ ↓ passes: {risk_score, secondary_risks[], precautionary_measures[]}
▼
╔══════════════════════════════════════════════════════════════════════════╗
║ AGENT 9 — EMERGENCY COMMUNICATIONS OFFICER ║
║ Role: Draft alerts for field teams, hospitals, and public ║
║ Input: Final rescue plan, recipient types ║
║ Output: SMS text · Hospital MCI alert · Public broadcast · TwiML ║
║ → Triggers TWILIO dispatch automatically ║
╚══════════════════════════════════════════════════════════════════════════╝
│ ↓ passes: {field_team_sms, hospital_alert, public_message, twiml_script}
▼
╔══════════════════════════════════════════════════════════════════════════╗
║ AGENT 10 — RESCUE COMMAND ORCHESTRATOR ║
║ Role: Synthesize ALL 9 agent outputs into one rescue plan ║
║ Input: Context from ALL prior agents (t1 through t9) ║
║ Output: Final RescuePlan JSON — the definitive field command ║
╚══════════════════════════════════════════════════════════════════════════╝
│
▼
┌──────────────────────────────────────────────────────────────┐
│ RESCUE PLAN JSON OUTPUT │
│ { │
│ "priority": "P1", │
│ "severity": 5, │
│ "affected_area": "Begumpet, Hyderabad", │
│ "estimated_survivors": 4200, │
│ "survivor_probability": 0.72, │
│ "medical_priority": "critical", │
│ "recommended_hospital": "Gandhi Hospital", │
│ "recommended_resources": [ │
│ {"type": "ambulance", "count": 12, "eta_minutes": 8}, │
│ {"type": "helicopter", "count": 2, "eta_minutes": 15}, │
│ {"type": "ndrf_team", "count": 4, "eta_minutes": 22} │
│ ], │
│ "risk_warnings": ["Flash flood escalation in 6 hrs"], │
│ "alert_actions": { │
│ "field_team": "PRIORITY P1: Deploy immediately...", │
│ "hospital": "MCI ALERT: Expect 350 casualties...", │
│ "public": "EVACUATION ORDER: Begumpet zone..." │
│ } │
│ } │
└──────────────────────────────────────────────────────────────┘
│ │ │
▼ ▼ ▼
📱 Twilio SMS 📞 Voice Call 🖥️ Dashboard
to field teams to hospitals real-time update
### Agent Context Chaining (How Agents Talk to Each Other)
| Task | Agent | Receives Context From | Key Value Add |
|---|---|---|---|
| Task 1 | Disaster Intelligence | _(Raw report only)_ | Sets disaster classification for all downstream agents |
| Task 2 | Incident Understanding | Task 1 | Converts vague text into GPS + population numbers |
| Task 3 | Survivor Probability | Task 2 | Applies statistical model → survivor count |
| Task 4 | Medical Triage | Task 3 | Translates survivor count into medical resource needs |
| Task 5 | Priority Agent | Tasks 1–4 | Full picture → accurate P1–P5 ranking |
| Task 6 | Resource Allocation | Tasks 4, 5 | Medical needs + priority → correct unit mix |
| Task 7 | Hospital Coordination | Tasks 3, 4, 5 | Routes casualties to real Telangana hospitals |
| Task 8 | Risk Prediction | Tasks 1, 2 | Secondary hazard forecasting from incident type + location |
| Task 9 | Communication | Tasks 5, 6, 7, 8 | Accurate, data-backed alert messages for all recipients |
| Task 10 | Command Orchestrator | Tasks **1–9 ALL** | Synthesizes, not invents — the definitive rescue command |
## ☁️ AWS Infrastructure
┌───────────────────────────────────────────────────────────────────────────────────┐
│ ☁️ AWS CLOUD INFRASTRUCTURE │
└───────────────────────────────────────────────────────────────────────────────────┘
👤 Emergency Commanders · Field Teams · Hospital Admins
│ HTTPS
▼
┌────────────────────────────────────┐
│ AWS AMPLIFY (CDN) │ ← Next.js 14, global distribution,
│ Next.js 14 Frontend │ CI/CD from GitHub, SSL termination
└─────────────────┬──────────────────┘
│ REST API Calls
▼
┌────────────────────────────────────┐ ┌──────────────────────────────────┐
│ AMAZON EC2 (Docker) │────▶│ AMAZON ECR │
│ FastAPI Backend │ │ Docker Registry │
│ Pydantic · CrewAI Orchestrator │ │ rescuenet-backend:latest │
└──────────────────┬─────────────────┘ └──────────────────────────────────┘
│ ▲
┌───────────┼──────────────────────┐ │
▼ ▼ ▼ ▼ ┌─────┴────────────────┐
┌──────────┐ ┌──────────┐ ┌────────┐ ┌──────────┐ │ AWS IAM │
│ AWS │ │ AMAZON │ │ AMAZON │ │ AWS │ │ Role-Based Auth │
│ BEDROCK │ │ SNS │ │ S3 │ │ SECRETS │ │ ECR Token Generator │
│ │ │ │ │ │ │ MANAGER │ └──────────────────────┘
│ Claude 3 │ │ Fan-out │ │ Plan │ │ │
│ Sonnet │ │ Alerts │ │ Store │ │ API Keys │ ┌──────────────────────┐
│ LLM API │ │ Multi-ch.│ │ Audit │ │ DB URIs │ │ AMAZON CLOUDWATCH │
└──────────┘ └────┬─────┘ │ Logs │ │ Twilio │ │ Agent Step Logs │
│ └────────┘ └──────────┘ │ Metrics · Alarms │
┌──────────┴─────┐ └──────────────────────┘
▼ ▼
┌────────────┐ ┌────────────┐
│ TWILIO │ │ AMAZON SES │ ┌─────────────────────────────┐
│ SMS/Voice │ │ Email │ │ NEON SERVERLESS POSTGRES │
│ WhatsApp │ │ Reports │ │ Disaster Asset Database │
└────────────┘ └────────────┘ │ Incidents · Rescue Plans │
│ Agent Decisions · Alerts │
└─────────────────────────────┘
### AWS Services Breakdown
| Service | Role | Current Status |
|---|---|---|
| **AWS Amplify** | Frontend CDN — Next.js build, SSL, global distribution | ✅ Configured (`amplify.yml`) |
| **Amazon EC2** | FastAPI backend compute host | ✅ Active (`apprunner-config.json`) |
| **Amazon ECR** | Private Docker registry for `rescuenet-backend:latest` | ✅ Integrated |
| **AWS IAM** | Role-based access, short-lived ECR tokens, no hardcoded credentials | ✅ Active |
| **AWS Bedrock** | Primary production LLM (Claude 3 Sonnet) | ⚙️ Configured (env-based) |
| **Amazon SNS** | Fan-out alert dispatch to Twilio, SES, and SMS endpoints | ⚙️ ARN configured |
| **Amazon S3** | Rescue plan JSON storage, audit log archiving | ⚙️ Bucket configured |
| **AWS Secrets Manager** | Secure storage for DB URIs, API keys, Twilio tokens | 🔵 Planned (v0.3) |
| **Amazon CloudWatch** | Agent step logging, performance metrics, alarm triggers | 🔵 Planned (v0.3) |
### Deployment Script
The backend is deployed via `scripts/deploy_to_ec2.ps1`:
# 1. Authenticate with AWS IAM → get ECR login token
# 2. Upload execution script to EC2 via SSH
# 3. Auto-install Docker + AWS CLI if missing
# 4. Pull rescuenet-backend:latest from ECR
# 5. Run container with all env vars (DB URI, CORS, LLM keys)
# Full deployment checklist:
# ✅ Push Docker image to Amazon ECR
# ✅ Provision EC2 instance, open port 8000
# ✅ Provision Neon PostgreSQL instance
# ✅ Execute deploy_to_ec2.ps1
# ✅ Connect Amplify to GitHub repo (auto-deploy on push)
# ✅ Set NEXT_PUBLIC_API_URL in Amplify env vars
# ✅ Verify: GET http://🛠️ 1. Clone and Configure
git clone https://github.com/Vikram30069/RescueNet-AI.git cd RescueNet-AI cp .env.example .env # Edit .env: set LLM_PROVIDER, DATABASE_URL, and optionally TWILIO_* keys🐳 2. Run with Docker (Fastest)
docker-compose up --build | Service | URL | |---|---| | 🖥️ Frontend Dashboard | http://localhost:3000 | | 🔌 Backend API | http://localhost:8000 | | 📋 Swagger Docs | http://localhost:8000/docs | | 💓 Health Check | http://localhost:8000/health |💻 3. Run Manually (Local Dev)
**Backend:** cd backend python -m venv venv venv\Scripts\activate # Windows source venv/bin/activate # Mac/Linux pip install -r requirements.txt uvicorn app.main:app --reload --port 8000 **Frontend:** cd frontend npm install npm run dev **Run Agent Pipeline (standalone test):** python scripts/run_agents.py **Trigger full demo scenario:** python trigger_demo.py☁️ 4. Deploy to AWS
# Push Docker image to ECR: aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin
**Built with ❤️ for Telangana · Ready to scale for India**
_RescueNet AI — When every second counts, AI coordinates._
标签:AV绕过, AWS, CrewAI, DPI, FastAPI, PyRIT, 人工智能, 多智能体系统, 测试用例, 灾害应急管理, 用户模式Hook绕过, 请求拦截, 逆向工具