Skip to Content

Use it from code

SDK

Read your takes and drive a robot from your own programs — in Python, TypeScript, Go or Rust.

The oh-studio SDK lets a program on your side do what the app does: list your team's robots, read and review takes, press STOP, and — with an operator key — drive a take of its own through the relay. There's one for each language, and they all say and do the same thing.

Get a key

In the app, an admin on a team with a plan opens Account → API keys, picks a role, and creates a key. It is shown once — copy it then.

  • Reviewer — read robots and takes, and mark them good or wrong.
  • Operator — all of the above, and drive a take of its own through the relay.

Install

pip install openhorizon-studio   # command: oh-studio

Python 3.10+. The standard library alone, plus websockets only when you record a take.

Sign in

Give the SDK your key once. It is stored read-only in your home folder, and read from OH_STUDIO_KEY if set.

export OH_STUDIO_KEY=ohk_...
oh-studio robots            # list your team's robots

Read your takes

from openhorizon_studio import Studio

studio = Studio()                       # uses OH_STUDIO_KEY
robot = studio.robot("rb-9jjlay94")     # from `oh-studio robots`

for take in robot.takes().recording:
    print(take["id"], take["skill"], take["ok"])

take = robot.take("e1764...-pour")
robot.good(take["id"])                  # or robot.wrong(id, reason=...)

Press STOP

STOP is always available to any key, and the SDK tells you plainly if it was not sent or not confirmed:

oh-studio stop rb-9jjlay94
robot.stop()                            # the robot's own answer is returned

A key can press STOP but never clear it — clearing is a person's job, on the page, after they have looked.

Drive a take (operator key)

With an operator key, a program can begin a take and steer it — on a robot started with --relay --relay-programs --execute, and only that take:

with studio.robot("rb-9jjlay94").session("lift the box") as take:
    take.walk(2.0, vx=0.3)              # 20 commands/sec for 2 s, then zero
# leaving the block ends the take

Every language, the same

The four SDKs are held to one shared spec, so a review, a STOP or a take reads and behaves identically whichever you use. Pick the one your program is already in.