Skip to main content

Camera Toolkit

Capture photos, record video clips, and start MJPEG streams using libcamera-still and libcamera-vid. Works with Pi Camera Module 3 on Pi 5 and earlier models. Zero native dependencies — shells out to system commands.

Quick Start

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

const camera = new CameraToolkit({
  width: 1280,
  height: 720,
  rotation: 0,
  format: "jpg",
});

const agent = new Agent({
  name: "camera-agent",
  model: ollama("llama3.2:1b"),
  instructions: "Capture photos when asked. Report file paths.",
  tools: [...camera.getTools()],
});

Config

width
number
default:"1280"
Default image/video width in pixels.
height
number
default:"720"
Default image/video height in pixels.
rotation
number
default:"0"
Image rotation in degrees: 0, 90, 180, or 270.
outputDir
string
default:"/tmp/radaros-camera"
Directory for saved images and videos.
format
string
default:"jpg"
Image format: "jpg" or "png".

Tools

ToolDescription
camera_captureTake a photo (file path or base64)
camera_recordRecord a video clip (up to 60 seconds)
camera_stream_urlStart an MJPEG stream on a local port

Prerequisites

Make sure libcamera-apps is installed on your Pi:
sudo apt install libcamera-apps