Skip to main content
A rua rollout has two sides. The environment side runs the simulator, serves the robot to the agent as tools, and grades the episode. The agent side is a language model that calls those tools. HUD’s rollout engine sits above both: it starts the environment, runs a task template, hands the agent a Run, and records the reward.

The sim process and its bridge

A simulator usually wants the main thread, a GPU, and minutes to boot. rua keeps it out of the HUD environment’s process: the sim runs in a sim process of its own, wrapped in a bridge. RobotBridge is the base class. A subclass implements three hooks, all synchronous: The bridge serves two things: the robot wire, a WebSocket the controls connect to, and the control channel, a JSON-RPC link the environment uses to reset and grade episodes. When it serves (bridge.serve()), the calling thread becomes the sim thread and runs every hook, so a simulator that must own the main thread works. GymBridge is a ready-made bridge for any gym-style env, and attach_gym is the one-line way to use it. See Serving a gym env and Writing a bridge.

The endpoint

RobotEndpoint is the environment’s handle on a sim process. It either spawns the sim program and owns it, or attaches to a remote one something else runs. Its calls map one-to-one onto the control channel: attach_gym builds the endpoint and wires it into the environment’s initialize, shutdown and task_teardown hooks for you.

The contract

The contract is the env’s self-description, published inside the robot capability. Both sides read it: the controls learn the robot’s spaces from it, and telemetry labels plots with it.
Each feature has a role: "observation" or "action". Observation features whose type is an image type (rgb, bgr, gray, depth) are cameras; the rest are state. There is one action feature. Every field rua reads is listed in the Contract reference.

Slots and tokens

A bridge serves num_envs slots, one per parallel env in the simulator (1 by default). Each episode claims one:
  • sim.reset(...) claims a slot and returns a token naming it. When every slot is free, the claim also resets the whole simulator; later claims join that batch, and must pass the same task args.
  • A client sends the token as the first frame on the wire, which binds its connection to the slot.
  • sim.result(token=...) grades that slot and frees it. A freed slot is reused only once every slot is free again, so a batch always runs whole episodes together.
A single-env bridge doesn’t need the token: with exactly one claimed slot, a tokenless claim binds to it. Direct control and code control connect without one, so they drive single-env sims. A vectorized bridge needs the token, which a template can pass to a client that opens the wire itself through the task’s bindings:
The simulator steps in lockstep. Each tick, the bridge waits until every live slot has sent an action, then calls step once with all of them stacked. Slots that are free, finished or disconnected get a hold action (zeros by default), so the batch keeps its shape. A slot silent for longer than step_timeout (30 s) is dropped from the barrier so its peers can keep going. max_ticks, passed to sim.reset(max_ticks=...), caps an episode’s ticks. The bridge enforces it and the sim never sees it.

The robot wire

The robot capability speaks rua/0: msgpack frames over a WebSocket, with numpy arrays encoded as tagged maps. The env is the server, and the controls dial in. The full frame sequence is in the Capabilities reference. Importing rua registers RobotClient as HUD’s client for rua/0, so run.client.open("robot") returns one. Direct control and code control hold the wire themselves, so the agent never opens it.

Direct control

DirectControl serves the robot as one MCP move tool, so an LLM can drive it with keyframed moves. It reads the sim over the wire, checks each move, plays it tick by tick and records it. See Direct Control.

Code control

CodeControl serves the robot to an LLM that writes Python. A kernel lives for the episode, and the code moves the robot with robot.move, which takes the same keyframes and runs the same checks as move. See Code Control.

Telemetry

Every run records onto its HUD trace as robot steps, tagged with the schema hud.robot.step.v1:
  • an observation step per tick, with labelled numeric state;
  • an inference step per request, with the rows it played and how it ended;
  • video segments, one H.264 stream per camera, in CMAF fragments.
DirectControl and CodeControl record automatically. Reporting needs HUD_API_KEY; without it, recording is a no-op. See Recording traces.

The eval interface

Separate from all of the above, rua re-exports a minimal, synchronous eval interface for robot tasks: a Robot with tools, reset and step, an Agent with act, and run to play one episode. It does not use HUD, the wire or the contract. See The eval interface.