In a Python algorithm, the decorator and the Params dataclass in main.py are the interface. Everything else in the file is just the work. Keeping the two apart is what lets the platform show your ports in the editor, check workflow connections and propose version numbers, all without running your code.
When you save, the platform reads the interface statically and freezes it with the version as algorithm.yaml. At run time the SDK rebuilds the interface from the decorator and refuses to start if it differs from the frozen one (ALGORITHM_MANIFEST_DRIFT).
Read a recording and write features
Most algorithms do the same three things inside run: pick a camera, read its frames, and write values back. This section is what you need for that; the complete example at its end runs as it is. Everything comes from from embodiflow import …, which the console editor and every run already have.
Cameras and their names
recording.cameras lists the recording's cameras. Each Camera has a role, its short name such as top or wrist_left, a key, the LeRobot name such as observation.images.top, and its width and height in pixels. Take a camera by position, recording.cameras[0], or by name: recording.cameras["wrist_left"] accepts the role or the key.
for cam in recording.cameras:
print(cam.role, cam.key, cam.width, cam.height)
cam = recording.cameras["wrist_left"] # by role, or by key: "observation.images.wrist_left"To see the cameras of your own recording, pick it in the editor's Test run panel: it says, for example, "Cameras in this recording: top (observation.images.cam_high), wrist_left (observation.images.cam_left_wrist)." Each camera is shown by its role, with its whole key in brackets; pass either, recording.cameras["top"] or recording.cameras["observation.images.cam_high"]. You can also print them in your code and run a test: what your code prints appears under Logs in the test result. A name the recording doesn't have stops the run with an error that lists the names it does have, for example KeyError: "no camera 'front'; cameras: ['top', 'wrist_left', 'wrist_right']".
A role is one of head, head_left, head_right, wrist_left, wrist_right, wrist, chest, third_person, top, depth, other. The robots the platform reads out of the box name their cameras like this; when two cameras share a role, take them by key or by position.
| Robot | Roles | Keys |
|---|---|---|
| LimX TRON2 AV3 (dual arm) | top, wrist_left, wrist_right | observation.images.top, observation.images.wrist_left, observation.images.wrist_right |
| LimX TRON2 AV3 (dual arm, no head target) | top, wrist_left, wrist_right | observation.images.top, observation.images.wrist_left, observation.images.wrist_right |
| LimX TRON2 (gripper) | top, wrist_left, wrist_right | observation.images.top, observation.images.wrist_left, observation.images.wrist_right |
| LimX TRON2 (dexterous hands) | top, wrist_left, wrist_right | observation.images.top, observation.images.wrist_left, observation.images.wrist_right |
| ALOHA (bimanual) | top, third_person, wrist_left, wrist_right | observation.images.cam_high, observation.images.cam_low, observation.images.cam_left_wrist, observation.images.cam_right_wrist |
| SO-100 / SO-101 | top, top, third_person, wrist | observation.images.up, observation.images.top, observation.images.side, observation.images.wrist |
| Koch v1.1 | third_person, third_person | observation.images.laptop, observation.images.phone |
| Franka (DROID-style) | third_person, third_person, wrist | observation.images.exterior_image_1_left, observation.images.exterior_image_2_left, observation.images.wrist_image_left |
| SenseXperience egocentric rig | head_left, head_right, wrist_left, wrist_right | observation.images.head_left, observation.images.head_right, observation.images.wrist_left, observation.images.wrist_right |
Frames
cam.frames(start=0, stop=None, step=1, gray=False, size=None) decodes the camera's video one Frame at a time, so a long recording never has to fit in memory. Each frame has an index (the frame number, 0 at the start of the recording, or of the episode at episode level), time_s (seconds from that start) and image, a numpy uint8 array: height × width × 3 in RGB, or height × width with gray=True. step reads every n-th frame, and size=(width, height) scales the picture down, which is much faster when your model wants small images.
for frame in cam.frames(step=5, gray=True, size=(320, 240)):
print(frame.index, frame.time_s, frame.image.shape) # 0 0.0 (240, 320)
first = cam.frame(0) # one frame
ok = cam.valid() # one bool per frame: False where the camera dropped a frameWhere a camera had a gap, the video holds a black placeholder frame and valid() is False for it, so you can leave those frames out.
The recording itself
| Name | What it gives you |
|---|---|
recording.num_frames, recording.fps, recording.duration_s | Frames, frames per second and seconds. A per-frame feature has exactly num_frames rows. |
recording.task, recording.kind | The task text, and robot or human. |
recording.columns | The joint and sensor columns, each a Column with name, shape, names (for example the joint names) and unit. |
recording.column(name) | One column as a numpy array of num_frames rows, for example recording.column("observation.state"), the joint state of a robot recording. |
recording.table(columns) | Every row as a pyarrow.Table. |
recording.window(start_s, end_s) | A part of the recording, with frame numbers starting at 0. |
Parameters and output to read back
ctx.params holds your Params with the values the workflow set, for example ctx.params.step. Use print() for anything you want to read back: a test run shows it under Logs, and a workflow run in the step's log. ctx.progress(done, total) reports progress on long work.
Write features
In an enrich algorithm, out is a FeatureWriter. Use the method that matches the per of each Feature you declared in the decorator, and write every declared feature exactly once.
| Method | For per= | What you pass |
|---|---|---|
out.per_frame(name, values) | "frame" | One row per frame: an array of num_frames rows (a plain list or 1-D array for a scalar). NaN marks a frame with no value. A wrong row count fails with FEATURE_ROW_COUNT_MISMATCH. |
out.per_recording(name, value) | "recording" | One value for the whole recording, at most 1 MiB of JSON. |
out.per_episode(name, value) | "episode" | The value of the episode being processed, with level="episode" only. |
out.file(name, path) | "file" | A file you wrote, for example under ctx.tmp. |
For example, with Feature("brightness", type="scalar", per="frame") and Feature("mean_brightness", type="scalar", per="recording") declared, and a camera chosen as above:
values = np.full(recording.num_frames, np.nan, np.float32) # NaN: no value for this frame
for frame in cam.frames(step=ctx.params.step, gray=True):
values[frame.index] = frame.image.mean()
out.per_frame("brightness", values)
out.per_recording("mean_brightness", float(np.nanmean(values)))A complete example
Motion energy, the example the console opens for Enrich, puts it all together: the imports, Params, the decorator, frames of the first camera and one value per frame. To use a named camera, change recording.cameras[0] to recording.cameras["wrist_left"].
"""Enrich: the mean absolute difference between consecutive frames of the first camera, per frame.
In: the canonical recording.
Out: one new per-frame feature "motion_energy"; the recording itself is not changed.
Why: idle stretches (the arm waits, the person stands still) show as low motion, so a later step can
segment or drop them. A feature is how an algorithm adds knowledge without rewriting the recording.
"""
from dataclasses import dataclass
import numpy as np
from embodiflow import Context, Feature, FeatureWriter, Recording, algorithm, param
@dataclass
class Params:
step: int = param(1, minimum=1, title="Frame step")
@algorithm.enrich(
name="motion-energy",
title="Motion energy",
description="How much the first camera's picture changes from one frame to the next.",
features=[Feature("motion_energy", type="scalar", per="frame", dtype="float32", unit="none")],
params=Params,
)
def run(recording: Recording, out: FeatureWriter, ctx: Context[Params]) -> None:
cam = recording.cameras[0]
energy = np.zeros((recording.num_frames, 1), np.float32)
prev = None
for frame in cam.frames(step=ctx.params.step, gray=True):
current = frame.image.astype(np.float32)
if prev is not None:
energy[frame.index, 0] = np.abs(current - prev).mean()
prev = current
out.per_frame("motion_energy", energy)Decorator arguments
| Argument | Required | Rule |
|---|---|---|
name, title | yes | name is lowercase letters and digits in segments joined by a single -, 2 to 63 long, starting with a letter, with no trailing - (a--b and a- are refused; the message suggests a-b). training-images is reserved. It is fixed for the algorithm's life. A team name may not start with ef- or embodiflow-. |
description | no | Shown in the library. |
level | no | check and enrich: recording (default) or episode. |
reads | check at recording level | raw or recording (default). |
inputs | no | Extra features inputs: Input(requires=[…], optional=False). Names are lowercase letters, digits and _, up to 32 long, and not a data type name, a default port name or a run argument name. |
features | enrich | At least one Feature(...). |
checks | check; any category that writes checks | Check(id, title, description=""). |
labels | segment | The label keys its episodes carry: {key: semantic type}. |
requires | no | Facts the data must have. See below. |
params | no | A dataclass whose every field is param(default, …). |
resources | no | See below. |
requirements | no | pip requirement strings. Binary wheels only. Locked at save. |
retries, cache | no | Default: one retry on transient errors, cache on. |
services | no | Built-in algorithms only: ["vlm"]. |
privacy | no | Built-in algorithms only: "redacts" or "numbers_only". |
You don't write a version in the code. When you save, the platform proposes the next version from what changed in the interface.
Data types
Ports carry one of eight data types, and a connection is only allowed between ports of the same type.
| Type | What it is |
|---|---|
raw | One recording's uploaded files. |
recording | The canonical recording: a LeRobot v3 tree plus meta/embodiflow/recording.json. |
features | New values about a recording or its episodes. |
checks | Judgements, each with a status. |
episodes | Time ranges with a task text. |
version | A version. |
selection | Per-episode decisions: keep, split, task. |
artifact | Files to download. |
Feature
A feature is declared as Feature(name, type, per, dtype=…, shape=…, unit=…, frame=…, names=…, source=…, describe=…).
| Field | Meaning |
|---|---|
name | A short name. The platform stores it under a name that belongs to your team. |
type | A semantic type from the table below. |
per | frame, recording, episode or file. |
dtype | float32 (default), float64, int8, int16, int32, int64, uint8 or uint16. |
shape | The shape of one value. Array types have a fixed default shape. |
unit, frame | Required for geometric types, except per file. |
names | Names of the components, for example joint names. |
source | recorded, imported, estimated, computed (default) or retargeted. |
describe | Extra description, for example {"targetRig": "tron2av3"} for a retargeted action. |
Parameters
Parameters are the settings a workflow can change without touching your code. Every field of Params is param(default, minimum=…, maximum=…, enum=…, title=…, description=…, widget=…), and its type comes from the annotation: int, float, str, bool, or a list of strings, integers or floats.
A list field takes a literal list default and also items_enum, min_items and max_items. The widget tags takes free strings; multiselect needs items_enum. A workflow sets values in with, and the platform checks them against these limits.
Semantic types
A feature's semantic type tells the next step what the numbers mean; it's how the editor knows which outputs can feed an input that requires, say, keypoints3d.hand21. The registry is closed, and teams use these types as they are.
| Type | Meaning | Shape or value |
|---|---|---|
scalar | One number | [1] |
vector | Numbers | [n] |
label.bool | Yes or no label | bool |
label.category | One of a declared set | string; describe.values |
label.text | Free text | string |
spans | Time ranges inside an episode or recording | list of { startS, endS, label } |
embedding | An embedding vector | [n]; describe.model |
pose.se3 | Position and quaternion | [7]: x y z qx qy qz qw; unit, frame |
keypoints3d.hand21 | 21 hand landmarks in 3D, MediaPipe order | [63]; unit, frame |
skeleton.hand21 | 21 hand joints with a 6-DoF frame each, MediaPipe order | [147] = 21 x (x y z qx qy qz qw); unit, frame |
skeleton.body22 | 22 body joints with a 6-DoF frame each, SMPL order (pelvis first) | [154] = 22 x (x y z qx qy qz qw); unit, frame |
keypoints2d | 2D image keypoints | [2k]; frame is the camera |
confidence | Per-sample confidence from 0 to 1 | [n] |
calibration.stereo | Rectified stereo extrinsics | { R[9], T[3] } |
calibration.cam_imu | Camera to IMU transform and time offset | { R[9], T[3], dtS } |
depth.video | 16-bit depth video sidecar | file |
mask.video | Per-frame mask video | file |
video.preview | Light browser preview copy of one camera video, same frames | file, embodiflow-preview/v1 |
ros2.mcap | ROS 2 MCAP file (TF tree, images, point clouds, markers) | file |
action.joint | Joint-space action | [n]; names |
action.ee_pose | End-effector action | [7], or [8] with the gripper |
json | Any small JSON | object, at most 1 MiB; matched by requires only as name:<feature> |
Facts and requires
Facts are what the platform knows about the data, derived from the data itself and never typed in by a person. Your code reads them as ctx.facts, and requires uses them to decide whether your algorithm applies at all.
| Fact | Type | Known from |
|---|---|---|
kind | robot or human | The project |
format | string: mcap, lerobot, video, or x-<team format> | The upload |
privacy_required | bool | Always true: anonymization is a workflow step for every recording |
duration_s | number | The upload summary, then the recording, then the episode window |
cameras | integer | The upload summary, then the recording |
stereo | bool | The recording: a stereo pair with intrinsics |
imu | bool | The recording: IMU columns |
action | bool | The recording: an action feature |
recorded_hand_pose | bool | The recording: recorded hand keypoints |
gripper_width | bool | The recording: a gripper-width column |
episodes | integer | The version: number of episodes |
requires maps a fact to true, false, a string equal to the value, or a comparison such as ">=2" or "<600". If any condition is false, the step ends as not applicable: grey, never a failure. An unknown fact never satisfies a condition, so the step is not applicable rather than run on a guess. Your code can also decide at run time with ctx.not_applicable(code, message).
Resources
| Key | Default | Meaning |
|---|---|---|
cpu | 4 | CPU cores. |
memory | 8Gi | Memory, for example 8Gi or 16Gi. |
disk | 10Gi | Scratch space for ctx.tmp. |
gpu | None | None, or {"count": 1, "memoryGb": 16}. |
timeout | 30m | A duration such as 20m, or {"perInputMinute": …, "min": …, "max": …}. |
Every step gets at least 1 CPU core and 2Gi of memory, and at least 8 GB of GPU memory when it asks for a GPU; a smaller value runs with that floor, so a light step runs with what it asks for. The resources must fit on one machine, and a GPU larger than any compute pool offers is refused with ALGORITHM_GPU_UNSATISFIABLE.
An algorithm that asks for a GPU runs on the CUDA SDK base automatically, with PyTorch and CUDA 13 preinstalled, so you never choose a base image. Its test runs also use a GPU and wait until one has room; a deployment without a GPU refuses them with ALGORITHM_SAMPLE_RUN_GPU_UNSUPPORTED.
How code ends
How your code finishes tells the platform what happened, and each way ends the step differently. An image algorithm signals the same outcomes with its exit code.
| Python | Exit code (image) | Meaning | The step ends |
|---|---|---|---|
| return | 0 | Done. | succeeded |
ctx.not_applicable(code, msg) | 85 | This data is not for me. | not applicable |
ctx.input_unusable(code, msg) | 87 | The data is broken. | failed; the recording is quarantined |
raise TransientError(msg) | 88 | Try again: network, GPU busy. | retried, then failed |
| any other exception | 1 | A bug. | failed; the traceback is in the log |
Codes are capital letters, digits and _, 3 to 64 long. The step message reads <code>: <message>.
Versions and references
Workflows refer to an algorithm as embodiflow/<name>@<major> or team/<name>@<major>, and each run uses the highest saved version of that major. That way a fix reaches every workflow on its next run, while a breaking change waits until you switch to the new major.
A change to the ports, level, requires, the declared features, checks or labels, or the type of a parameter is a breaking change and needs a new major version; saving it as a minor version is refused with ALGORITHM_INTERFACE_CHANGED. A saved version never changes.
How run is called
run is called once per recording, once per episode at episode level, or once per version for curate and export. Its arguments are bound by name, so take only the ones you need, in any order.
| Argument | Gets |
|---|---|
raw, recording, version | The main input. What a recording offers is in Read a recording and write features. |
episode | Episode level only: the episode being processed. |
| An extra input name | A Features object, or None when the input is optional and absent. |
out | The writer of the category. |
ctx | The context: params, facts, recording_id, run_id, step_id, tmp, log, progress(done, total, message), not_applicable and input_unusable. |
state | What setup(ctx) returned. |
Use setup(ctx) to load a model once. Today the platform calls it once per job; a later version may process many items in one job and still call setup only once, with no change to your code. That's why run must not keep per-item state in globals.
Next
Python SDK reference
This page is generated from the same SDK index the browser editor uses for completion, so it always matches the SDK you run. Everything is imported from embodiflow:
from embodiflow import Context, Feature, FeatureWriter, Recording, algorithm, paramThe SDK ships type hints (py.typed), so your own editor completes it too, and every class and method has a docstring that the browser editor shows on hover. The descriptions below are those docstrings.
Decorators
@algorithm.standardize
Declare a standardizer: it turns one raw recording into the canonical recording.
| Argument | Type | Required | Default |
|---|---|---|---|
name | str | yes | |
title | str | yes | |
description | str | None | no | None |
checks | list[Check] | None | no | None |
requires | dict[str, Any] | None | no | None |
params | type | None | no | None |
constraints | list[Constraint] | None | no | None |
resources | dict[str, Any] | None | no | None |
requirements | list[str] | None | no | None |
retries | int | None | no | None |
cache | bool | None | no | None |
services | list[str] | None | no | None |
@algorithm.check
Declare a check: it judges data and never changes it.
| Argument | Type | Required | Default |
|---|---|---|---|
name | str | yes | |
title | str | yes | |
checks | list[Check] | yes | |
description | str | None | no | None |
level | str | None | no | None |
reads | str | None | no | None |
inputs | dict[str, Input] | None | no | None |
requires | dict[str, Any] | None | no | None |
params | type | None | no | None |
constraints | list[Constraint] | None | no | None |
resources | dict[str, Any] | None | no | None |
requirements | list[str] | None | no | None |
retries | int | None | no | None |
cache | bool | None | no | None |
services | list[str] | None | no | None |
passthrough | dict[str, list[str]] | None | no | None |
@algorithm.transform
Declare a transform: it returns a recording with some streams replaced or cut.
| Argument | Type | Required | Default |
|---|---|---|---|
name | str | yes | |
title | str | yes | |
description | str | None | no | None |
inputs | dict[str, Input] | None | no | None |
checks | list[Check] | None | no | None |
requires | dict[str, Any] | None | no | None |
params | type | None | no | None |
constraints | list[Constraint] | None | no | None |
resources | dict[str, Any] | None | no | None |
requirements | list[str] | None | no | None |
retries | int | None | no | None |
cache | bool | None | no | None |
services | list[str] | None | no | None |
privacy | str | None | no | None |
passthrough | dict[str, list[str]] | None | no | None |
@algorithm.enrich
Declare an enricher: it computes new information without changing the recording.
| Argument | Type | Required | Default |
|---|---|---|---|
name | str | yes | |
title | str | yes | |
features | list[Feature] | yes | |
description | str | None | no | None |
level | str | None | no | None |
inputs | dict[str, Input] | None | no | None |
checks | list[Check] | None | no | None |
requires | dict[str, Any] | None | no | None |
params | type | None | no | None |
constraints | list[Constraint] | None | no | None |
resources | dict[str, Any] | None | no | None |
requirements | list[str] | None | no | None |
retries | int | None | no | None |
cache | bool | None | no | None |
services | list[str] | None | no | None |
privacy | str | None | no | None |
passthrough | dict[str, list[str]] | None | no | None |
@algorithm.segment
Declare a segmenter: it proposes episodes, time ranges with a task text.
| Argument | Type | Required | Default |
|---|---|---|---|
name | str | yes | |
title | str | yes | |
description | str | None | no | None |
labels | dict[str, str] | None | no | None |
inputs | dict[str, Input] | None | no | None |
checks | list[Check] | None | no | None |
requires | dict[str, Any] | None | no | None |
params | type | None | no | None |
constraints | list[Constraint] | None | no | None |
resources | dict[str, Any] | None | no | None |
requirements | list[str] | None | no | None |
retries | int | None | no | None |
cache | bool | None | no | None |
services | list[str] | None | no | None |
segment_source | str | None | no | None |
passthrough | dict[str, list[str]] | None | no | None |
@algorithm.curate
Declare a curator: it decides per episode of a dataset version whether to keep it, its split and its task.
| Argument | Type | Required | Default |
|---|---|---|---|
name | str | yes | |
title | str | yes | |
description | str | None | no | None |
requires | dict[str, Any] | None | no | None |
params | type | None | no | None |
constraints | list[Constraint] | None | no | None |
resources | dict[str, Any] | None | no | None |
requirements | list[str] | None | no | None |
retries | int | None | no | None |
cache | bool | None | no | None |
@algorithm.export
Declare an exporter: it turns a dataset version into downloadable files.
| Argument | Type | Required | Default |
|---|---|---|---|
name | str | yes | |
title | str | yes | |
description | str | None | no | None |
requires | dict[str, Any] | None | no | None |
params | type | None | no | None |
constraints | list[Constraint] | None | no | None |
resources | dict[str, Any] | None | no | None |
requirements | list[str] | None | no | None |
retries | int | None | no | None |
cache | bool | None | no | None |
Functions
param(default, *, minimum=None, maximum=None, enum=None, title=None, description=None, widget=None)
Declare a field of the Params dataclass with its default and limits.
Classes
ArtifactWriter
Collects the files of an export (embodiflow-artifact/v1).
| Attribute | Meaning |
|---|---|
checks: 'CheckWriter' | The CheckWriter for the checks this algorithm declared (checks=[Check(...)]). |
| Method | Meaning |
|---|---|
format(name: str) -> None | Name the format of the files (lerobot-v3, csv, ...). |
path(rel: str) -> Path | A path inside the artifact to write to (parent folders are created). |
add(src: str | Path, rel: str) -> None | Copy the file or folder src into the artifact at rel. |
reference(rel: str, source: str) -> dict[str, Any] | Put input file source ("<input port>/<path>", e.g. "version/results/<id>/videos/…/file-000.mp4") into the artifact at rel without reading or copying it (contract §6.5). |
summary(doc: dict[str, Any]) -> None | Describe the export (counts, sizes); shown on the download page. |
Camera
One camera of a recording.
| Attribute | Meaning |
|---|---|
anonymized: bool | |
distortion: list[float] | None | |
height: int | |
intrinsics: list[list[float]] | None | |
key: str | |
model: str | None | |
role: str | |
video_path: Path | The camera's mp4 in the recording tree. |
width: int |
| Method | Meaning |
|---|---|
valid() -> 'np.ndarray' | A boolean per frame: False where the camera had a gap and the video holds a black placeholder. |
frames(start: int=0, stop: int | None=None, step: int=1, gray: bool=False, size: tuple[int, int] | None=None) -> Iterator[Frame] | Decode frames start..stop every step (indices relative to this recording or episode window). |
frame(i: int) -> Frame | Decode the single frame i. |
Check
One check result id an algorithm may report through CheckWriter.result.
| Attribute | Meaning |
|---|---|
description: str | |
id: str | |
title: str |
| Method | Meaning |
|---|---|
to_dict() -> dict[str, Any] | The declaration as the manifest input. |
CheckWriter
Collects check results (embodiflow-checks/v1).
| Attribute | Meaning |
|---|---|
checks: 'CheckWriter' | The CheckWriter for the checks this algorithm declared (checks=[Check(...)]). |
| Method | Meaning |
|---|---|
result(id: str, status: str, value: float | None=None, threshold: float | None=None, message: str='', evidence: Sequence[str | Path] | None=None, at: Mapping[str, Any] | None=None) -> None | Report one result. |
evidence_path(name: str) -> Path | A path under evidence/ to write a picture or file to; pass it to result(evidence=[...]). |
metrics(doc: dict[str, Any]) -> None | Attach an embodiflow-quality-metrics/v1 body (built-in checks only). |
Column
One tabular column of a recording: name, dtype, shape, names and the conventions unit, frame, source.
| Attribute | Meaning |
|---|---|
dtype: str | |
frame: str | None | |
name: str | |
names: list[str] | None | |
shape: list[int] | |
source: str | None | |
type: str | None | |
unit: str | None |
Constraint
A rule between two params (contract 3.2 constraints), checked before a run starts.
| Attribute | Meaning |
|---|---|
at_least: str | None | |
at_most: str | None | |
multiple_of: str | None | |
param: str | |
when: Any |
| Method | Meaning |
|---|---|
to_dict() -> dict[str, Any] | The declaration as the manifest input. |
Context
Everything a run knows about itself: params, facts, identifiers, scratch space, log, progress.
| Attribute | Meaning |
|---|---|
facts: Facts | |
log: logging.Logger | |
params: P | |
platform_params: dict[str, Any] | What the platform resolved for a standardize step (rigProfiles, teamDataFormat); empty otherwise. |
recording_id: str | None | The recording this step works on (None for a version-level step). |
run_id: str | The workflow run id. |
step_id: str | The id of the step in the workflow. |
team_slug: str | None | The storage slug of the team (names a team feature); None when the job does not state it. |
tmp: Path |
| Method | Meaning |
|---|---|
progress(done: int, total: int, message: str='') -> None | Report progress to the run view (progress bar and ETA); safe to call often. |
not_applicable(code: str, message: str) -> NoReturn | End the step as *not applicable* (exit 85, grey in the run view, never a failure). |
input_unusable(code: str, message: str) -> NoReturn | End the step because the data is broken (exit 87): the step fails and the recording is quarantined. |
DatasetVersion
A frozen dataset version: id, features (declared names and types) and members.
| Attribute | Meaning |
|---|---|
document: dict[str, Any] | |
features: dict[str, dict[str, Any]] | |
id: str | |
members: list[Member] |
| Method | Meaning |
|---|---|
to_pandas() -> 'pd.DataFrame' | One row per member: id, recording, start/end/duration, task, split, labels, quality status, session, operator. |
Episode
An episode of a recording: index, start_s, end_s (recording timeline), task, labels, confidence.
| Attribute | Meaning |
|---|---|
confidence: float | None | |
duration_s: float | Length in seconds. |
end_s: float | |
index: int | |
labels: dict[str, Any] | |
start_s: float | |
task: str | None |
EpisodeWriter
Collects proposed episodes (embodiflow-episodes/v1).
| Attribute | Meaning |
|---|---|
checks: 'CheckWriter' | The CheckWriter for the checks this algorithm declared (checks=[Check(...)]). |
| Method | Meaning |
|---|---|
episode(start_s: float, end_s: float, task: str, labels: Mapping[str, Any] | None=None, confidence: float | None=None) -> None | Add one episode: startS/endS in seconds, the task text, optional labels and a confidence in 0..1. |
Facts
Facts of the main input (contract 2.1) with attribute access: ctx.facts.kind, ctx.facts.stereo.
| Attribute | Meaning |
|---|---|
action: bool | None | |
cameras: int | None | |
duration_s: float | None | |
episodes: int | None | |
format: str | None | |
gripper_width: bool | None | |
imu: bool | None | |
kind: str | None | |
privacy_required: bool | None | |
recorded_hand_pose: bool | None | |
stereo: bool | None |
| Method | Meaning |
|---|---|
get(name: str, default: Any=None) -> Any | The value of a fact, or default when it is unknown. |
as_dict() -> dict[str, Any] | All known facts as a plain dict. |
Feature
One feature an enrich algorithm declares and later writes through FeatureWriter.
| Attribute | Meaning |
|---|---|
describe: dict[str, Any] | None | |
dtype: str | None | |
frame: str | None | |
name: str | |
names: list[str] | None | |
per: str | |
shape: list[int] | None | |
source: str | None | |
type: str | |
unit: str | None |
| Method | Meaning |
|---|---|
to_dict() -> dict[str, Any] | The declaration as the manifest input: only the arguments that were given. |
FeatureWriter
Collects the features an enrich algorithm computes (embodiflow-features/v1).
| Attribute | Meaning |
|---|---|
checks: 'CheckWriter' | The CheckWriter for the checks this algorithm declared (checks=[Check(...)]). |
| Method | Meaning |
|---|---|
per_frame(name: str, values: Any, confidence: str | None=None) -> None | Write one row per frame: values has shape (num_frames, *shape) (a 1-D array for a scalar). |
per_recording(name: str, value: Any) -> None | Write one value for the whole recording (JSON, at most 1 MiB). |
per_episode(name: str, value: Any) -> None | Write the value for the episode being processed (episode-level enrich only). |
file(name: str, path: str | Path, describe: Mapping[str, Any] | None=None) -> None | Attach a file (such as a depth video) to a per="file" feature. |
poster(frame_ms: int, path: str | Path) -> None | Built-in poster-frames only: write the JPEG at path as the poster frame_ms milliseconds into the recording. |
Features
A features input (features.json plus frames.parquet, episodes.parquet and files/).
| Attribute | Meaning |
|---|---|
document: dict[str, Any] | |
names: list[str] | The names of all features. |
num_frames: int |
| Method | Meaning |
|---|---|
info(name: str) -> dict[str, Any] | The features.json entry of name (type, per, dtype, shape, unit, frame, source, describe). |
of_type(semantic_type: str) -> list[str] | Names of the features whose semantic type is semantic_type. |
per_frame(name: str) -> 'np.ndarray' | The values of a per-frame feature, shape (num_frames, *shape); rows outside an episode window are NaN/None. |
per_recording(name: str) -> Any | The value of a per-recording feature. |
per_episode(name: str) -> dict[int, Any] | {episodeIndex: value} of a per-episode feature. |
file(name: str) -> Path | The path of a per-file feature (a depth video). |
Frame
One decoded video frame: index (in the recording or episode window), time_s and image (RGB H x W x 3 uint8, or H x W when gray).
| Attribute | Meaning |
|---|---|
image: 'np.ndarray' | |
index: int | |
time_s: float |
Input
An extra input of type features (a calibration, a hand pose).
| Attribute | Meaning |
|---|---|
optional: bool | |
requires: list[str] |
| Method | Meaning |
|---|---|
to_dict() -> dict[str, Any] | The declaration as the manifest input. |
InputUnavailableError
An input the algorithm asked for is not there (absent port, missing file or download).
ManifestDriftError
The code's interface differs from the frozen manifest of this version.
ManifestError
The algorithm interface is invalid (ALGORITHM_FILE_INVALID and its siblings).
McapMessage
A decoded ROS 2 message: topic, schema, log_time_s (seconds since the file's first message).
McapReader
An MCAP file read through its summary and only the chunks a query needs.
| Attribute | Meaning |
|---|---|
duration_s: float | |
end_ns: int | |
start_ns: int | |
topics: list[McapTopic] |
| Method | Meaning |
|---|---|
messages(topics: Sequence[str] | None=None, start_s: float | None=None, end_s: float | None=None) -> Iterator[McapMessage] | Decoded messages in log-time order; topics filters by name, start_s/end_s bound log time. |
McapTopic
One topic of an MCAP file: name, message schema name, message count and average rate in Hz.
| Attribute | Meaning |
|---|---|
count: int | |
name: str | |
rate: float | |
schema: str |
Member
One episode of a dataset version.
| Attribute | Meaning |
|---|---|
duration_s: float | Length of the episode in seconds. |
end_s: float | |
episode_id: str | |
features: dict[str, Any] | |
labels: dict[str, Any] | |
operator: str | None | |
quality: dict[str, Any] | |
recording_id: str | |
root: str | |
session: str | None | |
split: str | None | |
start_s: float | |
task: str | None |
| Method | Meaning |
|---|---|
recording() -> Recording | The episode's recording window, downloading its files on first use. |
OutputError
A writer refused what the algorithm gave it.
RawFile
One uploaded file: path (relative to the upload root), size in bytes and local_path on disk.
| Attribute | Meaning |
|---|---|
local_path: Path | |
path: str | |
size: int |
| Method | Meaning |
|---|---|
open(mode: str='rb') -> IO[Any] | Open the file (read-only; binary by default). |
RawFiles
One recording's uploaded files, at their upload-relative paths.
| Attribute | Meaning |
|---|---|
files: list[RawFile] |
| Method | Meaning |
|---|---|
find(pattern: str) -> list[RawFile] | The files whose path matches the glob pattern (* within a folder, ** across folders). |
read_json(path: str) -> Any | Parse the JSON file at path. |
read_yaml(path: str) -> Any | Parse the YAML file at path. |
mcap(path: str | None=None) -> 'McapReader' | Open an MCAP file; path may be omitted when the upload holds exactly one. |
Recording
The canonical recording (LeRobot v3 tree plus meta/embodiflow/recording.json), or a time window of it.
| Attribute | Meaning |
|---|---|
calibration: dict[str, Any] | The conventions sidecar's calibration: frames, stereoPairs and timeOffsets as stored. |
cameras: list[Camera] | |
columns: list[Column] | |
conventions: dict[str, Any] | |
duration_s: float | Length in seconds. |
facts: dict[str, Any] | |
fps: float | |
info: dict[str, Any] | |
kind: str | None | |
meta: dict[str, Any] | |
num_frames: int | |
start_s: float | Where this recording (or episode window) starts on the recording timeline, in seconds. |
stereo_pairs: list[dict[str, str]] | |
task: str | None | |
total_frames: int |
| Method | Meaning |
|---|---|
window(start_s: float, end_s: float) -> 'Recording' | The part of this recording between start_s and end_s (seconds on this recording's own timeline). |
table(columns: Sequence[str] | None=None) -> 'pa.Table' | The frame table (one row per frame of this recording or window) as a pyarrow.Table. |
column(name: str) -> 'np.ndarray' | One column as a numpy array of shape (num_frames, *shape). |
RecordingBuilder
Builds the canonical recording from a source format.
| Attribute | Meaning |
|---|---|
checks: 'CheckWriter' | The CheckWriter for the checks this algorithm declared (checks=[Check(...)]). |
root: Path | The output folder of the recording port (for :meth:adopt_tree). |
| Method | Meaning |
|---|---|
adopt_tree() -> None | Say that the run wrote the complete canonical tree under out.root itself (a built-in standardizer with its own tree writer). |
fps(value: int) -> None | Declare the frame rate of the recording: 30 (the platform grid; other rates are refused). |
task(text: str) -> None | Set the task text of the recording (one episode, one task). |
camera(key: str, role: str, frames: Iterable[Any] | Any=None, video: str | Path | None=None, intrinsics: Sequence[Sequence[float]] | None=None, distortion: Sequence[float] | None=None, model: str | None=None) -> None | Add a camera from RGB frames (an array N x H x W x 3 uint8 or an iterator of H x W x 3 frames) or a video file. |
column(name: str, values: Any, type: str='vector', unit: str='none', frame: str='none', source: str='recorded', names: Sequence[str] | None=None) -> None | Add a tabular column with one row per frame: values has shape (N,) or (N, ...). |
timestamps(seconds: Any) -> None | Record the source capture time of each row (seconds, non-decreasing); kept beside the recording. |
stereo_pair(left: str, right: str) -> None | Name two added cameras as a stereo pair (keys or short names). |
dropped(what: str, reason: str) -> None | Declare something of the source that did not make it into the recording, and why. |
RecordingEditor
Edits the input recording: replace or drop a camera, replace a column, trim.
| Attribute | Meaning |
|---|---|
checks: 'CheckWriter' | The CheckWriter for the checks this algorithm declared (checks=[Check(...)]). |
root: Path | The output folder of the recording port (for :meth:adopt_tree). |
| Method | Meaning |
|---|---|
adopt_tree() -> None | Say that the run wrote the complete edited tree under out.root itself (a built-in transform with its own video path, such as anonymize with its hardware encoder). |
unchanged() -> None | Hand the input recording through untouched (zero copy). |
replace_camera(key: str, frames: Iterable[Any] | Any=None, video: str | Path | None=None, anonymized: bool | None=None) -> None | Replace the pictures of camera key with frames (an iterator of H x W x 3 uint8 images, one per input frame) or a video. |
drop_camera(key: str) -> None | Remove camera key from the recording. |
replace_column(name: str, values: Any) -> None | Replace the values of column name; values has the shape of the existing column (one row per input frame). |
trim(start_s: float, end_s: float) -> None | Keep only start_s..end_s (seconds) of the recording. |
SelectionWriter
Collects per-episode decisions (embodiflow-selection/v1).
| Attribute | Meaning |
|---|---|
checks: 'CheckWriter' | The CheckWriter for the checks this algorithm declared (checks=[Check(...)]). |
| Method | Meaning |
|---|---|
keep(episode_id: str, split: str | None=None, task: str | None=None, reason: str | None=None) -> None | Keep the episode, optionally assigning a split (train/val/test) and replacing its task text. |
count(name: str, value: int) -> None | Report a named count in the selection summary (summary.counts), e.g. count("grouped_by_recording", 3). |
drop(episode_id: str, reason: str) -> None | Drop the episode from the new version; reason is shown to the team. |
SetupContext
What setup(ctx) sees: the params, the facts, a scratch directory and a logger.
| Attribute | Meaning |
|---|---|
facts: Facts | |
log: logging.Logger | |
params: Any | |
run_id: str | The workflow run id. |
step_id: str | The id of the step in the workflow. |
tmp: Path |
TransientError
Raise it when a retry may succeed (network, GPU busy): the step exits 88 and is retried.
Vocabulary
| Name | Allowed values |
|---|---|
categories | standardize, check, transform, enrich, segment, curate, export |
levels | recording, episode, version |
statuses | pass, warn, fail, error, not_evaluated, not_applicable |
per | frame, recording, episode, file |
sources | recorded, imported, estimated, computed, retargeted |
dtypes | float32, float64, int8, int16, int32, int64, uint8, uint16 |
splits | train, val, test |
semanticTypes | scalar, vector, label.bool, label.category, label.text, spans, embedding, pose.se3, keypoints3d.hand21, skeleton.hand21, skeleton.body22, keypoints2d, confidence, calibration.stereo, calibration.cam_imu, depth.video, mask.video, video.preview, ros2.mcap, action.joint, action.ee_pose, json |
facts | kind, format, privacy_required, duration_s, cameras, stereo, imu, action, recorded_hand_pose, gripper_width, episodes |
privacy | redacts, numbers_only |
services | vlm |
runParameters | raw, recording, version, episode, out, ctx, state |
Next
Image algorithms
Python in the browser covers most needs, but sometimes your best code is C++, Rust or a model with its own stack. An image algorithm lets you bring it as a container. The platform treats it like any other step: same categories, same ports, same checks on what it writes. Only the packaging differs.
The arrangement is simple. The container reads a job file and its inputs from fixed folders, writes its outputs to fixed folders and exits with a code. Since there is no decorator to read, you write the interface by hand as algorithm.yaml, and embodiflow algorithm push bakes it into the image label io.embodiflow.algorithm.
What the container does
- Read
/embodiflow/config/job.json. - Read inputs under
/embodiflow/input/<port>/and write outputs under/embodiflow/output/<port>/, in the layouts below. - Optionally report progress in
/embodiflow/output/progress.json:{ "done", "total", "message" }. - On a refusal, write
/embodiflow/output/error.json:{ "code", "message" }, with a code in capital letters. - Use
/embodiflow/tmp/for scratch space. - Exit with one of the codes below.
job.json
The job file tells your container what it's working on: the run, the item, the parameters, the facts and where each port lives. This one is for an episode-level enrich step.
{
"contract": "embodiflow-runtime/v1",
"category": "enrich", "level": "episode",
"runId": "<uuid>", "stepId": "success", "recordingId": "<uuid>",
"item": { "episodeIndex": 3, "startS": 120.4, "endS": 161.0, "task": "pick up the cup" },
"params": { "threshold": 0.5 },
"facts": { "kind": "human", "stereo": true, "imu": true, "privacy_required": true, "duration_s": 40.6 },
"inputs": { "recording": { "type": "recording", "root": "/embodiflow/input/recording" },
"episodes": { "type": "episodes", "root": "/embodiflow/input/episodes" } },
"outputs": { "features": { "type": "features", "root": "/embodiflow/output/features" } }
}An optional input that is absent is simply missing from inputs.
Layouts at a port root
| Type | Layout | Validated when the step finishes |
|---|---|---|
raw | Files at their upload-relative paths. | No check. |
recording | The LeRobot v3 tree plus meta/embodiflow/recording.json. | The canonical rules R1 to R7 and embodiflow-recording/v1. |
features | features.json, frames.parquet, episodes.parquet and files/**. | embodiflow-features/v1 |
checks | checks.json and evidence/**. | embodiflow-checks/v1 |
episodes | episodes.json. | embodiflow-episodes/v1 |
version | version.json and urls.json, with presigned links. | Input only. |
selection | selection.json. | embodiflow-selection/v1 |
artifact | artifact.json and the files. | embodiflow-artifact/v1 |
A per-frame feature needs exactly one row per frame in frames.parquet. A per-episode value is keyed by episodeIndex, its position in the connected episodes document. Times in checks.json and episodes.json are seconds on the recording timeline.
Exit codes
| Exit code | Meaning | The step ends |
|---|---|---|
| 0 | Done. | succeeded |
| 85 | This data is not for me. | not applicable |
| 87 | The data is broken. | failed; the recording is quarantined |
| 88 | Try again: network, GPU busy. | retried, then failed |
| 1 | A bug. | failed; the log is kept |
Before exiting with 85 or 87, write the code and message to error.json. The step message then reads <code>: <message>.
algorithm.yaml
This file is the same document a Python decorator produces, with the schema embodiflow-algorithm/v1. Here is the motion energy algorithm from Your first algorithm, declared for an image:
apiVersion: embodiflow-algorithm/v1
name: motion-energy
title: Motion energy
category: enrich
features:
- name: motion_energy
type: scalar
per: frame
dtype: float32
unit: none
params:
step: { type: integer, default: 1, minimum: 1, title: Frame step }
resources: { cpu: 4, memory: 8Gi, timeout: 30m }Test locally, then register
You don't have to start from an empty folder. embodiflow algorithm init <dir> --category <category> --lang image writes an algorithm.yaml, a Dockerfile with an exec-form ENTRYPOINT and an entry script that already writes the outputs of the category. From there the loop looks like this:
# write my-algo/algorithm.yaml (above) and a Dockerfile by hand
embodiflow algorithm validate my-algo
embodiflow algorithm test my-algo --build --recording <recording-id>
docker build -t my-algo my-algo && docker save my-algo -o my-algo.tar
embodiflow algorithm push my-algo --archive my-algo.tar --registry <registry-host>validate checks algorithm.yaml with the same parser the platform uses. test runs the container on your machine and checks its outputs with the platform's rules. push imports the image archive into your team's registry and registers the algorithm with an image reference pinned to its digest.