FlowGuardPre-deployment review for n8n
All reports

Workflow review

ai_email_triage

3 high3 medium
Risk before
69 / 100
Risk after fixes
23 / 100
Findings
6
Fixed automatically
4 / 6

Needs a human decision (2)

FlowGuard could not apply these fixes safely, so the fixed workflow leaves them unchanged.

  1. Classify Email · Extract only the subject line and a truncated plain-text preview (e.g. first 200 characters) before passing to the classifier.
  2. Build Prompt · Strip HTML to plain text and truncate to 500 characters before building the prompt.

Findings

SeverityCategoryNodeIssue and fixStatus
highcostClassify Email

Uses premium model gpt-4 with maxTokens 4096 for a single-label classification task; this is 2–4× more expensive than necessary.

Fix: Switch to gpt-4o-mini (or gpt-3.5-turbo) and cap maxTokens at 20 (only one label is returned).

Fixed
highreliability(workflow)

No errorWorkflow is configured; unhandled runtime errors are silently dropped with no alerting or logging.

Fix: Set settings.errorWorkflow to the shared error-handler workflow ID.

Fixed
highsecurityClassify Email

Full email body (including HTML content, sender address, and thread messages — which may contain PII) is forwarded to an external LLM (gpt-4) without any field selection or redaction.

Fix: Extract only the subject line and a truncated plain-text preview (e.g. first 200 characters) before passing to the classifier.

Manual
mediumcostGmail Trigger

Polling trigger runs every minute, consuming Gmail API quota and incurring n8n execution charges even when no new emails arrive.

Fix: Increase the polling interval to at least 5 minutes, or switch to Gmail push notifications if near-real-time routing is required.

Fixed
mediumcostBuild Prompt

The prompt concatenates the full HTML email body plus all thread message HTML with no truncation; oversized emails will send thousands of input tokens to gpt-4 per classification.

Fix: Strip HTML to plain text and truncate to 500 characters before building the prompt.

Manual
mediumreliabilityRoute by Category

Switch node has no fallbackOutput; if the LLM returns any label other than support/sales/billing/spam (e.g. 'Support' with capitals, or an explanation), the item is silently dropped.

Fix: Set parameters.options.fallbackOutput to an extra output connected to a logging or quarantine node.

Fixed

Fixed workflow

criticalhighmediumlow
flowchart LR
    n0["Gmail Trigger"]
    n1["Build Prompt"]
    n2["Classify Email"]
    n3["Route by Category"]
    n4["Create Zendesk Ticket"]
    n5["Notify Sales"]
    n6["Label Billing"]
    n7["Archive Spam"]
    n8["Unmatched Category"]
    n0 --> n1
    n1 --> n2
    n2 --> n3
    n3 --> n4
    n3 --> n5
    n3 --> n6
    n3 --> n7
    n3 --> n8
    classDef red fill:#fdecea,color:#8a1c12,stroke:#d0402b,stroke-width:1.5px
    classDef orange fill:#fdf0e3,color:#7a3a06,stroke:#d9731a,stroke-width:1.5px
    classDef yellow fill:#fbf5dc,color:#5e4b05,stroke:#b8960f,stroke-width:1.5px
    classDef blue fill:#e8f0fb,color:#153e75,stroke:#3d74c4,stroke-width:1.5px
    classDef clean fill:#f6f7f9,color:#2b3139,stroke:#c3c8cf
    class n0 yellow
    class n1 yellow
    class n2 orange
    class n3 yellow
    class n4 clean
    class n5 clean
    class n6 clean
    class n7 clean
    class n8 clean