# Turn an AI agent’s app test into a replayable Maestro flow

Let the agent explore the app, write its path as a Maestro flow and replay it on the same cloud Android phone with run_maestro_flow: 14 steps passed in 67 s in our 27 Nov 2026 run, $0.03 of phone time. What to tell the agent, and the CI call.

By [Mustafa Yenler](https://mobilebox.dev/about?via=md#mustafa) [LinkedIn](https://www.linkedin.com/in/mustafa-yenler) Updated 27 November 2026

Guides4 min read

In this article

Ask your agent to write the path it took as a Maestro flow, then replay that flow on a phone with no model in the loop. On Mobilebox the same phone the agent explored runs the flow with `run_maestro_flow` (MCP) or `POST /v1/phones/{id}/maestro` (REST), and answers pass or fail per step with screenshots and a screen recording; in CI it’s one curl call and costs only the phone’s minutes, $0.01 a minute.

## Why the agent’s own run isn’t the test

An agent that explores your app with `observe` and `act` finds bugs, but it doesn’t take the same path twice, and every run pays for model tokens. A regression check should be the opposite: the same steps every time, cheap enough for every pull request. So keep the agent for exploring and for writing the test, and let a flow runner repeat it.

Two open-source projects shipped the same idea in late November 2026. [explore-compile-replay](https://github.com/pierridotite/explore-compile-replay/releases/tag/v0.1.0) v0.1.0 (26 November 2026, marked a draft) records an agent’s trace and compiles it to a Maestro flow that replays "with no model". [mobile-agent-testers](https://github.com/pierridotite/mobile-agent-testers/releases/tag/v0.2.0) v0.2.0 (25 November 2026) replays each Android tester’s path with Maestro once the agent is done, as an experimental option. Both run on emulators you host. If you want the trace compiled for you, start there; the steps below get the same result by asking the agent to write the flow.

## What we ran

On 27 November 2026 we drove Wikipedia (F-Droid build 50614) on a Mobilebox Android 14 phone the way an agent does: `observe`, then five `act` calls through the intro, a "Skip", the Search tab, a widget promotion that only appears on first use, a query for "Matterhorn" and the article. Then we wrote that path down as a flow and ran it on the same phone:

```
appId: org.wikipedia
---
- launchApp:
    clearState: true
- repeat:
    while:
      visible: "Forward"
    commands:
      - tapOn: "Forward"
- tapOn: "Skip"
- tapOn: "Search"
- runFlow:
    when:
      visible: "A Faster way to Search"
    commands:
      - tapOn: "Close"
- tapOn: "Search Wikipedia"
- inputText: "Matterhorn"
- tapOn: "Mountain in the Swiss and Italian Alps"
- assertVisible: ".*Swiss and Italian Alps.*"
- takeScreenshot: matterhorn
```

All 14 steps passed in 67 seconds, with the article’s screenshot and a recording of the run. The phone was up for about two and a half minutes for the whole session, exploring included: $0.03.

## What to tell the agent

The agent’s run and the flow describe the same path differently, and the flow has to survive a fresh start:

- **Text, not refs or coordinates.** The agent tapped the search result by its ref, `[8]`, because that’s what `observe` numbers. Refs and coordinates change between runs; the flow taps the visible text instead.

- **One-time screens are conditional.** The widget promotion showed up once. `runFlow` with `when: visible` closes it if it’s there and moves on if it isn’t, and `repeat … while` walks an intro of any length.

- **Start clean, end with an assertion.** `clearState: true` makes every run begin like the first one, and `assertVisible` checks the outcome rather than the last tap.

A prompt that does this:

```
Install https://example.com/app-debug.apk on a new Mobilebox phone and
complete <the task>. Then write the path as a Maestro flow: tap by visible
text, make one-time dialogs conditional with runFlow when visible, start
with launchApp clearState: true and end with assertVisible on the result.
Run it with run_maestro_flow on the same phone, fix the flow until it
passes, save it as .maestro/<name>.yaml and delete the phone.
```

## Replaying it in CI

The flow is a file in your repository, so CI needs no agent: create a phone, install the build, send the YAML to `/v1/phones/{id}/maestro`, wait for `status`, delete the phone. The full curl sequence is in [Run Maestro flows on cloud Android phones](https://mobilebox.dev/docs/maestro?via=md), and `publish_proof` turns a run into a pull request comment with the recording.

Limits to know: Maestro runs on Android phones only, not on our iOS simulators; one run per phone at a time; the recording covers the first 180 seconds; and the flow tests the path you wrote down, so let the agent explore again when the app changes.

[Mustafa Yenler](https://mobilebox.dev/about?via=md#mustafa) is the founder of fifteenA and builds Mobilebox, from Berlin and San Francisco. [LinkedIn](https://www.linkedin.com/in/mustafa-yenler)

## Try it in your agent in 60 seconds

Paste this into Claude Code, Cursor, Codex or any agent that can read a web page. It asks for your email, gets its own key at once and adds the phone tools; the 6-digit code from your inbox keeps the workspace.

```
Set up Mobilebox for me: read https://mobilebox.dev/setup.md?via=agent-run-to-maestro-flow and follow it.
```

[What your agent reads](https://mobilebox.dev/setup.md?via=agent-run-to-maestro-flow)

In this article

[All articles](https://mobilebox.dev/blog?via=md)

## Next question

- [What replaces Firebase Test Lab?](https://mobilebox.dev/blog/mobilebox-vs-firebase-test-lab?via=next-firebase)
