Inspiration
During the historic Industrial Revolution, production lines scaled at breakneck speed, but safety infrastructure lagged behind—often at the cost of human lives. Today, we are in the midst of an AI Industrial Revolution, yet factory floor safety management remains painfully antiquated.
When a hazardous incident occurs on a modern factory floor, it triggers a tedious, manual pipeline: workers fill out paper or static forms, managers inconsistently guess severity ratings hours later, and maintenance tickets get delayed in bureaucratic backlogs. In high-risk industrial environments, delayed mitigation costs lives.
We built SafeGuard AI to completely eliminate this friction. Our vision was to create an autonomous, deterministic, safety-first agent capable of transforming a single raw, unstructured sentence from a factory worker into an instantaneous, auditable compliance workflow in under one second.
What it does
SafeGuard AI is an autonomous, end-to-end safety compliance and incident response agent designed for the modern industrial floor. Instead of forcing workers to fill out tedious paperwork or waiting hours for manual triage, a worker simply types a single unstructured paragraph like "Oil is leaking from Machine A12 and workers almost slipped."
In under a second, SafeGuard AI executes a complete operational safety workflow:Categorizes & Assesses: Evaluates the specific hazard type (e.g., Slip/Fall, Chemical, Electrical) and computes an objective safety risk score.Orchestrates Response: Automatically recommends immediate mitigation steps, specific PPE requirements, and hardware shutdown actions (Lockout/Tagout).Automates Ticketing & Routing: Instantly opens a maintenance ticket, routes it to the responsible department, and fires notifications to designated factory managers.Ensures Auditable Compliance: Generates a professional, regulatory-ready PDF safety report and updates the live plant analytics dashboard instantaneously.
How we built it
SafeGuard AI relies on a decoupled, resilient architecture engineered for zero-latency triage and absolute predictability.The Agent State Machine: Rather than a fragile, linear prompt chain, we orchestrated our agent using a LangGraph state machine. The execution graph moves deterministically through isolated nodes to manage state consistency:intake ➔ analyze ➔ assess_risk ➔ plan_response ➔ route_department ➔ create_ticket ➔ notify ➔ finalizeThe Operational Risk Engine: To eliminate human subjectivity, the agent evaluates risk using a rigorous mathematical model. The total Risk Score ($R$) is derived from the analyzed Severity factor ($S$) and Likelihood factor ($L$), bounded by a strict safety-first override constraint ($\Omega$) for critical hazards like Fire, Electrical, or Chemical events:$$R = \max\left( (S \times L) \times 10, \, \Omega \right)$$If an incident falls under a life-threatening category, the override $\Omega = 75$ is automatically enforced. This guarantees that critical events are never under-prioritized, forcing immediate equipment shutdown recommendations.The Stack:Backend: FastAPI (Python 3.11), Pydantic v2 data contracts, and SQLAlchemy 2 powering a local SQLite database with asynchronous background workers.Frontend: Next.js 15 (App Router) with TypeScript, styled with TailwindCSS, animated via Framer Motion, and visualized using Recharts.AI Reasoning: Qwen2.5:3B running locally via Ollama.
Challenges we ran into
The "Demo-Day Dilemma" & JSON Stability: Smaller, local language models (like 3B parameters) are exceptionally fast for edge deployments but can be prone to structural formatting failures or hallucinations under heavy loads. If the JSON structure cracked, downstream services would fail.
Our Solution: We engineered a strict system prompt and coupled it with a deterministic, rule-based offline safety fallback engine. If Ollama is unavailable or the LLM output is malformed, our fallback engine seamlessly intercepts, parses the input keywords, and returns the exact same structured JSON. This guarantees a bulletproof demo with 100% uptime, requiring no GPU or network access.
State Synchronization: Coordinating instantaneous frontend updates via polling alongside heavy, asynchronous background operations (like generating PDF layouts using ReportLab) required careful isolation of the LangGraph execution block from the HTTP transport layer using FastAPI background tasks.
Accomplishments that we're proud of
Zero-Dependency Resilience: Creating an AI agent that runs flawlessly entirely offline. A judge can download and run our Docker container on a laptop with no internet connection, and the entire safety workflow will still execute perfectly in under a second.
Bulletproof Guardrails: Designing an agent that prioritizes human safety above all else. By enforcing algorithmic constraints over raw LLM outputs, we proved that AI can be trusted in high-stakes industrial environments.
Full-Scale Implementation: Delivery of a feature-complete system featuring Role-Based Access Control (JWT), interactive charting, an incredibly clean user interface, and automated PDF compliance generation within a tight hackathon window.
What we learned
Graphs Over Linear Chains: For mission-critical applications like industrial safety, simple LLM chains are too unpredictable. Graph-based architectures allow developers to enforce ironclad state boundaries and reliable error handling.
Edge Models Punch Above Their Weight: When given tightly scoped system prompts and rigorous JSON validation contracts, tiny edge models like Qwen2.5:3B can match the categorization precision of massive proprietary APIs for specialized workloads.
Deterministic Layers are Non-Negotiable: Pure neural network logic cannot be blindly trusted to safeguard human lives. Software must wrap AI outputs in deterministic validation layers and mathematical overrides.
What's next for Safeguard Ai
Multimodal Triage: Enhancing the intake node to support image and video uploads, allowing factory workers to take a photo of a structural crack, a broken pressure gauge, or a gas leak and have the agent parse the visual hazard automatically.
Industrial IoT Integration: Connecting SafeGuard AI directly to factory hardware via protocols like MQTT or OPC-UA. This will enable the agent to ingest live telemetry anomalies and trigger physical factory alarms or automated machine interlocks instantly.
Regulatory Fine-Tuning: Fine-tuning our edge model on specialized OSHA safety regulation datasets to provide highly specific legal and compliance cross-referencing on every generated report.
Built With
- docker
- fastapi
- framer-motion
- jwt
- langgraph
- llm
- next.js
- ollama
- pydantic
- python
- qwen2.5
- react
- recharts
- reportlab
- sqlalchemy
- sqlite
- tailwindcss
- typescript


Log in or sign up for Devpost to join the conversation.