Robotics
The Robotics API lets you run programmable robot behaviors using simple HTTP calls. Pi orchestrates perception, behavior evaluation, and decision/action dispatch — returning async job envelopes you can poll or react to via SSE.Keep SSE connections alive and implement automatic reconnection. Pi emits real-time
incident, state, action, and log events over the event stream. Reconnect using the same query parameters if the connection drops.Start a robot run
POST /api/v1/robots/run
Queues a perception + behavior + decision job for a robot. Returns 202 Accepted with a job_id.
Request
Body parameters
Unique identifier for the robot. Max 128 characters.
Robot task type. One of
"patrol", "observe", "follow", "approach", "inspect", "custom". Defaults to "patrol".Robot behavior preset. One of
"patrol_security", "warehouse_inspector", "delivery_monitor", "agriculture_scout", "cleaning_robot", "custom".Zone definitions for the run. Each zone includes
name, type ("patrol", "restricted", "waypoint", "boundary", "custom"), frame (coordinate frame, e.g. "map"), and polygon (array of [x, y] pairs, min 3). Max 200 zones.Behavior rules for this run. Supports all surveillance behavior types (
loitering, intrusion, crowd_growth, object_left, perimeter_breach, speed_violation, wrong_direction) plus robot-specific types: patrol, follow_target, approach_on_incident, record_on_incident. Max 100 rules.Action rules triggered on behavior events. Each rule includes
on (behavior type) and do (array of actions). Action types: "alert", "command", "webhook", "noop". Max 200 rules.Perception configuration for this run.
Delivery configuration.
Response (202)
GET /api/v1/jobs/:id for the completed run output, which includes robot_id, task, robot state, incidents, and actions_executed.
Get robot status
GET /api/v1/robots/:id/status
Returns the robot record and current state from the ROS2 bridge sidecar when available.
Path parameters
The robot identifier (same as
robot_id used in the run request).Response fields
The robot identifier.
One of
"offline", "idle", "busy", "error".Battery percentage (0–100) when reported by the ROS2 bridge.
Current position including
frame, x, y, optional z, and heading_deg.Unix timestamp of the last state report.
Send a direct command
POST /api/v1/robots/:id/command
Dispatch a command directly to the robot via the ROS2 bridge sidecar. Useful for manual overrides and emergency stops.
Path parameters
The robot identifier.
Request
Body parameters
The command to dispatch.
Subscribe to robot events (SSE)
GET /api/v1/robots/events
Opens a persistent text/event-stream connection. Pi emits typed robot events in real time.
Consuming SSE events
SSE event shape
UUID of the event.
Always
"robot.event".The robot that emitted the event.
Event type:
"state" (position/battery update), "incident" (behavior trigger), "action" (executed action log), or "log" (free-form message).Unix timestamp.
Present for
type: "state" events. Includes status, battery_pct, position, and last_seen_at.Present for
type: "incident" events. Full incident object matching the surveillance incident schema.Present for
type: "action" events. Includes rule_on, executed (actions dispatched), and errors.Present for
type: "log" events.