Mobilebox
Menu
Maestro flowsDocs pages and contents

On this page

Run Maestro flows on cloud Android phones

Already have Maestro flows? Run them on a Mobilebox phone with one call and get pass or fail per step, the screenshots, Maestro’s log and a screen recording. You don’t install a CLI or an emulator, and you don’t need ADB. Your agent can use the same phone between runs: it reads the screen, fixes the flow or the app, and runs the flow again.

A real flow: search Wikipedia

This flow installs nothing by itself. Install the app first, then run the flow. It gets past the app’s first-run intro, searches for the Matterhorn, opens the article and checks that it mentions the Alps. It ran as shown on a Mobilebox phone (Android 14, Wikipedia from F-Droid, version code 50614) in the verifier’s Maestro scenario.

yaml
appId: org.wikipedia
---
- launchApp:
    clearState: true
- repeat:
    while:
      visible: "Forward"
    commands:
      - tapOn: "Forward"
- runFlow:
    when:
      visible: "Skip"
    commands:
      - tapOn: "Skip"
- tapOn: "Search"
- runFlow:
    when:
      visible: "Close"
    commands:
      - tapOn: "Close"
- tapOn: "Search Wikipedia"
- inputText: "Matterhorn"
- tapOn:
    text: "Matterhorn"
    index: 1
- assertVisible: ".*Alps.*"
- takeScreenshot: matterhorn
bash
export MSB=https://mobilebox.dev
# export MOBILESANDBOX_API_KEY=YOUR_API_KEY
auth=(-H "Authorization: Bearer $MOBILESANDBOX_API_KEY")
phone=$(curl -s "${auth[@]}" -H 'content-type: application/json' -d '{"name":"maestro"}' "$MSB/v1/phones?wait=ready" | jq -r .id)
curl -s "${auth[@]}" -H 'content-type: application/json' -d '{"url":"https://f-droid.org/repo/org.wikipedia_50614.apk"}' "$MSB/v1/phones/$phone/apps"
run=$(curl -s "${auth[@]}" -H 'content-type: text/yaml' --data-binary @wikipedia.yaml "$MSB/v1/phones/$phone/maestro" | jq -r .id)
curl -s "${auth[@]}" "$MSB/v1/phones/$phone/maestro/$run?wait=done" | jq '{status, steps}'   # again while status is "running"
curl -s "${auth[@]}" -X DELETE "$MSB/v1/phones/$phone"

The run answers with every step of the flow in order: launchApp, repeat, each tapOn, inputText, assertVisible and takeScreenshot, each with passed, failed or skipped, how long it took, and Maestro’s error message on a failed step. screenshots link the PNGs: matterhorn.png from the flow, plus Maestro’s own screenshot of a step that failed.

From an agent (MCP)

run_maestro_flow takes the phone_id and the flow as YAML, plus env and timeout_s if you need them. It waits up to 50 s and returns the steps, the last screenshot inline and the end of the log. For a longer flow it returns the run_id; call it again with that run_id to keep waiting. Then publish_proof turns the run into a PR comment with the screen recording.

> Install org.wikipedia from https://f-droid.org/repo/org.wikipedia_50614.apk on a new Mobilebox phone, run this Maestro flow on it with run_maestro_flow, and tell me which step failed, if any.

Flows with scripts, media or several files

Zip the folder and send the zip as the body. Pick one file or subfolder with ?flow=, or leave it out to run them all, as maestro test . does. The zip is unpacked as your flows folder, so scripts (runScript), sub-flows (runFlow: file) and a config.yaml sit beside the flow as in a local run. Values in env are only for JSON bodies. In a zip, put them in the flow’s own env: block.

bash
zip -r flows.zip flows/
curl -s "${auth[@]}" -H 'content-type: application/zip' --data-binary @flows.zip "$MSB/v1/phones/$phone/maestro?flow=flows/login.yaml"

What a run can and can’t do

  • Its own sandbox: each run runs beside its phone with 1 GB of memory and one CPU. It sees only the files you sent. On the network it is its phone: it reaches that phone and, like the phone, the internet, never other phones, our servers or a host disk.
  • The phone’s network: HTTP from runScript goes out the way the phone’s traffic does, so the phone’s proxy, network conditions and egress rules apply.
  • Tied to the phone: one run per phone at a time. A run keeps the phone from idling out. Parking or deleting the phone stops it at once, and status becomes stopped.
  • Limits: the flow can be YAML up to 256 KB, or a zip up to 20 MB. A run can take 30 to 1,800 s (default 600, timeout_s). The screen recording covers the first 180 s.
  • Cost: only the phone’s minutes. If the servers are full, the call answers 503 box_full with retry_after, and nothing is charged.
  • Android only: Maestro on an iPhone isn’t available. Asking for it counts as a request for it, and you can drive the iPhone with observe and act meanwhile.

Source: docs/MAESTRO.md in the repo, rendered at build time.