Thrishu/disaster-response-env
๐ Disaster Response Coordinator Agent
Overview
A flood disaster is unfolding across multiple zones. You are the AI coordinator. You have limited rescue teams, medical kits, food supplies, helicopters, and flood barriers. Roads wash out. Floods intensify. Storms arrive without warning.
Your decisions directly determine how many people survive.
This is a real operational problem โ disaster response coordinators face exactly this resource-allocation-under-uncertainty challenge in real emergencies. The environment models the core trade-offs: triage vs. fairness, flood prevention vs. immediate rescue, and helicopter deployment for cut-off zones.
Observation Space
Action Space
All fields are Dict[zone_id, int]. Total allocations across zones must not exceed available resources.
Key constraint: road_blocked and air_only zones receive no rescue, medical, or food unless helicopters are also sent there.
Reward Function
Rewards are shaped across the full trajectory (not just end-of-episode):
- +0.03 per person rescued via rescue teams
- +0.015 per person healed via medical kits
- +0.003โ0.006 per food unit (scaled by zone need)
- +0.02 per flood barrier deployed
- +0.005 per person evacuated
- โ0.05 to โ0.25 per step for high flood levels (โฅ7 and โฅ9)
- โ0.1 to โ0.3 per step for high injury ratios (>15% and >30%)
- โ0.15 for over-allocating resources (exceeding available stock)
- โ0.2 for taking no action (idle penalty)
Grader
Final episode score (0.0โ1.0) combines:
Tasks
๐ข Easy
- Zones: 1 (open access)
- Steps: 10
- Challenge: Basic allocation, moderate flood
- Baseline (rule-based): ~0.50โ0.60
- Good agent target: ~0.75โ0.85
๐ก Medium
- Zones: 2 (one road-blocked)
- Steps: 15
- Challenge: Must use helicopters to reach blocked zone; heavier injuries
- Baseline (rule-based): ~0.35โ0.45
- Good agent target: ~0.65โ0.75
๐ด Hard
- Zones: 3 (one road-blocked, one air-only from start)
- Steps: 20
- Challenge: Active storm, only 2 helicopters for 2 blocked zones โ agent must triage
- Baseline (rule-based): ~0.20โ0.30
- Good agent target: ~0.55โ0.65
API
\POST /reset?task=easy|medium|hard โ initial observation
POST /step โ next observation, reward, done, info
POST /grade โ final episode score (0.01โ0.99)
GET /state โ current observation
GET /health โ {"status": "ok"}Example: Reset and Step
import requests, json
BASE = "http://localhost:7860"
obs = requests.post(f"{BASE}/reset?task=medium").json()
action = {
"allocate_rescue": {"A": 2, "B": 1},
"send_food": {"A": 20, "B": 15},
"send_medical": {"A": 10, "B": 8},
"deploy_helicopters": {"B": 1}, # B is road_blocked โ helicopter required!
"deploy_barriers": {"B": 1},
"evacuate": {"A": 50}
}
result = requests.post(f"{BASE}/step", json=action).json()
print(result["reward"], result["done"])Setup
Docker
docker build -t disaster-response-env .
docker run -p 7860:7860 disaster-response-envLocal (Python)
pip install fastapi uvicorn pydantic openai openenv-core
uvicorn server.app:app --host 0.0.0.0 --port 7860Run Inference
export API_BASE_URL=https://api.openai.com/v1
export MODEL_NAME=gpt-4o-mini
export HF_TOKEN=hf_... # required โ passed as OpenAI client api_key (see submission guidelines)
python inference.pyProject Structure
.
โโโ Dockerfile
โโโ pyproject.toml
โโโ openenv.yaml
โโโ inference.py # baseline inference script
โโโ env.py # core DisasterEnv
โโโ models.py # Observation, Action, Reward pydantic models
โโโ grader.py # deterministic episode scorer
โโโ tasks/
โ โโโ easy.py
โ โโโ medium.py
โ โโโ hard.py
โโโ server/
โโโ app.py # FastAPI serverAuthor
Thrishank
