Trillboards
Back to Developers
Developer Docs

Edge AI SDK.

On-device audience sensing, federated learning, and kiosk management for any screen running Linux or Windows. Now with MCP integration, Docker deployment, and 15 signal processors.

Overview

The Trillboards Edge AI SDK is a composable, cross-platform TypeScript toolkit that runs at the OS level on Linux and Windows devices. It brings the same audience sensing, federated learning, and ad delivery capabilities as the Android agent to any hardware β€” from LED backpacks to roadside billboards to indoor kiosks.

What It Does

  • Real-time face detection and audience measurement via ONNX Runtime
  • Attention scoring, dwell time tracking, and demographic classification
  • On-device federated learning with Ed25519 VAS attestation
  • Chromium kiosk browser lifecycle management for ad playback
  • Cloud inference integration with Gemini for scene analysis
  • Automatic device health monitoring with multi-level recovery
  • Offline signal buffering with SQLite and batch reconnect flush
  • Cross-platform: identical behavior on Ubuntu, Debian, Windows 10/11
  • Interactive setup wizard, system diagnostics, and live status dashboard via CLI
  • MCP server with 7 tools for AI agent fleet management via Claude, Cursor, or any MCP client
  • Docker deployment (CPU/CUDA/OpenVINO) and Kubernetes Helm chart for fleet orchestration
  • 3x3 screen-zone gaze tracking with creative-zone heatmaps for attention optimization
  • Body pose engagement scoring β€” facing angle, lean detection, approach/depart classification
  • Privacy-first speech intelligence β€” ambient keyword extraction with transcript zeroing
  • HTTP status endpoint with Prometheus metrics on every device (port 9090)

Packages

The SDK is split into 8 composable packages. Install all of them with the umbrella package, or pick only what you need.

PackageDescription
@trillboards/edge-sdkUmbrella package β€” installs everything and exports EdgeAgent
@trillboards/edge-coreDevice identity, Socket.io, heartbeat, config, signal buffer, health registry
@trillboards/edge-sensingCamera/audio capture, ONNX face detection, attention scoring, audience metrics
@trillboards/edge-adsChromium kiosk browser lifecycle, display management, crash recovery
@trillboards/edge-federatedOn-device gradient training, top-k sparsification, Ed25519 VAS attestation
@trillboards/edge-cloudGemini cloud inference for scene analysis, demographics, and content moderation
@trillboards/edge-platform-linuxV4L2 camera, PulseAudio, systemd integration, Linux device identity
@trillboards/edge-platform-windowsDirectShow/RTSP camera, WASAPI audio, Windows Service, registry identity

Quick Start

Installation

Terminal
# Install the full SDK (all packages)
npm install @trillboards/edge-sdk

# Or install only what you need
npm install @trillboards/edge-core @trillboards/edge-sensing

Full Agent (All Features)

agent.ts
import { EdgeAgent } from '@trillboards/edge-sdk';

const agent = new EdgeAgent({
  platform: 'linux',
  deviceToken: 'YOUR_DEVICE_TOKEN',
  screenId: 'screen-001',
  venueType: 'outdoor',
  camera: { enabled: true },
  audio: { enabled: true },
  kiosk: {
    enabled: true,
    url: 'https://screen.trillboards.com',
  },
});

agent.on('started', ({ fingerprint, tier }) => {
  console.log('Agent started:', fingerprint, 'Tier:', tier);
});

agent.on('log', ({ level, message }) => {
  console.log(`[${level}] ${message}`);
});

await agent.start();

Sensing Only (No Kiosk)

Use individual packages for headless deployments where you only need audience sensing without ad playback.

sensing-only.ts
import { DeviceIdentity, SocketManager, SensingConfig, VASWeightConfig } from '@trillboards/edge-core';
import { AudienceSensingService } from '@trillboards/edge-sensing';

// Use edge-core directly for sensing-only deployments
const identity = new DeviceIdentity(platformAdapter);
const fingerprint = await identity.getFingerprint();

const socket = new SocketManager({
  url: 'https://api.trillboards.com',
  fingerprint,
  deviceToken: 'YOUR_TOKEN',
  sensingConfig: new SensingConfig(),
  vasWeightConfig: new VASWeightConfig(),
});

socket.connect();

const sensing = new AudienceSensingService({
  fingerprint,
  socketManager: socket,
  sensingConfig: new SensingConfig(),
  vasWeightConfig: new VASWeightConfig(),
  camera: cameraProvider,
  faceModelPath: './models/blazeface.onnx',
});

await sensing.initialize();
sensing.start();

Configuration

The EdgeAgent accepts a configuration object. Only platform, deviceToken, and screenId are required.

OptionTypeDefaultDescription
platform'linux' | 'windows'requiredTarget platform for adapter loading
deviceTokenstringrequiredDevice authentication token from Partner API
screenIdstringrequiredScreen identifier for backend association
venueTypestringundefinedVenue type (outdoor, indoor, transit, retail)
apiBaseUrlstringapi.trillboards.comBackend API URL
camera.enabledbooleanfalseEnable camera for face detection
camera.deviceIdstring/dev/video0Camera device path or ID
camera.rtspUrlstringundefinedRTSP URL for IP cameras (Windows)
audio.enabledbooleanfalseEnable microphone for audio classification
kiosk.enabledbooleanfalseLaunch Chromium kiosk for ad playback
kiosk.urlstringscreen.trillboards.comURL to load in kiosk browser
federated.enabledbooleanfalseEnable on-device federated learning
models.dirstring./modelsDirectory for ONNX model files
models.executionProviderstringcpuONNX execution provider (cpu, openvino, directml, cuda)
logLevelstringinfoLog level (debug, info, warn, error)

Audience Sensing

The sensing pipeline runs entirely on-device. Camera frames are processed locally through ONNX Runtime β€” no video ever leaves the device.

  • BlazeFace ONNX model for real-time face detection (~400KB)
  • YAMNet ONNX model for ambient audio classification
  • Attention scoring with configurable yaw, pitch, and eye weights
  • Dwell time tracking with multi-face assignment
  • Age, gender, and emotion classification
  • VAS (Verified Audience Signal) computation per aggregation window
  • Observation signal classification for venue context
  • Edge quality telemetry for model performance monitoring

Pipeline Architecture

pipeline
Camera Frame (V4L2 / DirectShow / RTSP)
  β†’ BlazeFace ONNX (face detection)
  β†’ Face Tracking (assignment, dwell time)
  β†’ Attention Scoring (yaw, pitch, eye weights)
  β†’ Age/Gender/Emotion Classification
  β†’ VAS Computation (Verified Audience Signal)
  β†’ Socket.io emission β†’ Backend ingestion

Federated Learning

Train models on-device without sending raw data to the cloud. Gradients are compressed and cryptographically signed before upload.

  • Gradient accumulation buffer with Float32Array precision
  • Top-k sparsification β€” keeps top 10%, 90% bandwidth reduction
  • Ed25519 VAS attestation via Node.js native crypto
  • Model version checking with automatic download and validation
  • Multi-slice context: venue_type x daypart x geo x device_profile
federated.ts
import { FederatedTrainer } from '@trillboards/edge-federated';

const trainer = new FederatedTrainer(machineId, {
  persistenceDir: '/data/trillboards',
});

// Start training with gradient upload callback
trainer.start(async (payload) => {
  socketManager.emitEvent('gradientUpload', payload);
});

Cloud Inference

For capabilities that exceed on-device compute (full scene understanding, detailed demographics), the SDK integrates with Gemini cloud inference.

  • Scene analysis via Gemini Vision β€” demographics, venue context, content moderation
  • Contextual targeting synthesis per aggregation window
  • Conditional calling β€” only triggers when active viewers detected
  • Configurable cadence per device to optimize API costs

Platform Adapters

Platform-specific adapters handle camera, audio, identity, and service management. Install only the adapter for your target OS.

  • @trillboards/edge-platform-linuxβ€” V4L2 camera, PulseAudio, /etc/machine-id fingerprinting, systemd service
  • @trillboards/edge-platform-windowsβ€” DirectShow + RTSP camera, WASAPI audio, registry GUID fingerprinting, Windows Service

Linux Deployment

Terminal
# Install Linux platform adapter
npm install @trillboards/edge-platform-linux

# Deploy as systemd service
sudo cp trillboards-agent.service /etc/systemd/system/
sudo systemctl enable trillboards-agent
sudo systemctl start trillboards-agent

Windows Deployment

Terminal
# Install Windows platform adapter
npm install @trillboards/edge-platform-windows

# Deploy as Windows Service via node-windows
npx trillboards-agent install

Edge SDK vs Connect vs Ads SDK

The Edge SDK operates at the OS level β€” it's a Node.js process that manages hardware, ML inference, and the kiosk browser. Connect and Ads SDK run inside the browser.

CapabilityEdge SDKConnectAds SDK
RuntimeNode.js (OS-level)BrowserBrowser
Camera accessV4L2 / DirectShow / RTSPNoNo
Face detectionOn-device ONNXNoNo
Audio classificationOn-device ONNXNoNo
Federated learningYesNoNo
Ad playbackVia kiosk browserBuilt-inBuilt-in
Offline cachingSQLite signal bufferIndexedDBIndexedDB
Device health monitoring6-level recovery ladderNoNo
Platform supportLinux, WindowsAny browserAny browser
Best forHardware with cameras/sensorsQuick web embedCustom React/Node apps

AI Agent Integration

The Edge SDK includes an MCP (Model Context Protocol) server with 7 tools for managing DOOH device fleets from Claude Desktop, Cursor, or any MCP-compatible AI assistant. Point your agent at a fleet of screens and manage deployments, diagnostics, and telemetry conversationally.

MCP Configuration

claude_desktop_config.json
{
  "mcpServers": {
    "trillboards-edge": {
      "command": "npx",
      "args": ["-y", "@trillboards/edge-sdk", "mcp"],
      "env": {
        "TRILLBOARDS_API_KEY": "your_key",
        "FLEET_ENDPOINT": "https://api.trillboards.com"
      }
    }
  }
}

Available Tools

ToolDescription
fleet_statusList all devices with online/offline state, uptime, and last heartbeat
device_diagnosticsCPU, memory, GPU temp, camera FPS, model inference latency for a device
deploy_modelPush an ONNX model update to one device or an entire fleet
get_audience_snapshotReal-time face count, attention score, and demographic breakdown
update_configChange sensing, kiosk, or federated learning config on a running device
tail_logsStream recent logs from a device filtered by level (debug/info/warn/error)
restart_serviceRestart the edge agent, kiosk browser, or sensing pipeline on a device

Need Help?

Contact our developer support at developers@trillboards.com or visit the Support page.

Deploy Edge AI on any screen.

npm install, configure, run. Full audience sensing and ad delivery on your hardware.