Cloud
Buddy AI

Buddy AI — Live Neural Copilot

Buddy AI is the unified EEG and BCI copilot built directly into PiEEG Cloud (opens in a new tab). It combines the browser-native neural cascade from Buddy, the turn-based pattern training, Lab Notebook sessions, Jupyter notebook export, and dashboard actuators from PiEEG Agent, and grounded documentation retrieval (docs.pieeg.com) into a single right-hand drawer inside the dashboard.

Press C (or click Buddy AI in the dashboard header/sidebar) on any live hardware, Web Bluetooth, Web Serial, or simulated stream at cloud.pieeg.com (opens in a new tab) to open the copilot.

Buddy AI works out of the box with zero configuration using PiEEG Cloud AI (Turnkey), supports Bring Your Own Key (BYOK) for cloud and local LLMs (Ollama, LM Studio), and includes an offline Built-in Neural Analyst fallback that executes real tools on your live EEG and documentation without any network calls.

Getting started

Connect a board or start a demo at cloud.pieeg.com

Open cloud.pieeg.com (opens in a new tab) in a Chromium browser and pick any source in the Session Lobby:

  • PiEEG Devices: IronBCI (8/16 ch BLE), PiEEG XR (8/16 ch BLE), Octopus 16 (BLE), Aura VR (8-ch EMG + IMU), IronBCI-32 (USB Serial), or Kraken-48 (USB Serial).
  • BrainFlow Devices: 19 third-party WebBLE and WebSerial boards.
  • PiEEG Server WebSocket: ws://localhost:1616 or a remote relay.
  • Simulated / Programmable Demo: 8, 16, 32 channels, Aura, or /mock studio — no hardware required.

Open the Buddy AI drawer

Click Buddy AI in the dashboard or press C. The drawer has three tabs:

  • 💬 Copilot Chat — natural-language Q&A, guided pattern training, one-click prompt suggestions, and inline Jupyter .ipynb downloads.
  • 🧠 Brain & Patterns — live neural state meters, band powers, per-channel quality grid, trained pattern detectors, Lab Notebook sessions, connectivity, and recent artifacts.
  • ⚙ Model — switch between Turnkey Cloud AI, BYOK providers, local Ollama / LM Studio, or the offline Built-in Neural Analyst, and toggle optional voice read-aloud (TTS) or webcam artifact tracking.

Ask, train, or control

Click a suggestion chip (for example "What is my brain doing right now?" or "Let's train a new pattern together") or type your own question. Buddy AI calls live tools against CloudNeuralEngine, shows each tool call inline, and streams its grounded answer.

Live Brain & Patterns tab

Buddy AI continuously distills the multichannel ring buffer inside your browser (CloudNeuralEngine) into structured, language-sized summaries:

CardWhat it shows
Live Neural StateSmoothed focus / relax / engagement indices (0–1, within-session relative), dominant band, overall signal quality, bad_channels, and a warming_up badge while baseline variance settles.
Frequency BandsRelative Delta (δ), Theta (θ), Alpha (α), Beta (β), and Gamma (γ) power, plus a one-click Deep Spectrum → shortcut for IAF and 1/f slope analysis.
Trainable Pattern DetectorsLive activation probabilities (0–100%) for your trained classifiers, with leave-one-rep-out cross-validated balanced accuracy (CV), Explain, and + Train Pattern controls.
Lab Notebook SessionsSaved experimental windows (for example eyes-closed-rest vs. mental-math) with one-click Analyze and Compare (Cohen's d) actions.
Channel Signal QualityPer-channel status (good, flat, rail, noisy, line), RMS in µV, and 50/60 Hz mains line-noise ratio.
Functional ConnectivityCross-channel amplitude coupling (Pearson r over log band-power envelopes), strongest electrode pairs, and mean coupling.
Recent ArtifactsReal-time time-domain transient log: single/double eye blinks, jaw clenches, and motion spikes, plus optional MediaPipe webcam face/blink context.

Perception cascade

To bridge the rate mismatch between EEG (250–500 Hz) and LLM reasoning (~1 Hz), Buddy AI runs a 5-tier perception cascade in the browser. The model pulls compact summaries via tools on demand and is never sent raw EEG waveforms:

TierRateRepresentationLLM sees
T0 Raw250–500 HzFloat32 µV samples in browser ring bufferNever
T1 Features~4–8 HzPer-channel log band powers, RMS, line-length, qualityVia tools
T2 State~1 HzSmoothed focus / relax / engagement, dominant bandVia tools
T3 EventsSparseDebounced state transitions, blinks, clenches, pattern hitsVia tools
T4 ReasonOn queryMulti-turn tool-calling loop + docs RAG + actuatorsCompact JSON tool outputs

Complete toolset (22 tools)

Buddy AI grounds every claim about your signal or hardware in a fresh tool call:

1. Live neural senses

ToolDescription
get_neural_stateCurrent smoothed focus, relax, and engagement indices (0–1, within-session), dominant band, relative band powers, signal quality, bad_channels, and warming_up.
get_band_powersRelative EEG band powers (Delta, Theta, Alpha, Beta, Gamma) averaged across channels, plus per-channel breakdown in µV²/Hz.
analyze_spectrumDeeper spectral analysis: individual alpha-peak frequency (IAF), aperiodic 1/f exponent & offset, theta/beta ratio, spectral entropy, and frontal alpha asymmetry (channel-average or single channel).
find_artifactsRecent discrete time-domain transients (blink, blink_double, jaw_clench, motion).
get_recent_eventsRecent debounced neural state transitions and signal-quality drops/recoveries.
get_channel_qualityPer-channel verdicts (good, flat, rail, noisy, line) with RMS (µV), 50/60 Hz line-noise ratio, and 0–1 score.
connectivityCross-channel functional connectivity (Pearson r over log band-power envelopes) for any band (Delta–Gamma) and window (2–30 s).
get_video_contextReads optional in-browser MediaPipe webcam face/artifact tracking (blinks, head motion, jaw movement) when enabled by the user.

2. Trainable patterns & Lab Notebook sessions

ToolDescription
list_patternsLists all trained pattern detectors saved in the browser with their leave-one-rep-out cross-validated balanced accuracy.
detect_patternsChecks which trained patterns are firing right now, with smoothed 0–1 probabilities.
explain_patternExplains a pattern detector: threshold, LORO-CV balanced accuracy, per-channel importance, and top separating features (Cohen's d).
forget_patternDeletes a trained pattern detector from live memory and localStorage.
start_pattern_trainingStarts teaching a new pattern detector by example (e.g. eyes-closed, mental-math, jaw-clench).
record_segmentRecords one labelled segment (rest or active, 1–15 s) from the live stream. Enforces at most one segment per turn so you have time to switch mental states.
finish_pattern_trainingFits the L2 + group-lasso logistic classifier across recorded reps, cross-validates by rep (LORO-CV), saves to localStorage, and starts live scoring.
cancel_pattern_trainingCancels an in-progress pattern training session without saving.
record_sessionRecords a labelled Lab Notebook session window (2–60 s) and saves its spectral, state, quality, and connectivity summary.
list_sessionsLists all saved Lab Notebook session summaries in the browser.
analyze_sessionLoads the full statistical summary of a saved Lab Notebook session by label.
compare_sessionsContrasts two saved sessions (a vs b) using within-session Cohen's d effect sizes across bands, state indices, and quality.
forget_sessionDeletes a saved Lab Notebook session summary.

3. PiEEG documentation RAG, scientific literature & Jupyter notebooks

ToolDescription
search_docsSearches the indexed PiEEG documentation corpus (/pieeg-docs-index.json) for hardware specs, ADS1299 registers, 10-20 electrode placement, noise elimination, Web Bluetooth, Local Bridge, and LSL, returning grounded excerpts with docs.pieeg.com citations.
search_webSearches Wikipedia or NCBI PubMed directly from the browser for neuroscience, EEG rhythms, ERPs (P300, SSVEP), and BCI research literature.
create_notebookGenerates a downloadable .ipynb Jupyter Notebook preloaded with the live EEG snapshot, channel metadata, and custom Markdown + Python analysis/plotting cells.

4. Dashboard inspection & control (actuators)

ToolDescription
get_dashboard_statusReads the active PiEEG Cloud dashboard state: bandpass and 50/60 Hz notch filter settings, spike rejection, CSV recording status, visible analysis panels, sample rate, and channel count.
control_dashboardExecutes safe UI actions on the live dashboard: set_bandpass, toggle_bandpass, set_notch, toggle_notch, start_recording, stop_recording, pause_stream, resume_stream, toggle_panel (fft, spectrogram, stats, mental_state), or navigate (dashboard, calibration, lab, wellness, experiences, library).

Model providers (Turnkey, BYOK & Offline)

Configure your preferred model in the ⚙ Model tab of the Buddy AI drawer:

ProviderModeAPI Key RequiredDefault ModelHow it connects
PiEEG Cloud AI (Turnkey)DefaultNoclaude-haiku-4-5Streams through the stateless /api/agent/chat Vercel Edge proxy (falls back automatically to the Built-in Neural Analyst if offline).
Anthropic (BYOK)Cloud BYOKYesclaude-sonnet-4-6Direct browser SSE to api.anthropic.com
OpenAI (BYOK)Cloud BYOKYesgpt-4o-miniDirect browser SSE to api.openai.com
Groq (BYOK)Cloud BYOKYesllama-3.3-70b-versatileDirect browser SSE to api.groq.com
Together AI (BYOK)Cloud BYOKYesLlama-3.3-70B-Instruct-TurboDirect browser SSE to api.together.xyz
OpenRouter (BYOK)Cloud BYOKYesanthropic/claude-3.5-haikuDirect browser SSE to openrouter.ai
Ollama (Local)LocalNollama3.1Direct to http://localhost:11434/v1
LM Studio (Local)LocalNolocal-modelDirect to http://localhost:1234/v1
Custom OpenAI EndpointCustomOptionalgpt-4o-miniAny OpenAI-compatible /v1/chat/completions URL
Built-in Neural Analyst100% OfflineNopieeg-analyst-v1Runs locally in the browser; executes real tools on live EEG & docs and formats a grounded Markdown report with zero network traffic.

Guided pattern training

Buddy AI trains personalized classifiers for any mental, visual, or motor state you can reproduce (for example eyes-closed, meditation, mental-math, or jaw-clench):

  1. Contrastive reps: You record alternating rest (baseline) and active segments (4 seconds each across 3–5 reps), either via the + Train Pattern modal in the Brain & Patterns tab or step-by-step in chat (where quick-action buttons appear automatically for each rep).
  2. Spatial group-lasso + L2 logistic classifier: Extracts per-channel log band powers (logDelta..logGamma), logRMS, and logLineLength, encouraging spatial sparsity across electrodes.
  3. Honest cross-validation: Evaluated with Leave-One-Rep-Out Cross-Validation (LORO-CV) and balanced accuracy so temporal autocorrelation and class imbalance cannot inflate scores.
  4. Channel importance: explain_pattern reports per-channel weights and top Cohen's d features so you can verify whether a detector reads occipital alpha (O1/O2) or frontal muscle artifacts (Fp1/Fp2).
⚠️

Buddy AI is a neuroscience research and engineering tool — not a medical device. All focus, relax, and engagement indices are normalized within the current session ("high or low for you right now"), never clinical or diagnostic measures.

Privacy & data handling

Buddy AI follows PiEEG Cloud's browser-first privacy model (see the full Privacy Page (opens in a new tab)):

  • Raw EEG never leaves your device: Signal acquisition, DSP filtering, FFTs, artifact detection, connectivity, pattern training, and Lab Notebook session recording run 100% locally in your browser tab. Raw waveforms are never sent to any AI model.
  • Compact numerical tool summaries only: When you chat with an LLM, only your conversation messages and the compact JSON summaries returned by tools (such as band-power ratios, channel quality scores, or artifact counts) are included in the prompt context.
  • Stateless Turnkey proxy: When using PiEEG Cloud AI (Turnkey), chat requests are forwarded through our stateless Vercel Edge proxy (/api/agent/chat) to Anthropic to stream the response. PiEEG does not log, store, or inspect your prompts, neural summaries, or responses.
  • Direct BYOK: When you provide your own API key, requests go directly from your browser to your selected provider. Your API key is stored only in your browser's localStorage (if you keep Remember key in this browser enabled) and is never transmitted to PiEEG servers.
  • 100% local & offline options: Selecting Ollama, LM Studio, or the Built-in Neural Analyst (Offline) keeps all prompts and tool summaries entirely on your machine.
  • Local webcam & local storage: Optional webcam artifact tracking runs locally via in-browser MediaPipe WASM/WebGL (video frames never leave your device). Conversations, trained patterns, and Lab Notebook sessions persist only in your browser's localStorage and can be deleted at any time.

Buddy AI (Cloud) vs. PiEEG Agent (Python CLI / MCP)

Buddy AI in PiEEG Cloud (opens in a new tab)PiEEG Agent (Python CLI & MCP)
Runtime100% in-browser at cloud.pieeg.comLocal Python process + pieeg-server --lsl
InstallNone (open in Chrome / Edge)pip / one-line installer
Hardware sourcesWeb Bluetooth, Web Serial, 19 BrainFlow boards, pieeg-server WS, SimulatedLab Streaming Layer (LSL) streams
Default AITurnkey Cloud AI (no key needed) + BYOK + Offline Built-in AnalystBYOK (ANTHROPIC_API_KEY, OPENAI_API_KEY, Ollama, etc.)
Senses & toolsState, spectrum (IAF, 1/f), artifacts, webcam context, connectivity, patterns, Lab Notebook sessions, PiEEG docs RAG, PubMed/Wikipedia, .ipynb export, dashboard actuatorsState, spectrum, artifacts, connectivity, patterns, sessions, .ipynb export, server actuators
External MCP hostBuilt-in browser drawerpieeg-agent mcp serves tools to Claude Desktop, Cursor, VS Code Copilot, Codex

Next steps