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:
cfg (ReLIConfig)
on_event (Callable[[Event], None])
provider (LLMProvider | None)
- Return type:
- class reli.runtime.System(agent: 'ReLIAgent', robot: 'Robot', camera: 'Camera | None', grounder: 'Grounder | None', connection: 'object | None')[source]
- class reli.agent.ReLIAgent(cfg, robot, provider, grounder=None, on_event=<function ReLIAgent.<lambda>>, log_dir=None)[source]
- Parameters:
cfg (ReLIConfig)
robot (Robot)
provider (LLMProvider)
grounder (Grounder | None)
on_event (Callable[[Event], None])
log_dir (str | 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 indata),status(structured progress indata) orplan(parsed plan).- Parameters:
kind (str)
text (str)
language (str)
data (Any)
turn_id (int | None)
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)
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}:
languageupdates the session language state l (skipped when the user fixed the language);intentis the high-level interpretation r in R_int;actionsare 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:
cfg (ReLIConfig)
provider (LLMProvider)
prompts (Prompts)
catalog (Catalog)
- plan(text, ctx, history=())[source]
Interpret
text. RaisesLLMErrorif the provider is unreachable.- Parameters:
text (str)
ctx (PlanningContext)
history (Sequence[ChatMessage])
- Return type:
- 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
- validate(raw_actions, fill_defaults=True)[source]
Validate model output. Returns (actions, errors); invalid items are dropped.
With
fill_defaults=Falseonly 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]]
Safety and consent
- class reli.safety.SafetyGuard(cfg)[source]
- Parameters:
cfg (ReLIConfig)
- class reli.safety.SafetyReport(actions: 'list[Action]' = <factory>, violations: 'list[str]' = <factory>, adjustments: 'list[str]' = <factory>, rollout: 'Rollout | None' = None)[source]
- Parameters:
actions (list[Action])
violations (list[str])
adjustments (list[str])
rollout (Rollout | None)
User consent for multi-step plans.
Before a multi-step plan is executed the robot asks the user to confirm it. The reply r is classified as yes / no / unclear:
a normalised match against configurable positive and negative phrase templates (instant, no model call);
otherwise, with
method: embedding, the linear decision rule, rho = 1[v^T psi(r) + b > 0], where psi is a multilingual sentence embedding and (v, b) is the prototype classifier fitted on the phrase templates;otherwise, with
method: llm(default), a structured yes/no/unclear classification by the language model, which works for any language the model knows.
“Unclear” replies are treated by the agent as a new instruction.
- class reli.consent.ConsentClassifier(cfg, provider, prompts)[source]
- Parameters:
cfg (ConsentConfig)
provider (LLMProvider | None)
prompts (Prompts)
Execution and robots
- class reli.executor.Executor(cfg, robot, grounder, guard)[source]
- Parameters:
cfg (ReLIConfig)
robot (Robot)
grounder (Grounder | None)
guard (SafetyGuard)
- 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
- class reli.robot.base.Robot(limits, control)[source]
Base class. Subclasses implement
pose,_commandand optionallyodometry,_sleep,navigate_toandclose.- Parameters:
limits (MotionLimits)
control (ControlSettings)
- abstractmethod pose()[source]
Pose in the map frame (used for reporting and global goals).
- Return type:
- stop()[source]
Emergency stop: interrupts any running primitive and zeroes velocity.
- Return type:
None
- move(distance, speed, cancel=None)[source]
Drive
distancemetres along the current heading (negative = backward).- Parameters:
distance (float)
speed (float)
cancel (Event | None)
- Return type:
- turn(angle, angular_speed, cancel=None)[source]
Rotate in place by
angleradians (positive = counter-clockwise).- Parameters:
angle (float)
angular_speed (float)
cancel (Event | None)
- Return type:
- arc(radius, angle, speed, left, cancel=None)[source]
Drive along a circle of
radiusm sweepinganglerad.- Parameters:
radius (float)
angle (float)
speed (float)
left (bool)
cancel (Event | None)
- Return type:
- 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:
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:
- class reli.robot.base.MotionResult(success: 'bool', reason: 'str' = '', reported: 'bool' = False)[source]
- Parameters:
success (bool)
reason (str)
reported (bool)
- class reli.robot.rosbridge.RosbridgeRobot(cfg, conn)[source]
- Parameters:
cfg (RobotConfig)
conn (RosbridgeConnection)
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
queryin 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]
- 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.objectsare visible inside the configured field of view and range.- Parameters:
cfg (ReLIConfig)
pose (Callable[[], Pose2D])
memory (SceneMemory | None)
- 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
Language models
- 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)
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) andyaw_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:
cfg (ReLIConfig)
provider (LLMProvider)
items (Iterable[dict])
tol (Tolerance | None)
- 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.