> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rua.hud.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Eval Interface

> Reference for the eval interface re-exported from rua: Tool, Action, Observation, Robot, Agent, Step, Trajectory, ScriptedAgent and run.

The top-level `rua` package re-exports the eval interface from `rua.interface`. Every type is a frozen
dataclass or a runtime-checkable `Protocol`. The guide is [The eval interface](https://docs.rua.hud.ai/guides/eval-interface.md).

```python theme={"dark"}
from rua import Action, Agent, Observation, Robot, ScriptedAgent, Step, Tool, Trajectory, run
```

`rua.__version__` is `"0.2.0"`. Importing `rua`, or any of its submodules, also registers
[`RobotClient`](https://docs.rua.hud.ai/reference/capabilities#robotclient) with `hud.clients.register_client`.

## Data types

### `Tool`

One call a robot accepts, described the way LLM tool APIs expect.

| Field | Type | Default | Description |
| - | - | - | - |
| `name` | `str` | required | Tool name. |
| `description` | `str` | `""` | What the tool does. |
| `parameters` | `Mapping[str, Any]` | `{}` | JSON Schema of the arguments. |

### `Action`

A tool call chosen by the agent.

| Field | Type | Default | Description |
| - | - | - | - |
| `tool` | `str` | required | Name of the tool to call. |
| `args` | `Mapping[str, Any]` | `{}` | Arguments. |

### `Observation`

What the robot reports back.

| Field | Type | Default | Description |
| - | - | - | - |
| `text` | `str` | `""` | Text the agent reads. |
| `images` | `Mapping[str, bytes]` | `{}` | Camera name to encoded image bytes. |
| `done` | `bool` | `False` | Whether the episode is over. |
| `success` | `bool \| None` | `None` | The task's outcome; `None` while undecided. |

### `Step`

| Field | Type | Description |
| - | - | - |
| `action` | `Action` | The action the agent took. |
| `observation` | `Observation` | What the robot answered. |

### `Trajectory`

A finished episode.

| Member | Type | Description |
| - | - | - |
| `start` | `Observation` | The observation `reset` returned. |
| `steps` | `tuple[Step, ...]` | Every step after it. |
| `last` | `Observation` (property) | The final observation: the last step's, or `start` when there are none. |
| `success` | `bool` (property) | `True` only when `last.success is True`. |

## Protocols

### `Robot`

The robot in a task, as the agent under evaluation sees it.

| Method | Returns | Description |
| - | - | - |
| `tools()` | `Sequence[Tool]` | The calls the robot accepts. |
| `reset()` | `Observation` | Start an episode. |
| `step(action)` | `Observation` | Apply one action. |

### `Agent`

The agent under evaluation.

| Method | Returns | Description |
| - | - | - |
| `act(observation, tools)` | `Action \| None` | The next action, or `None` to stop. |

## `ScriptedAgent`

```python theme={"dark"}
ScriptedAgent(actions: Iterable[Action])
```

Replays `actions` in order, then returns `None`.

## `run`

```python theme={"dark"}
run(agent: Agent, robot: Robot, max_steps: int | None = None) -> Trajectory
```

Plays one episode: calls `robot.tools()` and `robot.reset()`, then alternates `agent.act` and `robot.step`. It
ends when an observation has `done=True`, the agent returns `None`, or `max_steps` steps have run (there is no cap by default). Raises
`ValueError` when the agent names a tool the robot did not offer.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.