Every guardrail is implemented in code and justified architecturally. Human-in-the-Loop (HITL) design: all outputs are recommendations — humans decide.
+
+
GR1
+
PerceptionAgent
+
Person Count Cap (MAX=1000)
+
Prevents YOLO hallucinations on busy textures from propagating to risk scoring.
+
+
+
GR2
+
PerceptionAgent
+
Density Score Cap (MAX=50)
+
Prevents density formula overflow on small frames; keeps score interpretable.
+
+
+
GR3
+
RiskAgent
+
Risk Score Clamp [0.0, 1.0]
+
Weighted sum could exceed 1.0 due to floating point. Clamp ensures valid thresholds.
+
+
+
GR4
+
OperationsAgent
+
P0 Rate Limit (1 per 5 min)
+
Prevents alert fatigue — operators who see 20 P0/hour begin ignoring them.
+
+
+
GR-C1
+
CoordinatorAgent
+
Required JSON Fields Enforced
+
LLMs occasionally omit fields. Missing arabic_alert or threat_level breaks dashboard.
+
+
+
GR-C2
+
CoordinatorAgent
+
threat_level Whitelist
+
Prevents GPT returning "EXTREME" or "UNKNOWN" that break downstream logic.
+
+
+
GR-C3
+
CoordinatorAgent
+
Confidence Score [0,1] Validated
+
LLMs sometimes return confidence as percentage (85 vs 0.85) — normalized.
+
+
+
GR-C4
+
CoordinatorAgent
+
Threat Level ↔ Risk Score Consistency
+
Full range enforcement: threat_level is overridden to match actual risk_score thresholds (LOW/MEDIUM/HIGH). Prevents LLM from returning HIGH threat during MEDIUM risk.
+
+
+
GR-C5
+
CoordinatorAgent
+
Arabic Alert Fallback
+
Arabic alert is safety-critical. Empty string on dashboard during P0 is unacceptable.
+
+
+
RF1
+
ReflectionAgent
+
Chronic LOW Bias Detection
+
Sliding window lag causes 20+ frames of LOW during escalation. Guardrail prevents missed emergencies.
+
+
+
RF2
+
ReflectionAgent
+
Rising Trend + LOW → MEDIUM
+
Rising crowd with LOW risk is a contradictory state indicating calibration failure.
+
+
+
RF3
+
ReflectionAgent
+
Count-Risk Mismatch Correction
+
80+ persons + LOW = mathematical impossibility. Absolute count override applied.
+
+