Failsafe - A Real-Time Condition Intelligence for High-Stakes Shipping

Inspiration

Every year, an estimated $35 billion in pharmaceuticals are destroyed due to cold chain failures. 30% of the global food supply is lost or wasted, with improper transport conditions a leading cause. The WHO estimates that 50% of vaccines arrive compromised worldwide.

The industry has sensors. It has data. What it doesn't have is intelligence.

Current monitoring solutions are passive recorders. They log what happened after the shipment is already ruined. A logistics manager reviews the log after delivery, manually writes a deviation report, contacts the receiving pharmacy, and files an insurance claim — hours of work, after the damage is already done.

We built Failsafe because the gap between data exists and someone understands it in time to act is where billions of dollars and countless lives are lost every year.


What It Does

Failsafe is a smart shipping container with four sensors, temperature, humidity, shock, and water detection, connected to a network of four AI agents that perform real-time statistical analysis on every reading.

When conditions change, Failsafe doesn't just fire an alert. It:

  • Establishes a dynamic baseline for each shipment using the opening readings as reference
  • Computes statistical anomaly scores to detect deviations relative to that specific shipment's normal, not hardcoded thresholds
  • Correlates patterns across multiple sensors simultaneously, a temperature spike that follows two shock events and a humidity surge tells a completely different story than a temperature spike in isolation
  • Reconstructs the causal chain of physical events with timestamps
  • Classifies the incident as NOMINAL / ANOMALY / NEGLIGENCE / TAMPERING / CRITICAL with explicit confidence scores and competing hypotheses
  • Predicts what happens to the cargo in the next 5, 15, and 30 minutes using rate-of-change analysis
  • Generates a structured incident report with recommended actions for the logistics team

The system works across cargo types: pharmaceuticals, food, specialty chemicals, lab samples with user-configurable thresholds per shipment.


How We Built It

Hardware

  • Raspberry Pi — central compute unit
  • ESP32-CAM — camera module for visual evidence capture on anomaly detection
  • DHT22 — temperature and humidity sensor
  • SW-420 — shock/vibration sensor
  • YL-83 — water detection sensor

Agent Architecture

We built four specialized agents registered on Fetch.ai Agentverse, each with a distinct role in the analysis pipeline:

Monitor Agent — ingests raw sensor data every 2 seconds. Computes dynamic baseline statistics and anomaly scores. Classifies overall shipment status. No LLM, pure statistical logic for speed and reliability.

The anomaly score is computed as:

$$z = \frac{x - \mu}{\sigma}$$

Where \( \mu \) and \( \sigma \) are derived from the shipment's own baseline readings, not hardcoded standards.

Narrative Agent — the orchestrator. When triggered, it calls the monitor and prediction agents, combines their outputs with the full sensor context, and passes an enriched context object to the ASI1 LLM. It reasons about multi-sensor correlations, reconstructs physical event sequences, and classifies incidents with competing hypotheses and confidence scores.

Prediction Agent — uses rate-of-change analysis to forecast temperature trajectory:

$$T_{pred} = T_{current} + \frac{\Delta T}{\Delta t} \cdot t_{forecast}$$

Outputs 5, 15, and 30 minute forecasts with risk assessment against user-defined thresholds.

Response Agent — generates structured incident reports with recommended actions when the narrative agent flags a critical incident. Accepts real shipment context including thresholds, sensor readings, and narrative analysis to produce cargo-specific recommendations.

Tech Stack

  • Fetch.ai uAgents — agent framework and Agentverse registration
  • ASI1 — LLM powering the narrative and response agents
  • FastAPI — backend server
  • React — frontend dashboard
  • MongoDB Atlas — chain of custody logging and sensor history
  • ElevenLabs — voice incident report readout
  • ESP32-CAM — visual evidence capture

Dashboard Features

  • Live sensor gauges updating every 500ms from real hardware
  • Agent intelligence panel showing real-time narrative analysis
  • Incident feed with full classification and confidence scores
  • Keyboard-first interaction — every critical action is one keystroke
  • Configurable thresholds per cargo type
  • Chain of custody log with full event history

Challenges We Faced

Getting agents to use real thresholds instead of their own baseline

Our first implementation had agents computing their own baseline from the first 20 readings. If the shipment started warm, the agent thought warm was normal. We redesigned the system so the frontend passes user-configured thresholds directly in every agent query, and agents reason against those values as the primary reference.

Agent communication latency

When the narrative agent queries the monitor and prediction agents before responding, there is inherent latency. We implemented async message passing with a 10 second timeout and graceful fallback so the narrative agent responds even if a downstream agent is slow.

Sensor data format normalization

Our ESP32 sends raw accelerometer data as X, Y, Z components. We compute G-force magnitude:

$$G = \frac{\sqrt{a_x^2 + a_y^2 + a_z^2}}{9.81}$$

This gives a single meaningful shock value regardless of container orientation.

Demo conditions

Real pharmaceutical cold chain operates at 2-8°C. We demoed at room temperature. We solved this by making thresholds fully configurable per cargo type — the same system that monitors insulin at 2-8°C monitors our demo unit at ambient range. This is a feature, not a limitation: Failsafe works for any cargo type.


What We Learned

  • Multi-agent systems are only as good as what you feed them. The prompt engineering and context building around the LLM calls mattered more than the agent infrastructure itself.
  • Dynamic baselines beat hardcoded thresholds for real-world shipping conditions where every journey is different.
  • Hardware doubles your failure surface. Have a software fallback for everything.
  • The Fetch.ai chat protocol is the critical piece that makes agents discoverable on ASI1. Without it your agent exists but nobody can find it.

What's Next

  • Full camera integration — ESP32-CAM capturing visual evidence at the moment of anomaly detection, analyzed by Claude Vision
  • Multi-shipment monitoring — dashboard managing an entire fleet of Failsafe containers simultaneously
  • Carrier integrations — connecting directly to FedEx, UPS, and specialized pharma courier APIs
  • Predictive maintenance — detecting refrigeration unit degradation before failure occurs

Company Challenges

Fetch.ai — Agentverse Search & Discovery

We built a four-agent orchestration system registered on Agentverse and discoverable via ASI:One. Each agent implements the mandatory chat protocol and can be invoked directly through ASI:One by any user or agent on the network.

Agent pipeline:

  • Monitor Agent (@failsafe-sensor-monitor) — real-time sensor analysis and anomaly scoring
  • Narrative Agent (@failsafe-narrative) — orchestrates the other agents and generates intelligent incident assessments
  • Prediction Agent (@failsafe-prediction) — 5, 15, and 30 minute temperature forecasting
  • Response Agent (@failsafe-response) — structured incident reports with recommended actions

ASI:One Demo Sessions:

Agentverse Agent Profiles:


Cognition — Augment the Agent

Failsafe eliminates a category of professional toil that AI agents currently cannot handle, real-world sensor interpretation and logistics compliance documentation.

Before Failsafe, a logistics manager receiving a cold chain alert had to: manually review raw sensor logs, determine root cause, write an FDA deviation report (2-4 hours), notify the receiving pharmacy, contact the insurer, and update the chain of custody — all while under time pressure with compromised cargo.

Failsafe makes AI agents measurably more capable by giving them:

  • Physical world perception — agents that understand what sensor patterns mean in the real world
  • Domain-specific reasoning — multi-sensor correlation analysis that goes beyond threshold detection
  • Structured output generation — incident reports grounded in real sensor data rather than hallucinated details

ElevenLabs — Best Use of ElevenLabs

When Failsafe detects a critical incident, the response agent's findings are read aloud using ElevenLabs text-to-speech. In a real logistics operations center, operators monitoring multiple shipments simultaneously need audio alerts, they cannot always look at a screen.

The voice output is triggered automatically when the narrative agent classifies an incident as ANOMALY or CRITICAL, delivering the classification, confidence score, and recommended action in a calm professional voice.


MongoDB Atlas — Best Use of MongoDB Atlas

Every sensor reading, agent decision, and chain of custody entry is stored in MongoDB Atlas. The database serves three functions:

  • Sensor history — complete time-series record of all readings for pattern analysis
  • Chain of custody — immutable log of every event, agent action, and timestamp for regulatory purposes
  • Shipment configuration — per-shipment threshold settings, cargo type, and route information

MongoDB's flexible document model was ideal for our varied data shapes — sensor readings, agent outputs, and custody entries all have different structures that fit naturally into collections.


Figma Make — Figma Make Challenge

Before writing a single line of frontend code, we used Figma Make to mock up the dashboard layout. We prototyped three different approaches to displaying the agent intelligence panel — a sidebar, a modal, and an inline feed, and eliminated two of them in 45 minutes without touching React.

The mockup gave our frontend developer a clear spec to build against instead of making design decisions while coding, which saved us hours of rework and produced a more intentional UI.


Happy Hacking Keyboard — Type Beyond

In a logistics operations center, operators monitor multiple shipments simultaneously and cannot always take their hands off the keyboard to reach for a mouse. We built Failsafe with keyboard-first interaction as a core design principle.

Every critical action is one keystroke:

Key Action
S Request current status from narrative agent
T Trigger tamper simulation
H Trigger heat/cold chain simulation
R Generate incident report
F Show temperature forecast
A Acknowledge and clear active alert
E Read current report aloud via ElevenLabs
? Show keyboard shortcuts overlay

The keyboard interface transforms Failsafe from a dashboard you watch into a system you operate — eyes on the environment, hands on the keyboard.


Arista Networks — Connect the Dots

Failsafe routes critical shipment data to the right people at the right time. When an anomaly is detected, the system connects:

  • Sensor data from the physical container to the agent network for analysis
  • Agent findings to the logistics manager via dashboard alerts and voice notification
  • Incident reports to the receiving pharmacy with cargo integrity status
  • Chain of custody records to regulatory systems for compliance

The network Failsafe builds around a single shipment — connecting physical sensors, AI agents, logistics operators, receiving facilities, and regulators — is exactly the kind of data routing infrastructure that improves everyday life in supply chains.

Built With

Share this project:

Updates