Check an Expo app on iOS and Android with agent-device and mobile-agent
agent-device and mobile-agent are command-line tools that let a coding agent drive an app on a simulator or emulator. This article runs the same check with both, on the contacts list from Group a list into sections with Legend List, in Expo Go, on an iOS Simulator and an Android emulator: press "Jump to D", and confirm that "Daisy" and the D header are on screen.
Each check is a script in the example's agents/ folder that calls the tool's commands directly. It runs from the example's folder with a platform and a screenshot path, as in bash agents/agent-device.sh ios ios.png.
The tools
agent-device 0.21.46 is made at Callstack and is open source under the MIT license. Its README describes a device layer for AI coding agents, used through a CLI, a built-in MCP server or a typed Node.js API.
mobile-agent 0.1.0-alpha.1, the npm package @mobileagent/cli, is a daemon, a CLI (mobile-agent) and an MCP server (mobile-agent-mcp), under the MIT License. Its README calls it experimental and pre-release, and says that its drivers rely on private Apple and hidden Android interfaces, which makes it development tooling, never something to ship inside an app.
Install
In the example's folder:
bun add -d --exact agent-device@0.21.46 @mobileagent/cli@0.1.0-alpha.1
The scripts run the two binaries from node_modules/.bin/. Each tool has a doctor command that checks its setup: mobile-agent's lists Xcode, the Simulator runtimes and the Android SDK, and agent-device's lists the devices it can reach and whether Metro answers.
Start the app in Expo Go
EXPO_NO_DEV_MENU=1 bun run start
Then press i for the iOS Simulator and a for the Android emulator. The Expo CLI installs Expo Go on the Simulator or emulator when it is missing, and opens the project in it.
Without EXPO_NO_DEV_MENU=1, Expo Go showed its tools button, a gear, over the end of the row of letters. With it, the Expo CLI opens the project with the launch query that agent-device's script uses, below, and the gear stays hidden.
agent-device
#!/usr/bin/env bash
# Drives the example in Expo Go with agent-device, and checks that "Jump to D"
# scrolls the list to the D section.
#
# Usage: bash agents/agent-device.sh ios|android <out.png>
#
# Metro and Expo Go must already be running with the project open: run
# `EXPO_NO_DEV_MENU=1 bun run start` in this folder, then press i (iOS
# Simulator) or a (Android emulator). The script opens the project's URL in
# Expo Go again, restarting Expo Go so that the list starts at the top, and
# then:
# - takes a snapshot, finds the "Jump to D" button by its label and presses
# it, waiting for the screen to settle;
# - prints a snapshot, and fails unless "Daisy" and the "D" header are on
# screen. iOS reports the header as text, Android as a group;
# - saves a screenshot to <out.png>, at 2 pixels per point on iOS, and
# closes the session, which stops Expo Go.
set -euo pipefail
platform="${1:-}"
out="${2:-}"
case "$platform" in
ios)
app=host.exp.Exponent
header='role=text label="D"'
;;
android)
app=host.exp.exponent
header='role=group label="D"'
;;
*)
echo "Usage: bash agents/agent-device.sh ios|android <out.png>" >&2
exit 2
;;
esac
if [[ "$out" != *.png ]]; then
echo "Usage: bash agents/agent-device.sh ios|android <out.png>" >&2
exit 2
fi
ad=node_modules/.bin/agent-device
# The URL `expo start` opens when it runs without a terminal: its parameters
# keep Expo Go's developer menu and tools button closed for this launch.
url='exp://127.0.0.1:8081?__expo_disable_fab=1&__expo_disable_auto_launch=1&__expo_disable_onboarding=1'
"$ad" open "$app" "$url" --platform "$platform" --relaunch
# On Android, open returns while Expo Go still loads the project.
"$ad" wait 'role=button label="Jump to D"' 30000
"$ad" snapshot -i
"$ad" press 'role=button label="Jump to D"' --settle
"$ad" snapshot -i
if ! "$ad" is visible 'label="Daisy"' >/dev/null 2>&1 ||
! "$ad" is visible "$header" >/dev/null 2>&1; then
"$ad" close >/dev/null 2>&1 || true
echo "FAIL: \"Daisy\" and the \"D\" header are not both on screen after the press." >&2
exit 1
fi
echo "OK: \"Daisy\" and the \"D\" header are on screen after the press."
# iOS Simulators save 1 pixel per point by default. Android refuses
# --pixel-density and saves the screen's pixels.
if [[ "$platform" == ios ]]; then
"$ad" screenshot "$out" --pixel-density 2
else
"$ad" screenshot "$out"
fi
"$ad" closeThe script opens the project's URL in Expo Go, host.exp.Exponent on iOS and host.exp.exponent on Android, with the query that the Expo CLI adds when it runs without a terminal. With the plain URL, Expo Go showed its tools button on iOS, and on Android it opened its developer menu over the app, so the snapshot came back empty and the press failed.
--relaunch terminates the app's process before launching it, as agent-device's command reference puts it, so the list starts at the top on every run. On Android, open returned while Expo Go was still loading the project, and without the wait, which gives the button up to 30 seconds, the first snapshot was empty too.
press finds the button by its role and label, not by a ref, and --settle waits for the screen to go quiet, then prints what changed since the press: the lines that left the screen with -, and the ones that came in with +.
Two is visible checks follow, one for "Daisy" and one for the header. The header's role differs: iOS reports it as text, and Android as a group. On Android, label="D" alone also matches the letter inside the "Jump to D" button, which is on screen before the press as well, so the check names the role too. If either check fails, the script closes the session, prints a FAIL line and exits with status 1.
On iOS, --pixel-density 2 saves 2 pixels per point, where the default is 1. Android refuses the flag. close ends the session and stops Expo Go, so the next run starts it again.
This is the iOS run's output after the press:
Tapped role=button label="Jump to D" (237, 86)
settled after 921ms: +17 -17 (~8 unchanged)
- @e9 [text] "A"
- @e10 [text] "Aaron"
…
+ @e9-s535574 [text] "D"
+ @e10-s535574 [text] "Daisy"
+ @e11-s535574 [text] "Daniel"
…
… changed lines truncated
Page: host.exp.Exponent
App: host.exp.Exponent
Snapshot: 25 visible nodes
@e1 [application] "Expo Go"
@e2 [button] "Jump to A"
…
@e5 [button] "Jump to D"
…
@e8 [scroll-area] [scrollable]
[content above scroll-area hidden]
[content below scroll-area hidden]
@e9 [text] "D"
@e10 [text] "Daisy"
@e11 [text] "Daniel"
…
OK: "Daisy" and the "D" header are on screen after the press.
…/ad-ios.png (804x1748 @2x)
Closed: default

mobile-agent
#!/usr/bin/env bash
# Drives the example in Expo Go with mobile-agent, and checks that "Jump to D"
# scrolls the list to the D section.
#
# Usage: bash agents/mobile-agent.sh ios|android <out.jpg>
#
# Metro and Expo Go must already be running with the project open: run
# `EXPO_NO_DEV_MENU=1 bun run start` in this folder, then press i (iOS
# Simulator) or a (Android emulator). The variable keeps Expo Go's tools
# button hidden. The script then:
# - attaches to Expo Go. On Android, open brings Expo Go's home screen to the
# front, and Back returns to the project, then the script waits for the
# screen to settle;
# - scrolls the list to the top with "Jump to A", so that the jump starts
# there;
# - takes a snapshot, finds the "Jump to D" button by its label and clicks it,
# then waits for the screen to settle;
# - prints a snapshot, and fails unless it lists "Daisy" and the "D" header.
# The header has a ref ("D" [ref=eN]); the letter inside the button has
# none;
# - saves a screenshot to <out.jpg> (mobile-agent saves JPEG), 1748 pixels
# on its longest edge, and closes the session, leaving Expo Go running for
# the next run.
set -euo pipefail
platform="${1:-}"
out="${2:-}"
case "$platform" in
ios) app=host.exp.Exponent ;;
android) app=host.exp.exponent ;;
*)
echo "Usage: bash agents/mobile-agent.sh ios|android <out.jpg>" >&2
exit 2
;;
esac
if [[ "$out" != *.jpg ]]; then
echo "Usage: bash agents/mobile-agent.sh ios|android <out.jpg>" >&2
exit 2
fi
ma=node_modules/.bin/mobile-agent
"$ma" open "$app" --platform "$platform"
if [[ "$platform" == android ]]; then
"$ma" press Back
"$ma" wait --settle
fi
"$ma" wait 'text==Jump to D'
"$ma" click 'text==Jump to A'
"$ma" wait --settle
"$ma" snapshot -i
"$ma" click 'text==Jump to D'
"$ma" wait --settle
snapshot=$("$ma" snapshot)
echo "$snapshot"
if ! grep -q 'text "Daisy"' <<<"$snapshot" ||
! grep -q '"D" \[ref=' <<<"$snapshot"; then
"$ma" close --keep >/dev/null 2>&1 || true
echo "FAIL: the snapshot after the press does not list both \"Daisy\" and the \"D\" header." >&2
exit 1
fi
echo "OK: the snapshot after the press lists \"Daisy\" and the \"D\" header."
"$ma" screenshot "$out" --max-dimension 1748
"$ma" close --keepopen attaches to the Expo Go that is already running, without restarting it: the list stays where the last run left it. On Android, open showed Expo Go's home screen, its list of development servers, and press Back returned to the project. The script then waits for the screen to settle: in one run without that wait, the "Jump to A" click that followed was refused as out of view.
Because the list may still be at D, the script first clicks "Jump to A". Then it clicks "Jump to D", found by its text, not by a ref. After press Back and after each click, wait --settle returns once neither the tree nor the frames have changed for a quiet window, 200 ms by default, as mobile-agent's README describes.
In these runs, snapshot -i listed the buttons and the headers, which have refs, and left out the names, so the check reads the full snapshot instead. There, the D header has a ref, "D" [ref=e22] in the run below, and the letter inside the "Jump to D" button, where the snapshot lists it, is a text "D" line without one, so the two grep patterns tell them apart.
mobile-agent saves screenshots as JPEG, and --max-dimension 1748 sets the longest edge in pixels. close --keep releases the Simulator or emulator and leaves Expo Go running, so the next run finds it as this one left it.
This is the Android run's output after the press:
✓ Done (hit button "Jump to D", dispatch 2.1 ms, first frame change 99.3 ms, first tree delta 637.4 ms)
✓ Settled after 538.35 ms: frames changed last
- generic [id=action_bar_root]
- generic [id=content]
- button "Jump to A" [ref=e13]
- text "A"
…
- button "Jump to D" [ref=e16]
- text "D"
…
(2 more actionable items above, scroll up to reveal)
- generic "D" [ref=e22]
- generic "E" [ref=e23]
- generic "F" [ref=e24]
- text "Cora"
- text "Daisy"
- text "Daniel"
…
(more items below, scroll down to reveal)
- generic [id=status_bar_launch_animation_container]
…
OK: the snapshot after the press lists "Daisy" and the "D" header.
✓ Screenshot saved to …/ma-android-1.jpg (786x1748 of a 411.4x914.3-point screen)
✓ Released emulator-5554; host.exp.exponent keeps running

What each tool reports
The example gives each letter role="button" and an aria-label such as "Jump to D", and each header role="heading". After the press, the four runs listed them like this:
| agent-device, iOS | agent-device, Android | mobile-agent, iOS | mobile-agent, Android | |
|---|---|---|---|---|
| The button | [button] "Jump to D" |
[button] "Jump to D" |
button "Jump to D" |
button "Jump to D" |
| The D header | [text] "D" |
[group] "D" |
heading "D" |
generic "D" |
| "Daisy" | [text] "Daisy" |
[text] "Daisy" in the press's diff |
text "Daisy" |
text "Daisy" |
Every element in agent-device's snapshot -i has a ref, @eN. On Android, its snapshot -i collapses the list's texts into the list's label: @e13 [scroll-area] "D, E, F, Cora, Daisy, Daniel, …". In mobile-agent's snapshots, the buttons and the headers have refs, [ref=eN], and the names have none.
Verified with Expo SDK 58 (React Native 0.88.1), agent-device 0.21.46 and mobile-agent 0.1.0-alpha.1, in Expo Go 58.0.7 on an iOS 26.5 Simulator and Expo Go 58.0.6 on an Android API 36 emulator: each script passed on both.
Full example: reactnative/examples/sectioned-contacts