Skip to main content

BLE Toolkit

Bluetooth Low Energy scanning and communication — discover devices, connect, read/write characteristics, and subscribe to notifications. Requires @stoprocent/noble as an optional peer dependency.

Quick Start

import { Agent, ollama } from "@radaros/core";
import { BleToolkit } from "@radaros/edge";

const ble = new BleToolkit({
  scanTimeout: 5000,
  serviceUuidFilter: ["180f"], // Battery Service
});

const agent = new Agent({
  name: "ble-agent",
  model: ollama("llama3.2:1b"),
  instructions: "Discover nearby BLE devices and read their data.",
  tools: [...ble.getTools()],
});

const result = await agent.run("Scan for nearby Bluetooth devices");

Config

scanTimeout
number
default:"5000"
Default scan duration in milliseconds.
serviceUuidFilter
string[]
default:"[]"
Only discover devices advertising these service UUIDs.

Tools

ToolDescription
ble_scanDiscover nearby BLE peripherals
ble_connectConnect to a device by ID
ble_readRead a characteristic value
ble_writeWrite data to a characteristic
ble_notifySubscribe to characteristic notifications

Workflow

  1. Scan for devices with ble_scan
  2. Connect to a device using its ID from the scan results
  3. Read/Write characteristics or subscribe to notifications