Python SDK
The adamo Python package runs a robot: it streams hardware-encoded video, delivers operator control to callbacks, publishes and subscribes on other keys in your organization, keeps robot state, and lists and downloads recordings. It is the canonical Rust SDK compiled as a Python extension, so the Rust and Python SDKs share one implementation. Python 3.8+.
Install
Section titled “Install”pip install adamoPre-built wheels are published for Linux x86_64, Linux aarch64 (Jetson), and macOS arm64. Video support is built in.
Shared-memory producers written in Python (see Adding Cameras) also need the iceoryx2 Python package at the version the SDK links (0.8.1):
# Linux x86_64, macOS, Windowspip install 'iceoryx2==0.8.1' numpy
# Jetson and other Linux ARM64 machinespip install 'adamo-shm-runtime==0.8.1.post1' numpyUpstream iceoryx2 publishes no Linux ARM64 wheel, so pip install iceoryx2 on a Jetson tries to compile it from source and usually fails. adamo-shm-runtime is Adamo’s prebuilt ARM64 wheel of the same iceoryx2 release. Your code still uses import iceoryx2. Install one package or the other, never both. adamo doctor reports which one is installed.
The consumer side (attach_video(shm=...)) needs nothing extra.
Top-Level API
Section titled “Top-Level API”import adamo| Symbol | Description |
|---|---|
Robot | A robot: video tracks, operator control, subscriptions, state, recording. |
VideoTrack | Push handle returned by Robot.video. |
AudioTrack | Push handle returned by Robot.audio. |
AudioInput / AudioOutput | Audio capture sources and playback outputs. |
AudioSampleRate / AudioChannels / AudioFrameDuration / AudioApplication | Opus encoder settings. |
connect / ClientSession | Shared client connection for pub/sub and media reception (1.0.9+). |
VideoReceiver / VideoFrame | Receive decoded video and access its image or CPU RGBA pixels. |
VideoOutput / VideoImage | Request an output format and memory location; inspect or export the decoded image. |
Session | The robot’s connection, from robot.session: publish and subscribe on other keys. |
Publisher | Persistent publisher returned by Session.publisher. |
Priority | Named priority levels (REAL_TIME, INTERACTIVE_HIGH, …, BACKGROUND). |
Sample | One sample received on a subscribed key. |
Rate | Ticks at a fixed rate for send loops. |
Subscriber / CallbackSubscriber | Pull and callback subscription handles. |
ControlSample | One operator control message delivered to Robot.on. |
StateStore / TaskRunner | Robot state and task runs, from Robot.state_store() / Robot.task_runner(). |
state_topic(robot, key) / state_topic_all(robot) | {robot}/state/{key} and {robot}/state/**. |
Recording / ControllerMask | What the Adamo data service records for this robot. |
Recordings / RecordingInfo / Export / Struct | List, download and export your organization’s recordings. See Recording and Exporting Data. |
Inference | A cloud policy run started by Robot.inference. |
Training / Dataset | A training run on a hosted base model, and a dataset built on Adamo from recordings. See Training Policies. |
Datum / ModelInput / FramePointer / AdamParams | What a training loop sends: examples and optimizer settings. |
Embodiment / Joints / Gripper / Controls / BimanualArms | The layout of a robot’s state and action vectors. |
ModelWeights | Weights saved by a training run, which Robot.inference runs by path. |
FaceBlur | Face masking settings for a video track. |
EncoderSelectionError / EncoderLibraryError | No requested encoder could start. |
xr | Typed XR tracking messages and subscribe_xr_control. |
class adamo.Robot: def __init__( self, api_key: str | None = None, # defaults to ADAMO_API_KEY, then the key adamo login saved name: str | None = None, protocol: str = "quic", # "quic", "tcp", or "udp" record: bool | Recording = False, ): ...With a valid API key, Robot connects to your organization’s relay and publishes video over that connection. protocol="quic" is the right choice in every case; "tcp" is a diagnostic or telemetry-only fallback for networks that block UDP — don’t teleoperate over it. A rejected API key raises ConnectionError.
With no API key at all (no api_key, no ADAMO_API_KEY and no key saved by adamo login), the robot warns and runs locally instead, like Robot.local(): it doesn’t reach the relay, and receivers connect with adamo.connect_local() using the address and pairing key it prints.
Every key the robot uses is scoped to your organization; you write {robot}/{topic} (for example my-arm/sensors/imu).
Properties
Section titled “Properties”robot.name -> strrobot.session -> Session # the robot's connection, for publishing and subscribing on keysRobot.attach_video
Section titled “Robot.attach_video”robot.attach_video( name: str, *, device: str | None = None, # V4L2 device path, e.g. "/dev/video0" pipeline: str | None = None, # GStreamer source fragment ending in raw video shm: str | None = None, # iceoryx2 service name produced by another process codec: str = "h264", # "h264" or "av1" width: int = 1280, height: int = 720, fps: int = 30, bitrate_kbps: int = 2000, pixel_format: str | None = None, encoder: str | None = None, adaptive_bitrate: bool = True, rate_control: str | None = None, # "cbr" or "vbr" min_bitrate_kbps: int | None = None, max_bitrate_kbps: int | None = None, bitrate_priority: float = 1.0, keyframe_distance: float = 2.0, stereo: bool = False, stereo_left: bool = False, # left eye of a two-track stereo pair stereo_right: bool = False, # right eye of a two-track stereo pair backend: str | None = None, # "auto" or "hw_pipeline" allow_missing: bool = False, face_blur: bool | FaceBlur | None = None,) -> NoneAttach a camera track that the SDK captures, encodes, and publishes. Pass exactly one of device=, pipeline=, or shm=; passing more than one raises ValueError. See Adding Cameras for each source.
| Source | pixel_format |
|---|---|
device= | Optional. Omit it to capture the driver’s preferred uncompressed format, or pass "MJPEG" to capture MJPEG (decoded on the CPU before encoding). |
pipeline= | Optional. Omit it to accept the pipeline’s raw output, or pass "NV12", "YUY2", "UYVY", or "MJPEG". |
shm= | Required, together with width and height, matching the producer exactly. Raw formats only: NV12, NV21, I420, YUY2, UYVY, BGRA, RGBA, BGRX, RGBX, RGB, BGR, GRAY8, GRAY16_LE. |
Omitting encoder selects a hardware encoder for codec, which is the recommended setting; there is no automatic software fallback. Explicit choices on Linux are "nvenc", "vaapi", "v4l2m2m" (Raspberry Pi 4 and Qualcomm), and "jetson" (aarch64 builds with Jetson support); "vtenc_h264" on macOS. "openh264" is CPU encoding for boards with no hardware encoder, such as the Raspberry Pi 5; it is not recommended anywhere else, and on a host with encoder hardware it fails unless a person has unlocked it on that host. If startup fails with an EncoderSelectionError on any other host, see No hardware encoder found before changing encoder. GStreamer element names such as "nvh264enc", "vah264enc", and "nvv4l2h264enc" are accepted as aliases.
width, height, and fps set the track’s output for every source and default to 1280x720 at 30 fps. A pipeline= source is converted and scaled to them rather than published at its own size, so pass the pipeline’s output size explicitly. The pipeline must end in system memory; see GStreamer Pipelines.
rate_control overrides the hardware encoder’s rate-control mode: "cbr" (constant bitrate) or "vbr" (variable bitrate). Omit it to keep the encoder’s default, which follows adaptive_bitrate. Pair "vbr" with adaptive_bitrate=False to hold a fixed quality budget while simple scenes use fewer bits. On VA-API, an explicit rate_control is strict for H.264: startup fails if the GPU lacks that mode. With it omitted, the encoder switches to CBR when the GPU lacks VBR (and the reverse), and fails only if the GPU supports neither, for example a GPU limited to constant-QP.
With allow_missing=True a track waits for a late or idle source until close(); otherwise it fails after ten seconds without a frame.
stereo_left=True and stereo_right=True mark the two eyes of the robot’s one two-track stereo pair. Both eyes need matching geometry, fps, codec, and bitrate settings. See Stereo Cameras.
Encoded shared-memory input (MJPEG, H.264, H.265) and passthrough are not supported by the Python Robot in this release.
Robot.video
Section titled “Robot.video”robot.video( name: str, *, pixel_format: str, # required: a raw buffer carries no layout width: int = 1280, height: int = 720, fps: int = 30, bitrate_kbps: int = 2000, codec: str = "h264", encoder: str | None = None, adaptive_bitrate: bool = True, rate_control: str | None = None, # "cbr" or "vbr" min_bitrate_kbps: int | None = None, max_bitrate_kbps: int | None = None, bitrate_priority: float = 1.0, keyframe_distance: float = 2.0, stereo: bool = False, stereo_left: bool = False, # left eye of a two-track stereo pair stereo_right: bool = False, # right eye of a two-track stereo pair backend: str | None = None, # "auto" or "hw_pipeline" allow_missing: bool = False, face_blur: bool | FaceBlur | None = None,) -> VideoTrackCreate a track whose frames you push from Python with track.send(frame). The first send() starts the robot’s runtime on a background thread if you haven’t called robot.run(). With adaptive_bitrate (the default) the encoder follows the congestion forecast between min_bitrate_kbps and max_bitrate_kbps; bitrate_priority weights this track’s share when several tracks compete. stereo_left and stereo_right work as they do for attach_video; send both eyes of one moment back to back.
Robot.on
Section titled “Robot.on”robot.on(channel: str, callback: Callable[[ControlSample], object], *, max_age: float | None = 1.0) -> None
@robot.on(channel: str, *, max_age: float | None = 1.0)def handler(sample: ControlSample): ...Receive operator control sent to this robot on {robot}/control/{channel}. channel may use * and ** wildcards (for example json/xr/**). Payloads are JSON or MessagePack; the SDK tells them apart and hands the callback plain Python values in sample.message. Typed messages carry a type entry (Keyboard, OperatorControl, Safety, Joy, JoystickCommand, JointState, PoseStamped, PoseArray, Bool, XrFrame, …). The browser’s XR tracking in ROS-envelope CDR is also accepted and normalized to the json/xr/... channels. See Receiving Control.
max_age (seconds) drops samples whose fabric timestamp is older than the limit once the clock is synchronized; pass None to deliver every sample. Callbacks run on an SDK thread, one per subscription; an exception in a callback is printed and the subscription keeps running.
robot.control_stats() -> tuple[int, int, int, int] # received, delivered, dropped stale, undecodablerobot.attach_audio( name: str, *, input = AudioInput.Default(), # Alsa(device), Gstreamer(pipeline) or TestTone() sample_rate = AudioSampleRate.Hz48000, # Hz8000, Hz12000, Hz16000, Hz24000 or Hz48000 channels = AudioChannels.Mono, # Stereo is a ceiling that never upmixes frame_duration = AudioFrameDuration.Ms10, # Ms2_5, Ms5, Ms10, Ms20, Ms40 or Ms60 bitrate_kbps: int = 48, # 6 to 510 application = AudioApplication.LowDelay(), # Voice(inband_fec=False) or Music(inband_fec=False) dtx: bool = False, # silence costs a few bytes every 200 ms) -> None
robot.audio(name: str, *, sample_rate, channels, frame_duration, bitrate_kbps, application, dtx) -> AudioTrackrobot.audio_tracks() -> list[str]robot.audio_receiver(track: str, *, sample_rate, channels, max_reorder_delay_ms, max_queued_frames) -> AudioReceiverrobot.play_audio(track: str, *, output=AudioOutput.Default(), max_latency_ms=150, sample_rate, max_reorder_delay_ms) -> AudioPlaybackAudioInput.Default() captures the default input (ALSA default on Linux,
Core Audio on macOS). The track is Opus-encoded and published on
{robot.name}/audio/{name}. robot.audio() returns an AudioTrack
for PCM your code produces. audio_tracks, audio_receiver and play_audio
receive tracks published on this robot, such as an operator’s microphone;
AudioOutput is Default(), Alsa(device) or Gstreamer(sink).
receiver.recv(timeout=None) returns the next AudioFrame in capture order;
frame.samples is an int16 NumPy array shaped (frames, channels). See
Streaming Audio.
State and task runs
Section titled “State and task runs”robot.state_store() -> StateStore # this robot's state on {robot}/state/**robot.task_runner() -> TaskRunner # this robot's task run on {robot}/state/task_runSee Robot State.
Recording
Section titled “Recording”robot.start_recording() -> None # record until stop_recording(), whether or not anyone is in controlrobot.stop_recording() -> NonePass record=True (or a Recording) to the constructor to have the Adamo data service record this robot automatically. See Recording.
Cloud inference
Section titled “Cloud inference”robot.inference(policy: str, *, regions: list[str] = [], stale_observation_seconds: float | None = 2.0, **arguments) -> InferenceRun a policy against this robot. policy is the path your organization saved weights or a training state at, or the name of a model Adamo serves, and the other arguments go to the policy, most often task and cached_tasks (see Changing the task). regions lists where the GPU may run, as in Choosing the region. It reads the robot’s cameras and state and publishes actions on its control channels. inference returns as soon as the service accepts the request; the run then waits for a GPU and for the policy to load.
with adamo.Robot(name="yam-london") as robot: with robot.inference("my-fine-tuned-policy/final", task="stack four cubes") as run: run.wait()Inference.status() returns a dict, wait() blocks until the run stops, set_task(task) gives the policy its next task, and stop() ends it. See Cloud Inference for the keys a policy reads and writes, the control messages it publishes, and the HTTP calls.
Layout
Section titled “Layout”robot.set_layout(path: str | os.PathLike, name: str = "default") -> NoneSet the robot’s layout named name to the JSON file at path: its widgets, the tree of cameras and widgets its page shows, and their placement in VR. If the robot already has a layout named name, it is overwritten. The page opens on the layout named default.
robot.show_layout(name: str) -> NoneShow the layout named name to every operator of the robot, on their open pages and in VR, replacing the one they picked. Pages opened later show it too, until the robot’s process ends. Raises ValueError if the robot has no layout with that name.
robot.remove_layout(name: str) -> NoneRemove the robot’s layout named name. Raises ValueError if the robot has no layout with that name.
See Custom Layouts for the file, switching layouts live and the adamo layout command.
Lifecycle
Section titled “Lifecycle”robot.run() -> NoneBlock driving the attached video tracks. run() requires at least one track from attach_video or video, and raises ValueError otherwise. Control callbacks and subscriptions are delivered without run().
robot.close() -> NoneStop subscriptions, tracks, and the connection. Robot supports the context-manager protocol.
adamo.Robot.local(name: str, port: int = 17447, pairing_key: str | None = None) -> RobotStart a robot locally without cloud login, even when an API key is set; the SDK manages its certificates. robot.local_port and robot.local_pairing_key report what it listens on. Receive from it with adamo.connect_local(address, pairing_key).
VideoTrack
Section titled “VideoTrack”Returned from robot.video().
track.name, track.width, track.height, track.pixel_formattrack.frame_len -> int # exact bytes per frametrack.send(frame) -> Nonetrack.close() -> Nonesend takes bytes, bytearray, a memoryview, or a C-contiguous NumPy uint8 array (uint16 for GRAY16_LE) of exactly frame_len bytes; a wrong size or a non-contiguous array raises ValueError (use numpy.ascontiguousarray(frame)). A newer frame replaces one the encoder has not read yet. If the encoder or transport fails, the next send raises RuntimeError.
Supported pixel_format values: NV12, NV21, I420, YUY2, UYVY, BGRA, RGBA, BGRX, RGBX, RGB, BGR, GRAY8, GRAY16_LE.
AudioTrack
Section titled “AudioTrack”Returned from robot.audio(). Push interleaved int16 PCM to feed the Opus encoder.
| Attribute / method | Type | Description |
|---|---|---|
name | str | Track name. |
sample_rate, channels | int | The PCM format send expects. |
send(samples, capture_time_us=None) | None | Push a C-contiguous numpy.int16 array or little-endian bytes holding any whole number of frames. capture_time_us is when the first sample was captured (UNIX µs); by default, now. Blocks while 64 chunks wait for the encoder. The first call starts the robot’s runtime when run() is not driving it. |
close() | None | End the track; subsequent send() raises RuntimeError. |
Session
Section titled “Session”robot.session.org -> str # the organization slug resolved from the API key
robot.session.subscribe(key: str) -> Subscriberrobot.session.subscribe(key: str, *, callback: Callable[[Sample], object]) -> CallbackSubscriber
robot.session.put(key: str, payload: bytes, *, priority: int = 100, express: bool = False) -> Nonerobot.session.publisher(key: str, *, priority: int = 100, express: bool = False, reliable: bool = False) -> PublisherSubscribe to any organization-relative key expression, such as another robot’s telemetry. Wildcards:
| Pattern | Matches |
|---|---|
my-arm/sensors/* | one level under sensors/ |
my-arm/sensors/** | everything under sensors/ |
*/tasks/signal | that key on every robot |
With callback, samples are delivered on an SDK thread and a CallbackSubscriber is returned; the subscription keeps delivering after the handle is dropped, until close() on the handle or on the robot.
Publishing
Section titled “Publishing”put and publisher were added in adamo 1.0.6. put sends one value, such as a configuration change or a single event. For a stream on one key, declare a publisher once and call put on it. express skips batching for lower latency, priority (0-255, or an adamo.Priority constant) orders it against other traffic, and reliable retransmits on loss.
import structimport time
joints = robot.session.publisher("my-arm/proprioception/joints", express=True)while running: joints.put(struct.pack(">Q6f", time.time_ns() // 1000, *positions))joints.close()For values that late readers should still get, use robot.state_store() instead: it keeps the latest value per key and answers reads. See Sending and Receiving Data for more.
Publisher
Section titled “Publisher”publisher.put(payload: bytes) -> None # ValueError after close()publisher.close() -> NoneSupports the context-manager protocol. A publisher stays declared until close(), the end of its with block, or garbage collection, and keeps working after the robot.session handle that declared it is dropped.
Sample
Section titled “Sample”sample.key -> str # organization-relative keysample.payload -> bytessample.is_delete -> boolsample.timestamp_us -> int | None # publisher's fabric timestampsample.timestamp -> float | None # the same, in secondsSubscriber
Section titled “Subscriber”for sample in subscriber: # blocks per sample; ends on close() ...
subscriber.recv(timeout=None) # Sample; TimeoutError after timeout secondssubscriber.try_recv() # Sample | None, non-blockingsubscriber.close()Supports the context-manager protocol.
Receiving video
Section titled “Receiving video”Starting with SDK 1.0.9, Python can receive and decode live H.264 or AV1 video. By default, frames are available as CPU NumPy arrays. Receivers also support CUDA NV12 and CUDA RGBA output for GPU perception or inference.
Open a shared client session with adamo.connect(). It reads ADAMO_API_KEY
or the key adamo login saved by default, or accepts an API key explicitly.
Select the robot and track. The receiver detects the codec by default.
session.video_receiver( robot: str, track: str, *, max_queued_frames: int = 1, codec: str | None = None, # "h264", "av1", "auto", or None output: adamo.VideoOutput | None = None, receiver_abr_enabled: bool = False,) -> adamo.VideoReceiverreceiver.recv(timeout=5.0) waits up to five seconds for a decoded frame and
raises TimeoutError if none arrives. Both the session and receiver support
context managers; closing the session also closes its receivers.
Receive frames as NumPy arrays
Section titled “Receive frames as NumPy arrays”Install NumPy support with pip install 'adamo[video]', then receive a frame
from a robot’s camera track:
import adamo
with adamo.connect() as session: # reads ADAMO_API_KEY or the saved key with session.video_receiver( "my-robot", "head", max_queued_frames=1 ) as receiver: frame = receiver.recv(timeout=5.0) rgba = frame.rgba # read-only NumPy uint8 array: (height, width, 4) rgb = rgba[..., :3].copy() # writable RGB array for image processingReplace "my-robot" and "head" with the robot and track names. If you
specify a codec, use the one the publisher sends. A client can receive video
without registering a robot or claiming control.
Call receiver.recv(...) repeatedly to consume the stream. The native worker
continues decoding between calls. max_queued_frames=1 (the default) retains
the latest decoded frame when processing is slower than the stream, while
preserving the decoder’s reference chain. Each camera has its own worker.
Frames also expose width, height, sequence, keyframe, and
capture_time_us (the sender’s Unix timestamp in microseconds). The NumPy
array remains valid after the next receive or after the session closes.
Enable receiver-driven bitrate adaptation
Section titled “Enable receiver-driven bitrate adaptation”session.video_receiver() sends delivery and throughput reports
automatically. Pass receiver_abr_enabled=True when opening each track whose
reports should be allowed to adjust the robot’s bitrate.
import adamo
with adamo.connect() as session: with session.video_receiver("my-robot", "head", receiver_abr_enabled=True) as receiver: frame = receiver.recv(timeout=5.0)If your app holds control, associate the receiver with that active claim. Use
the same controller and session ID as the app’s session.announce_control()
token. This lets the robot identify the operator’s receiver when multiple
viewers are watching.
# Call inside the receiver's context while the control token is held.receiver.set_feedback_control_owner( controller=operator_user_id, session_id=control_session_id,)Call receiver.set_feedback_control_owner() when releasing control if the
receiver stays open.
Receive NV12 in CUDA memory
Section titled “Receive NV12 in CUDA memory”Use NV12 when your downstream GPU processing accepts the decoder’s native
YUV format. Pass output=adamo.VideoOutput(format="nv12", memory="cuda")
and consume frame.image through DLPack:
import adamoimport torch
with adamo.connect() as session: with session.video_receiver( "my-robot", "head", codec="av1", # or "h264"; must match the publisher output=adamo.VideoOutput( format="nv12", memory="cuda", device_ordinal=0, ), ) as receiver: frame = receiver.recv(timeout=5.0) nv12 = torch.utils.dlpack.from_dlpack(frame.image) # CUDA uint8 tensor: (height * 3 // 2, width)device_ordinal selects the NVIDIA GPU used for the output; its default is
0. NV12 is a semi-planar format: the first height rows contain luma (Y),
followed by height // 2 rows of interleaved U/V chroma. This tensor is not an
RGB image. The image wrapper exposes width, height, planes,
color_matrix, and color_range, as well as color primaries and transfer
function metadata, for consumers that perform their own conversion.
Receive RGBA in CUDA memory
Section titled “Receive RGBA in CUDA memory”If your pipeline expects color channels rather than YUV planes, request
format="rgba" with the same memory="cuda" setting:
import adamoimport torch
with adamo.connect() as session: with session.video_receiver( "my-robot", "head", codec="av1", output=adamo.VideoOutput( format="rgba", memory="cuda", device_ordinal=0, ), ) as receiver: frame = receiver.recv(timeout=5.0) rgba_gpu = torch.utils.dlpack.from_dlpack(frame.image) # CUDA uint8 tensor: (height, width, 4), in RGBA orderNVDEC decodes to NV12, then the SDK’s embedded CUDA kernel converts NV12 to
RGBA on the GPU. There is no CPU readback in this path. The output has four
channels with alpha set to 255; conversion handles supported BT.601/BT.709
full- and limited-range SDR video. It does not perform HDR tone mapping.
The CUDA conversion kernel ships with the SDK, so you do not need NVCC or
NVRTC to use it.
Copies, CPU access, and requirements
Section titled “Copies, CPU access, and requirements”DLPack export stays on the GPU, but it makes one independent device-to-device
copy per export. This keeps the decoded frame immutable while allowing the
consumer’s tensor to be modified. The exported tensor owns its allocation and
remains valid after the frame or receiver is closed. Reuse the tensor rather
than exporting the same image repeatedly; copy=False and cross-device
DLPack export are not supported.
frame.rgba remains available as a compatibility API: it materializes a
cached, read-only CPU NumPy uint8 array of shape (height, width, 4). For
CUDA NV12 output, accessing it converts to RGBA on the GPU and downloads the
result; for CUDA RGBA output, it downloads the existing RGBA pixels. Use
frame.image for a GPU pipeline to avoid that readback. Omitting output
keeps the default CPU RGBA behavior.
CUDA reception requires Linux, an NVIDIA GPU and driver with NVDEC support
for the selected codec, and a CUDA-enabled PyTorch installation for the
examples above. If the requested backend or output format/memory combination
is unavailable, session.video_receiver(...) raises an exception. It does
not automatically fall back to CPU output. Stream-specific restrictions can
also produce errors when the encoded headers arrive. The current NVIDIA
path supports progressive 8-bit 4:2:0 SDR, low-delay streams; H.264 streams
with B-frames or frame reordering are unsupported. This NVDEC path does not
provide the Jetson Orin V4L2/NVMM decoder backend.
StateStore
Section titled “StateStore”store = robot.state_store()store.set(key: str, value) -> None # bytes as given, str as UTF-8, anything else as JSONstore.get(key: str) -> bytes | Nonestore.get_json(key: str) # decoded JSON, or Nonestore.delete(key: str) -> NoneTaskRunner
Section titled “TaskRunner”runner = robot.task_runner()# subtasks: list of {"id", "name"} dicts or (id, name) tuplesrunner.select(task_set_id: str, name: str, subtasks) -> Nonerunner.advance() -> None # one pedal press; ValueError before any set is selectedrunner.reset() -> None # back to idle without counting a repclass adamo.Rate(hz: float)Ticks hz times a second, for loops that send at a fixed rate. Iterate over it:
track = robot.video("sim", width=640, height=480, pixel_format="BGR")for _ in adamo.Rate(30): track.send(render_frame())The first loop runs immediately. A continue still waits for the next tick.
Or call sleep() at the end of each loop, as with ROS. The first sleep() waits one full period:
rate = adamo.Rate(30)while True: track.send(render_frame()) rate.sleep()Each tick waits for the next deadline on a fixed schedule that starts when the Rate is created, so the time the loop body takes does not slow the rate down. A tick that runs more than one period late starts a new schedule from that moment instead of catching up with a burst of ticks. The wait releases the GIL.
Typed XR control
Section titled “Typed XR control”from adamo.xr import XrFrame, XrController, PoseStamped, Joy, subscribe_xr_control
@subscribe_xr_control(robot, max_age=0.25)def on_xr(sample: adamo.xr.XrControlSample) -> None: if isinstance(sample.message, XrFrame) and sample.message.left: print(sample.message.left.pose.position.as_tuple()) # (x, y, z)subscribe_xr_control(robot, callback=None, *, channel=None, max_age=1.0) listens on every XR stream unless given a channel, skips anything that is not XR tracking, and delivers read-only typed messages: XrFrame (head, left, right, resumed, stamp), XrController (pose, tip, axes, buttons), Pose, PoseStamped, PoseArray, Joy, and Bool, built from Vector3 and Quaternion. Used without a callback it is a decorator. The browser’s default ROS-envelope CDR tracking is accepted and normalized, so /head_pose arrives as a PoseStamped on json/xr/head/pose.
Quaternions are always scalar-last x, y, z, w. XrControlSample.is_stale(max_age_seconds) judges freshness by the sender’s own stamp and treats an unstamped message as stale. From a robot.on callback, adamo.xr.message(sample) returns the typed message, or None when the sample is not XR tracking.
Recordings
Section titled “Recordings”Recording
Section titled “Recording”adamo.Recording( controller_mask: ControllerMask = ControllerMask.HUMAN | ControllerMask.POLICY, *, mode: RecordingMode.Episodes | RecordingMode.Continuous | RecordingMode.Interventions = RecordingMode.Continuous(), min_duration: float = 5, max_duration: float = 1800, max_size: int = 1_500_000_000, topics: list[str] = [], record_audio: bool = False, format: Literal["rrd", "mcap"] = "rrd", tags: list[str] = [],)What the Adamo data service records for a robot; pass it as adamo.Robot(record=...). controller_mask selects when to record, mode how the recording is cut into files and on which clock, topics the data to record next to the cameras and controls, record_audio the robot’s audio tracks, format the kind of file each recording is written as, a Rerun .rrd or an MCAP file, and tags the tags put on every recording. Files shorter than min_duration seconds are left out. See Recording a robot.
mode is one of RecordingMode.Episodes(frame_rate=FrameRate.Raw()), RecordingMode.Continuous(frame_rate=FrameRate.Raw(), post_roll=0.0, idle_timeout=120.0) or RecordingMode.Interventions(pre_roll=5.0, post_roll=0.0, frame_rate=FrameRate.Raw()). In Continuous mode, a teleoperator’s time in control after their last input is left out once idle_timeout seconds pass without another, and idle_timeout=None keeps it. See Modes.
Recordings
Section titled “Recordings”recordings = adamo.Recordings(api_key=None) # defaults to ADAMO_API_KEY, then the saved key
recordings.list( *, start=None, end=None, # datetimes or Unix seconds sessions=None, controllers=None, devices=None, tasks=None, tags=None, # all of them search=None, # every word in name, description, or session ID folder=None, # everything under this path) -> list[RecordingInfo]
recordings.download(recordings: list[RecordingInfo] | Dataset, directory=".") -> list[Path] | Pathrecordings.export(recordings, config: Export, format: Literal["lerobot", "rrd", "mcap"], save_folder=None, decoders=None) -> Dataset | list[RecordingInfo]recordings.export_audio(recordings, output_folder="audio", tracks=None, format="wav", download_folder=None) -> list[Path]list returns recordings that overlap start..end, oldest first. download writes each recording to {directory}/{device}/{name}.rrd, or .mcap for an MCAP recording, with its .json entry beside it, skipping files already there. For a Dataset, it waits for the build and writes the LeRobot files to {directory}/{name}. export runs on Adamo compute: "lerobot" returns a Dataset at once, and "rrd" or "mcap" waits and returns the exported recordings. A download that fails is retried with a fresh link, resuming from the bytes already written, with 1, 2, 4 and up to 30 s between attempts for up to 5 minutes, unless the recordings API refuses it (400, 401, 403 or 404). Each RecordingInfo carries id, device, session_id, display_name, description, tags, folder, controller, user_id, started_at, ended_at, frame_count, frame_rate, cameras, audio_tracks, topics, tasks, size_bytes, complete, and format ("rrd" or "mcap"). See Exporting recordings and Exporting audio.
Face masking
Section titled “Face masking”robot.attach_video("front", device="/dev/video0", face_blur=True)robot.attach_video("front", device="/dev/video0", face_blur=adamo.FaceBlur(padding=0.3, border=0.05))Masks faces on the robot before encoding, so unmasked faces never reach the network. Requires a wheel built with face masking and ONNX Runtime (pip install onnxruntime, or onnxruntime-gpu on NVIDIA and Jetson).
adamo.FaceBlur( *, model: str = "yunet", weights: str | None = None, # fine-tuned YuNet ONNX, converted to RGBA input padding: float = 0.25, border: float = 0.0, hold_frames: int = 2, max_box_age_frames: int = 3, score_threshold: float = 0.4, min_face_width: float = 0.01, mask_style: str = "pixelate", # or "fixed" mask_color: tuple[int, int, int] | None = None, mask_block_size: float = 0.025, backend: str = "auto", # "tensorrt", "cuda", "coreml" or "cpu")face_blur=True uses the default settings; pass a FaceBlur to change them. See Masking faces.
Concurrency model
Section titled “Concurrency model”All methods are synchronous. Control callbacks and subscription callbacks run on SDK threads, one per subscription — keep them short and hand state to your control loop under a lock. robot.run() blocks the calling thread driving the video pipeline; track.send() is thread-safe.
Errors
Section titled “Errors”| Exception | When |
|---|---|
ValueError | Invalid arguments: mutually exclusive sources, an unknown pixel format or encoder, a wrong frame size, run() with no video track. |
TypeError | A missing required argument, such as pixel_format for video(). |
ConnectionError | The API rejected the key, or the router could not be reached. |
EncoderSelectionError | No requested encoder could start. Carries track, stage, backend, code, and attempts. In a container, VM or CI runner this usually means the GPU is not passed through; see No hardware encoder found. |
EncoderLibraryError | Subclass of EncoderSelectionError: every attempted encoder failed to load its libraries; attempts includes library names and setup guidance. |
RuntimeError | A stream failed after startup, or a track was used after its run ended. |
TimeoutError | Subscriber.recv(timeout=...) received nothing in time. |
try: robot.run()except adamo.EncoderLibraryError as error: print(error) # library names, loader errors, installation guidanceexcept adamo.EncoderSelectionError as error: print(error.track, error.attempts)Sign in once per machine so scripts reach your organization without an API key in the code. adamo login opens your browser, or on a machine without one prints a link to open anywhere and asks for the code the page shows. It saves an API key for each of your organizations in ~/.config/adamo/credentials, which Robot, connect, Recordings and Training use when you pass no key and ADAMO_API_KEY is unset.
adamo login # sign in and save a key for each of your organizationsadamo orgs # list them, marking the one the SDK usesadamo use my-org # make the SDK use my-orgADAMO_ORG=my-org picks another saved organization for one command.
Doctor
Section titled “Doctor”adamo doctor diagnoses the local setup: Python and SDK versions, platform and glibc, API key validity, QUIC reachability (with a TCP probe that detects networks that block UDP), and hardware encoder availability. Run it first when anything misbehaves — the output is designed to be pasted into a support request. It exits non-zero when it finds a problem.
$ adamo doctor # or pass --api-key ak_...adamo doctor
✓ python 3.12.3 ✓ adamo SDK 1.0.3 ✓ linux x86_64 ✓ glibc 2.39 ✓ API key valid (org: my-org) ✓ QUIC transport connected, relay RTT 6.0ms ✓ H.264 hardware encoder: nvenc ✓ numpy available
No problems found.