Multi-agent EEG seizure detection: LabVIEW -> n8n (3 Groq agents) -> Google Sheets (open source)

I built an end-to-end pipeline that classifies one-second EEG segments, and the orchestration layer is an n8n workflow. Sharing it in case the structure is useful to others.

How it works

  • A LabVIEW VI computes three features per segment (RMS energy, spectral entropy, dominant frequency) and POSTs JSON to an n8n webhook.
  • A Code node computes a heuristic seizure score.
  • Three AI Agent nodes (Groq, openai/gpt-oss-120b, temperature 0): a classifier with a structured output parser (plus a second model that validates the format), a report writer that gets a Wikipedia extract through an HTTP Request node, and a supervisor with Simple Memory (window of 5) that chooses the action.
  • An If node routes alerts to an email plus a CSV log. Every result is sent to a Google Apps Script web app that appends a row to a Google Sheet, with the written justification.

Things that may help if you build something similar

  • On the Groq free tier I waited 30 s between segments. “Retry On Fail” made quota errors worse (it kept looping), so I turned it off on the agents.
  • Calling the webhook from LabVIEW worked with 127.0.0.1, not localhost (IPv6 resolution problem).
  • Structured output parsers made the agent outputs easy to route.

Results on 50 held-out segments: 98% accuracy, 100% recall, 1 false alarm. For context, the deterministic score alone gets 96% on the same segments, so the pipeline is at least as good, and it adds a written justification and an action for each segment. This is a research and teaching prototype, not a medical device.

Repo (workflow JSON in n8n/workflow.json, credentials and URLs removed): GitHub - Amine-Riahi26-max/eeg-seizure-detection-multi-agent: End-to-end EEG seizure detection: LabVIEW features, n8n multi-agent LLM workflow (Groq), Google Sheets dashboard. 98% accuracy, 100% recall on 50 held-out segments. · GitHub

Feedback welcome, especially on how you would handle a Groq outage (I have no fallback branch yet).

1 Like

With Retry On Fail disabled, how do quota-blocked segments show up in Google Sheets: an explicit blocked row, or no row? That distinction matters when checking which segments actually got classified.

1 Like

Yeah, you’re right, that’s actually a good point. For now, if an agent hits the quota limit, the workflow stops and nothing gets written to the sheet. LabVIEW doesn’t detect it either since the webhook responds before the classification is finished.

In my test, all 50 segments were logged, so everything worked fine, but that doesn’t guarantee it will always work. I’ll add error handling to log blocked segments and use the deterministic score as a fallback when the agents fail. Thanks for pointing that out!

1 Like