Skip to main content
This guide outlines how to let an LLM control a robot with code. CodeControl serves an embodiment’s parts to a Python kernel and the kernel’s robot.move follows Code Control. It is attached the way DirectControl is in the Direct Control guide, and it takes the same embodiments.
1

Write a single-env bridge

Code control drives single-env sims. The action needs a control kind, names, and bounds, as the PointArm bridge in Writing a bridge has.
2

Attach CodeControl to the endpoint

env.py
The embodiment is the same one DirectControl takes, so a robot with its own embodiment can check more than a contract does. sim.capabilities() now returns robot and control, an mcp capability with the tools python, view_image and done. control.result_extra() adds the sandbox mode, the cells run and the robot calls to the episode’s result.
3

Point a tool-calling agent at it

Any agent that opens control and calls its tools works:
4

Or use a language-model agent

create_code_agent builds a HUD gateway agent with the Code Control prompt. It needs HUD_API_KEY:
A Claude agent keeps the images of its last 10 turns, and older ones come back through view_image. For another model, pass images_kept=None.
Settings come from RUA_CC_<NAME> variables, or from the settings argument of CodeControl(embodiment, settings=...), which wins. They are in the reference. The agent now has python and view_image, and replies as described in the reference. Every played tick also streams to the rollout’s trace when HUD_API_KEY is set in the environment’s process.