import { Agent, ollama } from "@radaros/core";
import {
SystemToolkit,
GpioToolkit,
EdgeRuntime,
edgePreset,
ensureOllama,
registerEdgeToolkits,
} from "@radaros/edge";
// Register edge toolkits in the catalog (for Admin UI)
registerEdgeToolkits();
// Ensure Ollama is running
await ensureOllama();
const preset = edgePreset("pi5-8gb");
const system = new SystemToolkit();
const gpio = new GpioToolkit({ chipNumber: 4, allowedPins: [17, 27, 22] });
const agent = new Agent({
name: "pi-agent",
model: ollama(preset.recommendedModel),
instructions: "You control a Raspberry Pi. Monitor system health and control GPIO pins.",
tools: [...system.getTools(), ...gpio.getTools()],
});
const runtime = new EdgeRuntime({ preset, agent });
await runtime.start();
const result = await agent.run("What is the CPU temperature and memory usage?");
console.log(result.finalOutput);