Optimize vessel fuel consumption, alerts, and reports with OpenAI and Gmail

Go to Workflow
0 views
Built by Cheng Siong Chin Cheng Siong Chin
Created on August 25, 2026

Description

Quick overview
This workflow ingests vessel telemetry via a webhook, pulls historical performance from an n8n Data Table, and uses OpenAI agents to predict fuel burn, recommend fuel-minimizing speed/RPM settings within ETA and safety constraints, store results, and email alerts and daily fleet reports via Gmail.

How it works
Receives vessel telemetry and voyage constraints in a POST webhook request.
Normalizes and validates the incoming fields (speed, RPM, engine load, fuel burn, and optional weather/current data) and flags unreliable readings.
Retrieves recent records for the same vessel from an n8n Data Table and computes statistical baselines (mean, standard deviation, similar-speed mean, and z-score anomaly).
Uses an OpenAI-powered prediction agent (with optional history lookup) to estimate current fuel consumption and generate candidate fuel predictions for alternative speed/RPM settings.
Uses an OpenAI-powered optimization agent to choose the most fuel-efficient candidate that meets ETA and safety limits and to estimate fuel and CO2 savings.
Uses an OpenAI-powered advisory agent to produce an operator-facing recommendation and determine whether an alert is needed based on anomalies or unreliable data.
Applies deterministic safety guardrails, consolidates and records the final result to the Data Table, responds to the webhook with the recommendation JSON, and sends Gmail alerts for warning/critical cases.
Runs daily on a schedule to aggregate all stored results into a fleet performance HTML report and emails it via Gmail.

Setup
Create or select an n8n Data Table for vessel fuel history/results (matching the columns used by the workflow) and set its Data Table ID in the history lookup, record, and reporting steps.
Add an OpenAI API credential for the Chat model used by the three AI agents.
Add a Gmail OAuth2 credential and replace the placeholder recipient addresses for critical alerts, warning alerts, and the daily fleet report.
Copy the webhook URL for the “vessel-fuel-optimize” endpoint and configure your vessel data source to POST the required telemetry fields (speed_knots, engine_rpm, engine_load_pct, fuel_consumption_lph) plus any optional constraints (eta_required, distance_remaining_nm, max_safe_speed_knots).

Nodes Used (6)

AI Agent
@n8n/n8n-nodes-langchain.agent
Code
n8n-nodes-base.code
Gmail
n8n-nodes-base.gmail
OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi
Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow
Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured