The Problem
Fuel is the largest controllable operating cost on a vessel, and the speed/RPM setting that minimizes it changes with load, weather, and ETA constraints: a static "run at X knots" policy leaves savings on the table every voyage that doesn't match the assumptions it was tuned for.
Architecture
Webhook (telemetry) → Validate & Normalize → Historical Baseline (n8n Data Table, z score anomaly check) → Prediction Agent (fuel burn estimate) → Optimization Agent (best speed/RPM within ETA + safety limits) → Advisory Agent (operator recommendation, alert decision) → Safety Guardrails → Record + Respond + Alert → Daily Fleet Report (Gmail)
What It Does
Three specialized agents, not one do everything prompt: prediction, optimization, and advisory are separate OpenAI powered steps, each with a narrow job, which keeps any single prompt's failure mode contained and legible.
Statistical grounding before the AI runs: recent records are pulled from an n8n Data Table to compute mean, standard deviation, and z score anomalies for the same vessel before the agents see the data, so the AI is reasoning over a validated baseline, not raw sensor noise.
Deterministic guardrails after the AI runs: the optimization agent's suggestion still passes through hard coded safety limits (ETA, max safe speed) before it's accepted; the model proposes, the guardrail layer disposes.
Two tier notification: critical/warning anomalies trigger immediate Gmail alerts, while a separate daily job aggregates every stored recommendation into an HTML fleet performance report: different urgency, different channel.
Engineering Focus
The design decision worth studying is where determinism sits relative to the AI: baselines and guardrails are computed in code before and after the model calls, not delegated to the model. That's the difference between "AI-assisted decision support" and "hoping the LLM does arithmetic correctly," and it's the right call for anything safety adjacent.
What I'd Harden
Before trusting this with a real fleet I'd want: schema validation on the incoming webhook payload (malformed telemetry should reject loudly, not silently skew the baseline), a confidence/uncertainty field surfaced alongside every recommendation, and an audit trail linking each accepted recommendation back to the raw telemetry that produced it.
Gallery


