API Reference

Main entry points of our API: reli.build_system() and reli.ReLIAgent. The remaining modules can also be used on their own, for example the action catalogue to validate plans, or the geometry functions in perception experiments.

System and agent

reli.runtime.build_system(cfg, on_event=<function <lambda>>, provider=None)[source]
Parameters:
Return type:

System

class reli.runtime.System(agent: 'ReLIAgent', robot: 'Robot', camera: 'Camera | None', grounder: 'Grounder | None', connection: 'object | None')[source]
Parameters:
  • agent (ReLIAgent)

  • robot (Robot)

  • camera (Camera | None)

  • grounder (Grounder | None)

  • connection (object | None)

class reli.agent.ReLIAgent(cfg, robot, provider, grounder=None, on_event=<function ReLIAgent.<lambda>>, log_dir=None)[source]
Parameters:
handle(text, language=None)[source]

Process one user utterance synchronously. language (BCP-47) fixes the language for this turn, as when the user selects it in the interface.

Parameters:
  • text (str)

  • language (str | None)

Return type:

TurnResult

emergency_stop()[source]

Stop immediately, cancel the running plan and any plan awaiting consent.

Return type:

None

class reli.agent.TurnResult(turn_id: 'int', text: 'str', language: 'str', plan: 'Plan | None' = None, primitives: 'list[Action]' = <factory>, safety: 'SafetyReport | None' = None, outcome: 'str' = '', responses: 'list[str]' = <factory>)[source]
Parameters:
  • turn_id (int)

  • text (str)

  • language (str)

  • plan (Plan | None)

  • primitives (list[Action])

  • safety (SafetyReport | None)

  • outcome (str)

  • responses (list[str])

class reli.types.Event(kind, text='', language='en', data=None, turn_id=None)[source]

Something the agent wants to tell the outside world.

kind: response (text for the user), image (BGR array in data), status (structured progress in data) or plan (parsed plan).

Parameters:
  • kind (str)

  • text (str)

  • language (str)

  • data (Any)

  • turn_id (int | None)

class reli.types.Pose2D(x=0.0, y=0.0, yaw=0.0)[source]

Planar pose in the map frame. yaw is in radians, counter-clockwise.

Parameters:
  • x (float)

  • y (float)

  • yaw (float)

bearing_to(x, y)[source]

Heading change (rad) needed to face (x, y).

Parameters:
  • x (float)

  • y (float)

Return type:

float

class reli.types.Action(name, params=<factory>)[source]

One validated step: a catalogue name and its typed parameters.

Parameters:
  • name (str)

  • params (dict[str, Any])

Configuration

class reli.config.ReLIConfig(*, robot=RobotConfig(name='ReLI robot', description='', backend='sim', limits=MotionLimits(linear_speed_default=0.2, linear_speed_min=0.05, linear_speed_max=1.0, angular_speed_default_deg=30.0, angular_speed_max_deg=90.0, linear_accel=0.5, angular_accel_deg=120.0), control=ControlSettings(rate_hz=20.0, goal_tolerance_m=0.2, timeout_factor=2.0, navigation_timeout_s=300.0, heading_gain=2.0, min_angular_speed_deg=5.0), sim=SimSettings(realtime_factor=1.0, start_pose=Pose2DConfig(x=0.0, y=0.0, yaw_deg=0.0), objects=[], fov_deg=70.0, max_range_m=8.0), rosbridge=RosbridgeSettings(host='localhost', port=9090, ros_version=1, topics=RosTopics(cmd_vel='/cmd_vel', odom='/odom', pose='/amcl_pose', color='/camera/color/image_raw/compressed', depth='/camera/aligned_depth_to_color/image_raw', camera_info='/camera/color/camera_info', input='/reli/input', response='/reli/response', tts='/reli/tts', image='/reli/image/compressed', emergency_stop='/reli/emergency_stop'), cmd_vel_stamped=False, base_frame='base_link', map_frame='map', navigation_action=None, depth_throttle_ms=300, connect_timeout_s=10.0)), language=LanguageConfig(fixed=None, default='en'), llm=LLMConfig(provider='openai', model='gpt-5.4-mini', base_url=None, api_key_env=None, max_output_tokens=1024, temperature=0.0, timeout_s=60.0, retries=2, structured_output='auto', history_turns=6, attach_image=False, request_options={}), planning=PlanningConfig(max_repair_attempts=1), consent=ConsentConfig(policy='multi_step', timeout_s=120.0, method='llm', embedding_model='sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2', margin=0.05, positive_phrases=['yes', 'y', 'ok', 'okay', 'sure', 'go ahead', 'do it', 'proceed', 'confirm', 'ja', 'oui', 'sí', 'si', 'sim', 'da', 'tak', 'evet', 'hai', '是', '好', 'はい', 'ndiyo', 'ee', 'bẹẹni', 'haan', 'हाँ', 'نعم'], negative_phrases=['no', 'n', 'nope', 'cancel', 'abort', "don't", 'do not', 'stop', 'nein', 'non', 'não', 'nie', 'hayır', 'iie', '不', '不要', 'いいえ', 'hapana', 'rara', 'nahin', 'नहीं', 'لا', 'mba']), safety=SafetyConfig(enabled=True, on_violation='reject', allowed_actions=None, max_distance_m=10.0, max_turn_deg=720.0, max_wait_s=300.0, max_plan_steps=40, min_clearance_m=0.3, workspace=None, rollout_step_m=0.1, stop_phrases=['stop', 'halt', 'emergency stop', 'stopp', 'arrête', 'arrete', 'para', 'pare', 'fermati', 'alto', 'stój', 'dur', '停', '停下', '停止', '止まれ', 'ストップ', 'simama', 'kwụsị', 'توقف', 'रुको']), perception=PerceptionConfig(enabled=True, detector='sam3', model=None, device='auto', score_threshold=0.4, mask_threshold=0.5, max_detections=20, mask_quality_threshold=0.4, vocabulary=['person', 'chair', 'table', 'desk', 'door', 'monitor', 'laptop', 'cup', 'bottle', 'sofa', 'bookshelf', 'trash bin', 'plant', 'backpack'], verifier=VerifierConfig(model=None, temperature=None, energy_threshold=None, crop_margin=0.1), degradation=DegradationConfig(beta=1.0, reference_luma=0.35, reference_sharpness=100.0), depth=DepthConfig(min_m=0.2, max_m=10.0, window_px=7, monocular_model='depth-anything/Depth-Anything-V2-Metric-Indoor-Small-hf'), tracking=TrackingConfig(gate_m=0.6, ttl_s=300.0, process_noise=0.01, noise_base_m=0.03, noise_per_m2=0.01), search=SearchConfig(enabled=True, step_deg=60.0, max_deg=360.0), approach_distance_m=0.6), camera=CameraConfig(source='none', webcam_index=0, intrinsics=None, hfov_deg=69.0, extrinsics=Extrinsics(x=0.0, y=0.0, z=0.0, roll_deg=0.0, pitch_deg=0.0, yaw_deg=0.0), realsense=RealSenseSettings(width=640, height=480, fps=30)), destinations=<factory>, speech=SpeechConfig(backend='browser', model='large-v3-turbo', device='auto', compute_type='default'), web=WebConfig(host='127.0.0.1', port=8080, video_fps=10.0, jpeg_quality=80, overlay_detections=True, detection_refresh_hz=1.0), logging=LoggingConfig(level='INFO', dir='runs', cache_translations=True), prompts_file=None, base_dir=<factory>)[source]
Parameters:
  • robot (RobotConfig)

  • language (LanguageConfig)

  • llm (LLMConfig)

  • planning (PlanningConfig)

  • consent (ConsentConfig)

  • safety (SafetyConfig)

  • perception (PerceptionConfig)

  • camera (CameraConfig)

  • destinations (dict[str, Destination])

  • speech (SpeechConfig)

  • web (WebConfig)

  • logging (LoggingConfig)

  • prompts_file (str | None)

  • base_dir (Path)

classmethod load(path)[source]

Load a YAML file, or a bundled example by name (sim, romr_ros1, …).

extends: other.yaml in a file merges it over a base file.

Parameters:

path (str | Path)

Return type:

ReLIConfig

The full list of options is in Configuration.

Planning (language to action)

Language-to-action decision and parsing.

One model call maps the user’s utterance c (any language) together with the robot’s context (pose, destinations, recently seen objects, optional camera frame) to a turn {language, intent, reply, actions}:

  • language updates the session language state l (skipped when the user fixed the language);

  • intent is the high-level interpretation r in R_int;

  • actions are the k steps a_1..a_k, constrained to the action catalogue by schema-guided decoding and validated afterwards.

Invalid output is sent back to the model once with the validator’s exact error messages (self-repair) before the user is asked to rephrase.

class reli.planner.Planner(cfg, provider, prompts, catalog)[source]
Parameters:
plan(text, ctx, history=())[source]

Interpret text. Raises LLMError if the provider is unreachable.

Parameters:
Return type:

Plan

class reli.planner.PlanningContext(pose: 'Pose2D', language: 'str', fixed_language: 'str | None' = None, scene: 'Sequence[str]' = (), image_jpeg: 'bytes | None' = None, has_navigation: 'bool' = True)[source]
Parameters:
  • pose (Pose2D)

  • language (str)

  • fixed_language (str | None)

  • scene (Sequence[str])

  • image_jpeg (bytes | None)

  • has_navigation (bool)

class reli.planner.Plan(language: 'str', intent: 'str', reply: 'str', actions: 'list[Action]' = <factory>, errors: 'list[str]' = <factory>, raw: 'str' = '', latency_s: 'float' = 0.0, repaired: 'bool' = False)[source]
Parameters:
  • language (str)

  • intent (str)

  • reply (str)

  • actions (list[Action])

  • errors (list[str])

  • raw (str)

  • latency_s (float)

  • repaired (bool)

Actions

Action catalogue.

The catalogue defines what the robot can do. It provides (i) the JSON schema used for decoding, (ii) the catalogue text shown to the model, and (iii) the validator applied to every model output.

expand is the rule-based parser P: the k high-level steps chosen by the model become n >= k executable primitives, e.g. a POLYGON becomes alternating MOVE/TURN steps.

class reli.actions.Catalog(capabilities=(), destinations=(), allowed=None)[source]

The actions available in a given deployment (capabilities + destinations).

Parameters:
  • capabilities (Iterable[str])

  • destinations (Sequence[str])

  • allowed (Iterable[str] | None)

turn_schema()[source]

Strict JSON schema for one dialogue turn (OpenAI strict-mode compatible).

Return type:

dict

describe()[source]

Human-readable catalogue for the system prompt.

Return type:

str

validate(raw_actions, fill_defaults=True)[source]

Validate model output. Returns (actions, errors); invalid items are dropped.

With fill_defaults=False only the parameters that were given are kept (used for reference plans, whose unstated parameters are not compared).

Parameters:
  • raw_actions (Any)

  • fill_defaults (bool)

Return type:

tuple[list[Action], list[str]]

reli.actions.expand(actions)[source]

Rule-based parser P (paper Eq. 4): k model steps -> n >= k primitives.

Parameters:

actions (Sequence[Action])

Return type:

list[Action]

reli.actions.is_motion(actions)[source]

True if any step commands base motion.

Parameters:

actions (Iterable[Action])

Return type:

bool

Execution and robots

class reli.executor.Executor(cfg, robot, grounder, guard)[source]
Parameters:
submit(actions, reporter=None, on_done=<function Executor.<lambda>>)[source]

Run actions in the background (motion plans preempt each other).

Parameters:
  • actions (Sequence[Action])

  • reporter (Reporter | None)

  • on_done (Callable[[ExecutionReport], None])

Return type:

None

run(actions, cancel=None, reporter=None)[source]

Execute synchronously; returns a report (also used by the evaluator).

Parameters:
  • actions (Sequence[Action])

  • cancel (Event | None)

  • reporter (Reporter | None)

Return type:

ExecutionReport

class reli.executor.Reporter[source]

Receives everything a job wants to tell the user. The default is silent.

say(key, **values)[source]

Catalogue message key (rendered in the user’s language by the agent).

Parameters:

key (str)

Return type:

None

speak(text)[source]

Free text that is already in the user’s language.

Parameters:

text (str)

Return type:

None

image(image)[source]

A camera image (BGR) for the user.

Parameters:

image (ndarray)

Return type:

None

status(data)[source]

Structured progress information.

Parameters:

data (dict)

Return type:

None

narrate(evidence, image)[source]

Describe the scene in the user’s language, or None to fall back to a list.

Parameters:
  • evidence (list[str])

  • image (ndarray | None)

Return type:

str | None

class reli.robot.base.Robot(limits, control)[source]

Base class. Subclasses implement pose, _command and optionally odometry, _sleep, navigate_to and close.

Parameters:
  • limits (MotionLimits)

  • control (ControlSettings)

abstractmethod pose()[source]

Pose in the map frame (used for reporting and global goals).

Return type:

Pose2D

odometry()[source]

Smooth, locally consistent pose used to close motion loops.

Return type:

Pose2D

close()[source]

Release connections.

Return type:

None

stop()[source]

Emergency stop: interrupts any running primitive and zeroes velocity.

Return type:

None

move(distance, speed, cancel=None)[source]

Drive distance metres along the current heading (negative = backward).

Parameters:
  • distance (float)

  • speed (float)

  • cancel (Event | None)

Return type:

MotionResult

turn(angle, angular_speed, cancel=None)[source]

Rotate in place by angle radians (positive = counter-clockwise).

Parameters:
  • angle (float)

  • angular_speed (float)

  • cancel (Event | None)

Return type:

MotionResult

arc(radius, angle, speed, left, cancel=None)[source]

Drive along a circle of radius m sweeping angle rad.

Parameters:
  • radius (float)

  • angle (float)

  • speed (float)

  • left (bool)

  • cancel (Event | None)

Return type:

MotionResult

face(x, y, angular_speed, cancel=None)[source]

Turn towards a map point.

Parameters:
  • x (float)

  • y (float)

  • angular_speed (float)

  • cancel (Event | None)

Return type:

MotionResult

navigate_to(x, y, yaw, speed, cancel=None)[source]

Reach a map goal. Default: face the goal, drive with heading correction, then align to yaw. Robots with a navigation stack override this to get global planning and obstacle avoidance.

Parameters:
  • x (float)

  • y (float)

  • yaw (float | None)

  • speed (float)

  • cancel (Event | None)

Return type:

MotionResult

class reli.robot.base.MotionResult(success: 'bool', reason: 'str' = '', reported: 'bool' = False)[source]
Parameters:
  • success (bool)

  • reason (str)

  • reported (bool)

class reli.robot.sim.SimRobot(cfg)[source]
Parameters:

cfg (RobotConfig)

class reli.robot.rosbridge.RosbridgeRobot(cfg, conn)[source]
Parameters:
  • cfg (RobotConfig)

  • conn (RosbridgeConnection)

class reli.robot.rosbridge.RosbridgeCamera(cfg, conn)[source]
Parameters:
  • cfg (CameraConfig)

  • conn (RosbridgeConnection)

class reli.robot.rosbridge.RosbridgeIO(conn, on_text, on_stop)[source]

ReLI’s text interface on ROS topics: input, response, TTS, image, e-stop.

Parameters:
  • conn (RosbridgeConnection)

  • on_text (Callable[[str], None])

  • on_stop (Callable[[], None])

Perception

Visuo-lingual grounding pipeline.

camera frame ──► open-vocabulary proposals (SAM 3 / Grounding DINO / OWLv2 / YOLO-World)

──► mask-quality filter Q(M_i) >= tau_q ──► degradation weight Theta_i (low light, blur, truncation) ──► optional dual-encoder verification p(d_j | M_i), energy ──► target selection o* ──► depth (sensor, or monocular metric depth) ──► back-projection, camera -> base -> map, Kalman scene memory

class reli.perception.base.Grounder[source]

Visual grounding of language references, with a short-term scene memory.

abstractmethod observe(queries=None)[source]

Detect queries (or the configured vocabulary) in the current view.

Parameters:

queries (list[str] | None)

Return type:

Observation

abstractmethod locate(query)[source]

Best match for query in view, else from recent memory, else None.

Parameters:

query (str)

Return type:

GroundedObject | None

abstractmethod remembered(query=None)[source]

Objects in scene memory (optionally only those matching query).

Parameters:

query (str | None)

Return type:

list[GroundedObject]

frame()[source]

Latest camera frame (BGR), if there is a camera.

Return type:

ndarray | None

class reli.perception.base.GroundedObject(label, score, box=None, mask=None, position=None, radius_m=None, range_m=None, bearing_rad=None, source='camera', age_s=0.0, evidence=<factory>)[source]

A region tied to a label, with evidence scores and (if known) 3-D position.

Parameters:
  • label (str)

  • score (float)

  • box (tuple[float, float, float, float] | None)

  • mask (ndarray | None)

  • position (ndarray | None)

  • radius_m (float | None)

  • range_m (float | None)

  • bearing_rad (float | None)

  • source (str)

  • age_s (float)

  • evidence (dict)

class reli.perception.grounder.VisionGrounder(cfg, camera, pose, detector, verifier=None, monocular=None, memory=None)[source]
Parameters:
  • cfg (ReLIConfig)

  • camera (Camera)

  • pose (Callable[[], Pose2D])

  • detector (Detector)

  • verifier (DualEncoderVerifier | None)

  • monocular (MonocularDepth | None)

  • memory (SceneMemory | None)

class reli.perception.grounder.SimGrounder(cfg, pose, memory=None)[source]

Ground-truth perception for the simulator: objects from robot.sim.objects are visible inside the configured field of view and range.

Parameters:
reli.perception.detectors.build_detector(cfg)[source]
Parameters:

cfg (PerceptionConfig)

Return type:

Detector

Vision-language verification and target selection.

Each candidate region M_i is embedded with a dual encoder (CLIP, SigLIP 2, …) after masking out its background, and compared with the label set {d_j}:

S_ij = cos(V_i, t_j) p(d_j|M_i) = softmax_j(tau * S_ij) E(M_i) = -log sum_j exp(tau * S_ij) (energy; reject if > tau_e) Theta_i = exp(-beta * ||Omega_i||) o* = argmax_i Theta_i * c_i * max_j p(d_j|M_i) * sim(d_j, c)

with c_i the detector’s own score and sim(d_j, c) the text similarity between a label and the user’s reference. Theta_i depends only on the region, so it acts as a per-region confidence factor in Eq. 9 (renormalising p * Theta over the labels would cancel it): degraded regions rank below clean ones.

reli.perception.verifier.select_scores(probs, label_sim, theta, det_scores)[source]

Per-region selection score of Eq. (9): Theta_i * c_i * max_j p_ij * sim_j.

Parameters:
  • probs (ndarray)

  • label_sim (ndarray)

  • theta (ndarray)

  • det_scores (ndarray)

Return type:

ndarray

reli.perception.verifier.energy(logits)[source]

E_i = -log sum_j exp(logit_ij), numerically stable.

Parameters:

logits (ndarray)

Return type:

ndarray

Image-space measures and frame transforms used by visual grounding.

Pure NumPy, no deep-learning dependencies, so everything here is unit-tested.

reli.perception.geometry.base_from_optical(ext)[source]

4x4 transform mapping points in the camera optical frame to the base frame.

Parameters:

ext (Extrinsics)

Return type:

ndarray

reli.perception.geometry.backproject(u, v, depth_m, K)[source]

Pinhole back-projection of pixel (u, v) at metric depth into the optical frame.

Parameters:
  • u (float)

  • v (float)

  • depth_m (float)

  • K (Intrinsics)

Return type:

ndarray

reli.perception.geometry.mask_quality(mask)[source]

Q(M) = area(M) / area(convex hull of M), in [0, 1].

Fragmented or ragged masks score low; compact, solid masks score close to 1.

Parameters:

mask (ndarray)

Return type:

float

reli.perception.geometry.degradation_vector(image_bgr, box, mask, cfg)[source]

Omega_i = (darkness, blur, truncation), each in [0, 1].

  • darkness: how far the region’s mean luma is below reference_luma;

  • blur: how far its Laplacian variance is below reference_sharpness;

  • truncation: fraction of the region’s border lying on the image border, a proxy for objects cut off by the field of view or occluded.

Parameters:
  • image_bgr (ndarray)

  • box (tuple[float, float, float, float])

  • mask (ndarray | None)

  • cfg (DegradationConfig)

Return type:

ndarray

reli.perception.geometry.degradation_weight(omega, beta)[source]

Theta_i = exp(-beta * ||Omega_i||).

Parameters:
  • omega (ndarray)

  • beta (float)

Return type:

float

reli.perception.geometry.region_depth(depth_m, box, mask, cfg)[source]

Median valid depth in a neighbourhood of the region centroid, restricted to the mask when there is one; falls back to the whole region.

Parameters:
  • depth_m (ndarray)

  • box (tuple[float, float, float, float])

  • mask (ndarray | None)

  • cfg (DepthConfig)

Return type:

float | None

class reli.perception.tracking.SceneMemory(cfg, clock=<built-in function monotonic>)[source]
Parameters:

cfg (TrackingConfig)

Language models

reli.llm.build_provider(cfg)[source]
Parameters:

cfg (LLMConfig)

Return type:

LLMProvider

class reli.llm.LLMProvider(cfg)[source]

Subclasses implement _complete; this class adds retries and back-off.

Parameters:

cfg (LLMConfig)

complete(system, messages, schema=None)[source]

Return the model’s text. With schema, the text is a JSON object that the provider was asked (and, where supported, constrained) to match.

Parameters:
  • system (str)

  • messages (list[ChatMessage])

  • schema (dict | None)

Return type:

str

class reli.llm.ChatMessage(role: "Literal['user', 'assistant']", content: 'str', images: 'list[bytes]' = <factory>)[source]
Parameters:
  • role (Literal['user', 'assistant'])

  • content (str)

  • images (list[bytes])

class reli.localization.Localizer(provider, prompts, cache_file=None)[source]
Parameters:
  • provider (LLMProvider | None)

  • prompts (Prompts)

  • cache_file (Path | None)

message(key, language, **values)[source]

Render catalogue message key in language.

Parameters:
  • key (str)

  • language (str)

  • values (Any)

Return type:

str

Evaluation

Benchmark evaluation.

  • IPA - instruction parsing accuracy: the predicted plan matches a reference plan step by step.

  • IPA-strict - every parameter matches exactly (unstated ones at their defaults);

  • TSR - task success rate: predicted and reference plans are executed in the kinematic simulator from the same start; success if the end poses agree within robot.control.goal_tolerance_m (0.2 m in the paper) and yaw_tolerance_deg, and the same queries were answered;

  • ART - average response time of the planner (instruction -> parsed plan).

Benchmark file:

{"id": "de-001", "language": "de", "tier": "HRL", "category": "W_c",
 "text": "Fahre zwei Meter vorwärts.", "intent": "execute",
 "gold": [{"action": "MOVE", "distance": 2}],
 "alternatives": [[...another acceptable plan...]],
 "start": {"x": 0, "y": 0, "yaw_deg": 0}}

intent may be a list of acceptable intents (e.g. ["execute", "clarify"] when asking for a missing value is as good as assuming the default). STOP steps are ignored when comparing plans, because they have no effect on the outcome.

reli.evaluation.evaluate(cfg, provider, items, tol=None)[source]
Parameters:
Return type:

list[ItemResult]

reli.evaluation.plans_match(pred, gold, tol, strict)[source]

Compare expanded primitives. The tolerant variant only checks parameters the reference states; the strict variant compares every parameter.

Parameters:
  • pred (list[Action])

  • gold (list[Action])

  • tol (Tolerance)

  • strict (bool)

Return type:

bool

reli.evaluation.task_success(cfg, pred, gold, start, tol)[source]
Parameters:
Return type:

bool

reli.evaluation.summarise(results, by='tier')[source]
Parameters:
  • results (list[ItemResult])

  • by (str)

Return type:

dict[str, dict[str, float]]