SentinelZone-AI is an edge-native, predictive dynamic spatial safety and autonomous agentic platform engineered for active industrial construction, heavy civil infrastructure, and mining workzones.
Unlike conventional reactive computer vision systems that simply draw 2D bounding boxes, SentinelZone-AI bridges physical edge perception with high-level cognitive agentic reasoning:
- Physical Edge Layer (<120ms): Visual detections are projected onto a calibrated geodetic metric ground plane via planar homography, tracked with Extended Kalman Filters (EKF), and projected into the future using Spatio-Temporal Graph Attention Networks (GATv2 ST-GNN) to anticipate struck-by collisions before they occur.
- Cognitive Agentic Layer (LangGraph ReAct): An autonomous Site Safety Supervisor agent orchestrates permits-to-work (PTW) compilation into dynamic BIM exclusion envelopes, runs multimodal VLM incident forensic triage, curates high-loss edge cases for active learning, and synthesizes OSHA-compliant daily safety briefings.
SENTINELZONE-AI ARCHITECTURE
============================== PHYSICAL EDGE LAYER (<120ms) ==============================
+----------------+ +------------------------+ +----------------------+
| Camera Stream | ---> | CUDA Perception Engine | ---> | Planar Homography H⁻¹|
| (RTSP / Video) | | YOLOv8 + PPE Analysis | | (2D Box -> Metric 3D)|
+----------------+ +------------------------+ +----------+-----------+
|
+--------------------------------------------------------------------+
|
v
+------------------+ +------------------------+ +----------------------+
| Multi-Agent EKF | ---> | GATv2 ST-GNN Engine | ---> | Dynamic Exclusion |
| State Tracking | | Trajectory Forecasting | | Envelopes & TTC Calc |
+------------------+ +------------------------+ +----------+-----------+
|
============================= COGNITIVE AGENTIC LAYER (LangGraph) ========================
|
+--------------------------------------------------------------------+
|
v
+----------------------------------------------------------------------------------+
| AUTONOMOUS SITE SAFETY SUPERVISOR (ReAct Agent) |
| |
| [Tool 1: query_site_telemetry] --> Real-time EKF tracks & TTC metrics |
| [Tool 2: compile_work_permit] --> Pipeline 1: NLP PTW to BIM Envelopes |
| [Tool 3: adjudicate_incident_packet] --> Pipeline 2: Multimodal VLM Triage |
| [Tool 4: generate_daily_toolbox_talk]--> OSHA 29 CFR 1926 Safety Briefings |
| [Tool 5: get_active_learning_queue] --> Curated Edge-Case Retraining Dataset |
| [Tool 6: update_exclusion_corridor] --> Live Collision Engine Zone Ingestion |
+----------------------------------------------------------------------------------+
|
=============================== PRESENTATION & CONTROL ============================
v
+----------------------------------------------------------------------------------+
| FASTAPI DEMO & COPILOT GATEWAY (:8000) |
| * Interactive 3D WebGL Digital Twin (Three.js geodetic datum ground plane) |
| * Canvas-rendered Video Overlay (Zero-codec failure JPEG streaming) |
| * AI Safety Supervisor Chat Modal (Multi-turn ReAct with live tool traces) |
| * Dynamic Zero-Config Video Ingestion (Auto-catalog data/real_videos/) |
+----------------------------------------------------------------------------------+
- Built on LangGraph
StateGraph(SupervisorAgentState)implementing a multi-turn ReAct (Reason + Act) loop. - 6 Real Domain Tools (Zero Placeholders / Zero Mocks):
query_site_telemetry: Fetches real-time kinematic tracks, observed Time-to-Collision (TTC), and near-miss escalation flags.compile_work_permit: Triggers Pipeline 1 to parse unstructured PTWs and push dynamic exclusion polygons to the edge collision engine.adjudicate_incident_packet: Triggers Pipeline 2 to perform multimodal forensic triage and root-cause determination.generate_daily_toolbox_talk: Synthesizes OSHA 29 CFR 1926 compliant daily safety briefings tailored to empirical site hazard data.get_active_learning_queue: Audits the active learning queue containing false alarms, low-confidence frames, and high-loss near-misses.update_exclusion_corridor: Dynamically expands or contracts machinery exclusion zones in the active edge runtime.
- Factory method
get_agent_llm()supporting OpenAI GPT-4o and Anthropic Claude 3.5 Sonnet with automatic.with_fallbacks([DeterministicAgentLLM()]). - Features
DeterministicAgentLLM(subclass of LangChain'sBaseChatModel), a specialized domain safety reasoner enabling complete offline edge air-gap autonomy and test determinism without external API dependencies.
- NLP Task Extraction
$\rightarrow$ BIM Datum Resolution$\rightarrow$ Pydantic v2ShiftSafetyManifestValidation$\rightarrow$ MQTT / Live Collision Engine Injection. - Persists manifests to
data/manifests/{shift_id}.jsonand updatesSentinelEdgeRuntime.conflict_enginememory dynamically.
- Multi-factor VLM Triage (
TRUE_POSITIVE,FALSE_POSITIVE,CONTROLLED_WORK). - Automatically exports forensic incident records to
data/incidents/{event_id}.jsonand curates edge-cases intodata/active_learning/curated_queue.jsonl.
- YOLOv8 hardware-accelerated detection with PPE compliance verification (Hardhat/Vest).
- Metric Planar Homography (
$H^{-1}$ ) with real-time calibration drift monitoring ($RMSE < 0.15\text{m}$ ). - GATv2 Spatio-Temporal Graph Attention Network predicting 3.0s future multi-agent trajectories.
SentinelZone-AI/
|-- config/
| +-- default_config.json # Calibrated homography, thresholds, and envelope specs
|-- data/
| |-- active_learning/ # Curated active learning retraining queue (.jsonl)
| |-- incidents/ # Forensic incident dossiers (.json)
| |-- manifests/ # Compiled shift safety manifests (.json)
| |-- real_videos/ # Real-world site videos (dynamic drop folder)
| |-- test_videos/ # Calibrated scenario video sequences
| +-- roboflow_downloaded/ # Roboflow validation and test splits
|-- src/
| |-- api/
| | |-- app.py # FastAPI application with REST & WebSocket routes
| | +-- demo_service.py # GPU processor, video scanner, and telemetry cache
| |-- dashboard/
| | +-- index.html # Three.js Digital Twin & AI Supervisor Copilot UI
| |-- graph/ # LangGraph Autonomous Agentic Modules
| | |-- __init__.py # Module exports
| | |-- llm_provider.py # Multi-provider factory with DeterministicAgentLLM
| | |-- context_pipeline.py # Pipeline 1: PTW to BIM Dynamic Spatial Envelopes
| | |-- adjudication_pipeline.py# Pipeline 2: Multimodal Incident Adjudication
| | +-- supervisor_agent.py # Pipeline 3: ReAct Supervisor Agent with 6 tools
| |-- perception/
| | |-- detector.py # YOLOv8 + PPE multi-class detector
| | +-- dataset_downloader.py # Automated Roboflow dataset downloader
| |-- spatial/
| | |-- homography.py # Planar homography matrix & calibration engine
| | +-- bim_resolver.py # BIM/IFC geodetic coordinate resolver
| |-- tracking/
| | |-- ekf.py # Kinematic Extended Kalman Filter
| | |-- gnn_forecaster.py # GATv2 Spatio-Temporal Graph Neural Network
| | +-- conflict_engine.py # Dynamic exclusion envelopes & debouncer
|-- tests/
| |-- test_agent_api.py # REST API tests for autonomous agent endpoints
| |-- test_demo_api.py # Core gateway and telemetry tests
| |-- test_detector.py # YOLO and PPE tests
| |-- test_ekf.py # Kinematic tracking tests
| |-- test_gnn_forecaster.py # GATv2 trajectory forecast tests
| |-- test_homography.py # Homography projection and drift tests
| |-- test_incident_agent.py # Incident reporting tests
| |-- test_pipelines.py # Pipeline 1 & Pipeline 2 LangGraph tests
| |-- test_safety_engine.py # Safety envelopes and debouncing tests
| +-- test_supervisor_agent.py # Supervisor agent & 6 domain tools unit tests
|-- agent.md # Comprehensive mathematical derivations & formal specs
|-- pyproject.toml # Project metadata and dependencies
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/v1/agent/supervisor/chat |
Multi-turn chat with the Autonomous Site Safety Supervisor ReAct agent |
POST |
/api/v1/agent/pipeline1/compile_manifest |
Compiles raw PTW text into dynamic BIM spatial exclusion envelopes |
POST |
/api/v1/agent/pipeline2/adjudicate |
Multimodal VLM forensic triage and active learning curation |
GET |
/api/v1/agent/toolbox_talk/{site_id} |
Generates OSHA 29 CFR 1926 daily safety toolbox briefing |
GET |
/api/v1/agent/active_learning/queue |
Returns curated edge-case dataset samples ready for model retraining |
GET |
/api/v1/demo/scenarios |
Returns catalog of dynamically discovered site videos and scenarios |
GET |
/api/v1/demo/telemetry/{scenario_id} |
Returns complete sequential EKF and near-miss telemetry |
GET |
/health |
Hardware and service health check (CUDA device, active connections) |
# Clone repository
git clone https://github.com/Free-devloper/SentinelZone-AI.git
cd SentinelZone-AI
# Install dependencies
pip install torch torchvision ultralytics fastapi uvicorn opencv-python numpy scipy langgraph langchain-core langchain-openai langchain-anthropic# Launch the FastAPI gateway with CUDA hardware acceleration
python -m uvicorn src.api.app:app --host 0.0.0.0 --port 8000Open your browser at:
http://localhost:8000
- Open AI Safety Supervisor: Click 🤖 AI Safety Supervisor in the header or press
Aon your keyboard. - Run Quick Actions: 1-click permit compilation, live telemetry check, incident adjudication, or OSHA toolbox talks.
python -m unittest discover -s tests -p "test_*.py"All 46 unit tests execute in ~25 seconds with 100% passing status.
- Drop any construction site video (
.mp4,.avi,.mov,.mkv,.webm) into:data/real_videos/ - In the dashboard at
http://localhost:8000, click the ⟳ Rescan button (or restart the server). - The video is automatically indexed, processed on the GPU, and ready for live playback, 3D metric twin tracking, and supervisor agent analysis.
For complete mathematical proofs, kinematic formulations, planar homography matrices, and GATv2 spatio-temporal attention derivations, refer to: agent.md
Apache 2.0