AkashKaralingannavar/sequential-medical-triage-ai
๐ฅ AI Medical Triage Assistant โ OpenEnv RL Environment
Real-World Motivation
In low-resource healthcare settings worldwide, patients face critical delays in receiving appropriate care. This OpenEnv simulates a first-level AI triage assistant that must make sequential decisions under partial observability โ a genuine real-world problem.
Unlike simple classifiers, this is a true sequential decision-making RL environment where the agent must:
- Decide what information to gather (at a cost)
- Balance investigation thoroughness vs. time pressure
- Handle patients who deteriorate if not triaged quickly
Observation Space (TriageObservation)
Action Space (TriageAction)
Reward Design
- Urgency match: up to 0.45 points (partial credit for being 1 level off)
- Action match: up to 0.45 points (partial credit for adjacent actions)
- Investigation bonus: +0.05 for thorough information gathering
- Time penalty: -0.06 per investigation step (-0.10 in time-critical)
- Deterioration penalty: -0.10 if volatile patient worsens
- All scores clamped to strict (0.01, 0.99) โ never 0.0 or 1.0
Tasks & Difficulty
1. direct_triage โ Easy
Full patient information (symptoms + vitals) is visible from the start. The agent simply needs to classify urgency and recommend an action.
2. investigative_triage โ Medium
Only the chief complaint is visible. The agent must spend investigate actions to uncover symptoms and vitals. Each investigation incurs a time penalty (-0.06). Blind guessing is penalized.
3. time_critical_triage โ Hard
High-volatility patients deteriorate over time. Investigation costs more (-0.10 per step). If the agent takes too long, the patient's condition worsens, potentially changing the correct answer. The agent must triage quickly while still gathering minimum critical info.
Setup & Usage
Docker (recommended)
docker build -t openenv-triage .
docker run -p 7860:7860 openenv-triageAccess the API at http://localhost:7860/
API Endpoints
GET /โ Health check (returns 200)GET/POST /reset?task_name=direct_triage&case_index=0โ Reset environmentPOST /stepโ Submit an action (JSON body matchingTriageAction)GET /stateโ Get current environment state
Run Inference
export HF_TOKEN="your_api_key"
export MODEL_NAME="Qwen/Qwen2.5-72B-Instruct"
python inference.pyRun a specific task
export TASK_NAME="investigative_triage"
python inference.pyBaseline Scores (Heuristic Agent)
Scores improve significantly with capable LLMs (GPT-4, Qwen-72B).
Grader Verification
python grader.pyAll scores will be printed and verified to be in the strict (0.0, 1.0) range.
