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

# OpenClaw · Android Control

> Give any AI agent the ability to control a real Android phone through the Mobilerun skill.

The Mobilerun **Android-control skill** teaches an AI agent to drive a real Android phone: take screenshots, tap and swipe, type, manage apps, and run autonomous tasks — all without any manual API wiring. [OpenClaw](https://openclaw.ai) is the agent CLI that loads it, so you can tell the agent things like "open Instagram and like the latest post" or "go to Amazon and add the cheapest USB-C cable to my cart," and it executes those tasks on your device.

## What the skill includes

| File              | Purpose                                                                                 |
| ----------------- | --------------------------------------------------------------------------------------- |
| `SKILL.md`        | Entry point — authentication flow, device setup, quick-reference table, common patterns |
| `api.md`          | Platform API — device provisioning, AI agent tasks, webhooks, app library               |
| `phone-api.md`    | Phone control API — screenshot, UI state, tap, swipe, type, app management              |
| `setup.md`        | Authentication and device connectivity guide                                            |
| `subscription.md` | Plans, pricing, credits, and device types                                               |

## What it enables

Once installed and given an API key, the agent gains two ways to control a device:

<CardGroup cols={2}>
  <Card title="Direct phone control" icon="hand-pointer">
    Step-by-step device interaction: screenshot, tap, swipe, type, press keys, open apps. Best for quick, precise actions.
  </Card>

  <Card title="Autonomous agent tasks" icon="robot">
    Submit a natural-language goal (`"Book a table for 2 at 7pm"`) and the Mobilerun AI agent executes it on the device end-to-end. Requires credits.
  </Card>
</CardGroup>

## Prerequisites

* [OpenClaw CLI](https://openclaw.ai/docs/installation) installed
* A Mobilerun account at [cloud.mobilerun.ai](https://cloud.mobilerun.ai)
* An Android device connected via the [Mobilerun Portal](/guides/connect-android) app, or a cloud-hosted device ([Cloud Phone](/device-types#cloud-phone) or [Physical Phone](/device-types#physical-phone))

## Step 1 — Install the plugin

```bash theme={null}
openclaw plugins install @mobilerun/openclaw-mobilerun
```

This downloads the Mobilerun skill from the npm registry and registers it with your local OpenClaw installation.

Verify it installed correctly:

```bash theme={null}
openclaw plugins list
```

You should see `@mobilerun/openclaw-mobilerun` in the output.

<Note>
  Not using OpenClaw? Download the pre-packaged skill and load it into any compatible runtime:

  <Card title="mobilerun.skill" icon="download" href="https://github.com/droidrun/skills/releases/latest/download/mobilerun.skill">
    Download the latest release from GitHub
  </Card>
</Note>

## Step 2 — Get your API key

1. Go to [cloud.mobilerun.ai/api-keys](https://cloud.mobilerun.ai/api-keys) (sign in with Google, GitHub, or Discord if prompted)
2. Click **New key**, give it a name, and copy the key — it starts with `dr_sk_` and is shown only once

## Step 3 — Configure the API key

You have two options. Choose whichever fits your workflow:

### Option A — Environment variable (quickest)

```bash theme={null}
export MOBILERUN_API_KEY=dr_sk_your_key_here
```

Add this to your shell profile (`~/.zshrc`, `~/.bashrc`, etc.) to make it permanent.

### Option B — OpenClaw config file

OpenClaw stores skill configuration in `~/.openclaw/openclaw.json`. Add your key under `skills.entries.mobilerun.apiKey`:

```json theme={null}
{
  "skills": {
    "entries": {
      "mobilerun": {
        "apiKey": "dr_sk_your_key_here"
      }
    }
  }
}
```

If the file already exists, merge this key in — do not replace the entire file.

<Note>
  The config file method is preferred when you use multiple skills with different credentials, since each skill's key is namespaced separately.
</Note>

## Step 4 — Connect a device

If you don't have a device connected yet, install the Mobilerun Portal app on your Android phone:

1. On your Android phone, open Chrome and go to **[droidrun.ai/portal](https://droidrun.ai/portal)**
2. Download and install the APK (tap "Install anyway" if Android warns about unknown sources — this is expected)
3. Open the Portal app and tap **Enable Now** to grant the Accessibility permission
4. **Long-press** "Connect to Mobilerun" to open the API key dialog
5. Paste your `dr_sk_...` key and tap **Connect**

Once connected, the device appears as `ready` in the Mobilerun dashboard and the agent can use it immediately.

<Tip>
  Cloud-hosted devices ([Cloud Phones](/device-types#cloud-phone) and [Physical Phones](/device-types#physical-phone)) are also available if you don't want to connect a personal device.
</Tip>

## Step 5 — Start the agent with the Terminal User Interface (TUI)

```bash theme={null}
openclaw tui
```

OpenClaw loads the Mobilerun skill and the agent is ready. Try a prompt:

```
Open the Settings app and tell me the Android version on my phone.
```

The agent will:

1. Confirm the API key and find your connected device
2. Take a screenshot of the current screen
3. Navigate to Settings and read the relevant UI elements
4. Report the Android version back to you

## How the agent uses the skill

The agent follows a structured initialization flow on every session:

1. **Checks for an API key** — looks in `MOBILERUN_API_KEY` env var or the OpenClaw config file. If missing, it asks the user once.
2. **Verifies the key and discovers devices** — calls `GET /devices`. A `200` response with a `ready` device means the agent proceeds immediately.
3. **Guides setup only when needed** — if no device is found, the agent walks the user through installing the Mobilerun Portal app and connecting.
4. **Executes the request** — once a ready device is confirmed, the agent completes the user's task without additional prompts.

## Configuration reference

| Method               | Location                    | Key path                          |
| -------------------- | --------------------------- | --------------------------------- |
| Environment variable | Shell environment           | `MOBILERUN_API_KEY`               |
| Config file          | `~/.openclaw/openclaw.json` | `skills.entries.mobilerun.apiKey` |

The skill checks `MOBILERUN_API_KEY` first. If that is not set, it falls back to the config file. If neither is present, the agent will ask you for the key during the session and offer to save it.

## Available LLM models for agent tasks

When submitting autonomous tasks, you can specify which model drives the agent. The [Agent](/agent#model-selection) page holds the canonical catalog of `llmModel` values. To see the live list your account can use, call `GET /v1/models`, or use `client.models.list()` in the SDK.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Agent says the API key is invalid">
    Keys always start with `dr_sk_`. If yours looks different, copy it again from [cloud.mobilerun.ai/api-keys](https://cloud.mobilerun.ai/api-keys). Keys can be revoked — create a new one if needed.
  </Accordion>

  <Accordion title="No device found">
    The agent will tell you the device status. If no device appears:

    * Make sure the Mobilerun Portal app is open on your phone
    * Check that the Accessibility permission is still enabled (some phones disable it after reboot)
    * Confirm the phone has a stable internet connection
  </Accordion>

  <Accordion title="Device shows as disconnected">
    The Portal app lost its connection. Open the app on your phone — it usually reconnects automatically. If not, tap **Connect** again.
  </Accordion>

  <Accordion title="Task fails with a billing error">
    Autonomous agent tasks (`POST /tasks`) require credits. Check your credit balance at [cloud.mobilerun.ai/billing](https://cloud.mobilerun.ai/billing).
  </Accordion>
</AccordionGroup>

## Next steps

<CardGroup cols={2}>
  <Card title="Agent Skills overview" icon="book" href="/skills/overview">
    Learn what Mobilerun skills are and how the agent uses them.
  </Card>

  <Card title="Mobilerun Assistant" icon="messages-square" href="/skills/assistant">
    Talk to the virtual assistant over chat, with human-in-the-loop cards.
  </Card>

  <Card title="API Keys" icon="key" href="/api-keys">
    Manage your Mobilerun API keys.
  </Card>

  <Card title="Mobilerun Portal" icon="mobile" href="/guides/connect-android">
    Set up your personal Android device.
  </Card>
</CardGroup>
