# SDK (/studio/sdk)

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.

<Callout title="Node and Bun, a server, never a web page">
The SDKs hold an API key, so they run in a program **you** control (a server, a script, a CLI) — never in a browser, where anyone could read the key. A web app signs people in with the app's own sign-in instead.
</Callout>

## Get a key [#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 [#install]

<Callout title="Not published yet">
The SDKs are not on PyPI / npm / crates.io yet. OpenHorizon gives you the package to install directly; the commands below are how they'll install once published.
</Callout>

<Tabs items={["Python","TypeScript","Go","Rust"]}>
<Tab value="Python">
```bash
pip install openhorizon-studio   # command: oh-studio
```
Python 3.10+. The standard library alone, plus `websockets` only when you record a take.
</Tab>

<Tab value="TypeScript">
```bash
npm install @openhorizon-labs/studio
```
Node 22+ or Bun. Never in a web page.
</Tab>

<Tab value="Go">
```bash
go get github.com/openhorizon-labs/studio/sdk/go
```
Go 1.24+.
</Tab>

<Tab value="Rust">
```bash
cargo add openhorizon-studio
```
Rust 1.85+. Blocking, no async runtime.
</Tab>
</Tabs>

## Sign in [#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.

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

## Read your takes [#read-your-takes]

```python
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 [#press-stop]

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

```bash
oh-studio stop rb-9jjlay94
```

```python
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) [#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:

```python
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
```

<Callout type="warn">
A program never drives a real robot on your own computer — it is relay-only, and a person must be beside the robot. For a practice robot on this machine, `Robot.local("http://localhost:9090").session(task)` works with no key.
</Callout>

## Every language, the same [#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.