> ## 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.

# The Eval Interface

> The minimal eval interface tasks and agents talk through: implement a Robot, write an Agent, and run an episode.

`rua` re-exports a small, synchronous interface for evaluating robot-use agents. A task implements `Robot`,
the agent under evaluation implements `Agent`, and `run` plays one episode between them. It uses none of the HUD environment, wire or contract machinery on
the other pages.

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

## Implement a robot

A robot offers **tools** (described the way LLM tool APIs expect, with a JSON Schema), resets to a first
observation, and answers each action with the next one:

```python theme={"dark"}
from rua import Action, Observation, Tool


class Slider:
    """A one-axis robot that must reach x = 3."""

    def tools(self):
        schema = {"type": "object", "properties": {"dx": {"type": "number"}}}
        return [Tool("nudge", "Move along x", schema)]

    def reset(self):
        self.x = 0.0
        return Observation(text="x=0.0")

    def step(self, action: Action):
        self.x += action.args["dx"]
        reached = self.x == 3.0
        return Observation(text=f"x={self.x}", done=reached, success=reached or None)
```

An `Observation` carries `text`, camera `images` (camera name to encoded image bytes), `done`, and `success`,
which stays `None` while the task is undecided.

## Run an agent

An agent is any object with `act(observation, tools)` that returns an `Action` or `None` to stop, including one
that calls an LLM. `ScriptedAgent` replays a fixed list:

```python theme={"dark"}
from rua import ScriptedAgent, run

agent = ScriptedAgent([Action("nudge", {"dx": 1.0}), Action("nudge", {"dx": 2.0})])
trajectory = run(agent, Slider())

trajectory.success  # True
len(trajectory.steps)  # 2
trajectory.last.text  # "x=3.0"
```

An episode ends when the robot reports `done`, the agent returns `None`, or `max_steps` is reached (there
is no cap by default). `run` raises `ValueError` if the agent calls a tool the robot does not offer:

```text theme={"dark"}
ValueError: unknown tool 'jump'; robot offers ['nudge']
```

A `Trajectory` holds the `start` observation and a tuple of `Step(action, observation)`. `trajectory.last` is
the final observation, and `trajectory.success` is true only when it says `success=True`.

> [!NOTE]
>
> `import rua` also imports `hud` and registers rua's robot client with it, so this interface needs the full
> `rua` install and Python 3.11 or newer, even though it doesn't use HUD. The `rua` 0.0.1 release on PyPI ships
> this interface alone.


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