Skip to main content
This page builds the smallest complete robot rollout: a simulated gripper written as a bridge, a HUD environment that serves it with direct control, and a scripted agent that moves it to a reward. Everything runs locally, with no API key and no GPU. If you already have a Gym env, you can skip the bridge: serving a gym env serves it and adds direct control.

1. Install

rua needs Python 3.11 or 3.12.
These pages describe rua 0.2.4 and later. The rua 0.0.1 release on PyPI holds only the eval interface. To try an unreleased commit, install "rua @ git+https://github.com/hud-evals/rua.git@<sha>".

2. Write a simulator

A simulator is a RobotBridge: three hooks and a contract that describes the robot’s action and observations. This one is a gripper that tracks its commanded (x, y) exactly. It succeeds once x reaches 0.5 with the gripper closed. Save it as sim.py:
sim.py
A bridge gives you control over grading and the contract, and the bridge guide covers it. A Gym env needs no bridge: attach_gym serves it, and direct control needs only a short contract.

3. Declare the environment

RobotEndpoint runs the bridge in its own process. DirectControl serves the robot as one MCP move tool, and ContractEmbodiment builds the robot’s parts from the contract alone. The task template resets the sim, hands the agent the sim’s instruction as its prompt, and returns the sim’s grade. Save it as env.py:
env.py

4. Move the robot

An agent is anything that opens the control capability and calls its tools. This one plays two fixed move calls, each a list of timed keyframes. In practice the agent is a tool-calling LLM, as in the last section. Save it as run.py:
run.py

5. Run it

The second reply says ended, because the task succeeded while the second move played. Each spawn also prints a harmless RuntimeWarning from runpy about rua.sim.bridge, left out of the output above, and warnings from HUD, which you can silence with python -W ignore run.py. Try a move that is too fast, such as "t": 0.5 for the arm. The reply is vetoed and says how long the move needs. Nothing moves.

What just happened

  1. LocalRuntime loaded env.py. RobotEndpoint started the bridge in its own process, and DirectControl served a control capability next to the robot wire.
  2. The reach template called sim.reset(...). The sim reset itself and returned its instruction as the prompt.
  3. The agent opened control and called move. Each call was checked against the contract’s limits and the speeds you gave ContractEmbodiment, then played tick by tick on the sim.
  4. When the task succeeded, the template returned sim.result(): a score of 1.0. The score became the reward.
With a HUD_API_KEY set, the same run also streams every tick’s state, every move request and the camera video to a trace on hud.ai.

Let an LLM drive it

Swap the scripted agent for a model from the HUD gateway. create_direct_agent builds one with the system prompt for move, and needs HUD_API_KEY. In run.py, replace Scripted() with:
See the direct control guide.

Next steps

Concepts

The sim process, the wire, slots and the agent loop.

Serving a gym env

Build args, vectorized envs, and contract files.

Direct control

Spaces, units, settings and two arms.

Code control

Let an LLM write Python against the same checked moves.