Commands
Find the command for a task and what to know before you run it on each platform. Each command’s entry starts with a block generated from the CLI itself: its summary, synopsis, and options. The notes after it cover workflows, platform differences, and failure cases.
CLI help matches your installed version and is the exact reference. agent-device help lists the workflow and platform guides, and help <command> gives one command’s exact behavior:
agent-device helpagent-device help workflowagent-device help openFor persistent defaults and project-scoped CLI settings, see Configuration. For MCP clients, see MCP server.
Common options
These options are allowed by 5 or more commands, so they are documented here once: --settle, --settle-quiet <ms>, --timeout <ms>, --depth, -d <depth>, --scope, -s <scope>, --raw, --out <path>. A command’s own entry omits them and names them in its Also accepts line. The shared row is the general case: where a command’s semantics differ, that command states its own row.
| Option | What it does |
|---|---|
--settle |
After the action, wait for the UI to go quiet and return the settled diff vs the pre-action tree in the same response (best-effort; never fails the action) |
--settle-quiet <ms> |
Settle: quiet window the UI must hold to count as settled (default 500ms; 300ms when the settled tree comes from the iOS simulator snapshot bridge). On iOS, a broad screen replacement such as a modal dismissal is confirmed for at least 1500ms whatever window is asked for, within the –timeout settle deadline; a replacement from a screen the pre-action capture read as presenting nothing, such as a tab switch, gets no 1500ms confirmation and keeps the asked window |
--timeout <ms> |
Boot/Open/Prepare: startup budget covering the device boot (and runner preparation for prepare). Replay/Snapshot/Test: maximum wall-clock time for the command or attempt. With –settle: the settle-wait deadline (default 10s) |
--depth, -d <depth> |
Snapshot: limit snapshot depth |
--scope, -s <scope> |
Snapshot: scope snapshot to label/identifier |
--raw |
Snapshot: raw node output |
--out <path> |
Output path |
Exact behavior for one command: agent-device help <command>.
Output and warnings
In text mode, every command prints each response warning as a Warning: line after its own output.
get, find, clipboard, and record print those lines on stderr instead, so
value=$(agent-device get text …) captures only the value. With --json, warnings stay in
data.warnings and no Warning: line is printed.
Text from a device or a remote daemon, such as a label or a file path, can hold control characters. The CLI prints them as JSON escapes such as \u001b, so printed JSON still parses back to the exact values. MCP and AI SDK structured content keeps the exact values.
Navigation
agent-device boot --platform android --device Pixel_9_Pro_XL --headlessagent-device boot --platform ios --pick newestagent-device shutdown --platform android --device Pixel_9_Pro_XLagent-device open "https://example.com" --platform ios # open link in web browseragent-device open MyApp "myapp://screen/to" --platform ios # open deep link to MyAppagent-device open com.example.myapp --platform android --serial emulator-5554 --session my-session --relaunchagent-device closeagent-device backagent-device orientation landscape-leftagent-device hardware-button volume-upagent-device lock-screen lockagent-device fold half-openagent-device telephony sms 5551234 "Your code is 1234"agent-device device status --platform android --serial emulator-5554agent-device device release --staleagent-device daemon stop --cleanagent-device daemon status --jsonBoot and shut down:
Boot target device/simulator.
agent-device boot [--headless] [--pick newest] [--timeout <ms>]| Option | What it does |
|---|---|
--headless |
Boot: launch Android emulator without a GUI window |
--pick newest |
Boot: when several equally preferred matches are all shut down, boot one (mobile over TV, newest OS, then name) instead of failing; booted ties still fail |
Also accepts: common options: --timeout <ms>.
Supported targets: Get the device ready and boot simulators and emulators.
Exact behavior: agent-device help boot.
Shutdown target simulator/emulator.
agent-device shutdownSupported targets: Shut down a simulator or emulator.
Exact behavior: agent-device help shutdown.
openboots the device when needed, so you mainly needbootwhen you want a device ready without an app.- When several shut-down devices match equally,
bootfails withAMBIGUOUS_MATCH. Add--pick newestto choose one; it never picks between booted or provider devices. shutdownrefuses a device that an active session uses. End that session withclose --shutdownfirst. On Limrun,shutdowndeletes an instance that agent-device created, or releases an attachment to an existing one.- A never-booted iOS Simulator can take minutes to boot. If the
--timeoutruns out, the command fails withboot_timeoutand the device keeps booting, so a retry finds it further along. See Sessions. - On macOS, the Android emulator window opens behind the focused app. This is best-effort: the emulator can still take focus if the focused app cannot be read, or if its window appears after the startup budget runs out.
Select a device:
--platform applecovers iOS, tvOS, and macOS. Add--target mobile|tv|desktopto choose phone or tablet, TV, or desktop targets.- With no
--device,--udid, or--serial, a command that needs one device prefers virtual over physical and booted over offline devices. If several still tie, such as two booted emulators, it fails withAMBIGUOUS_MATCHand lists the candidates. Commands inside a session use the session’s device. - Commands without
--sessionuse an implicit session for your worktree and platform. For named sessions and--session-lock, see Sessions.
Device claims and the daemon:
Inspect and recover enforced local device ownership without a daemon.
agent-device device status|release [--platform <platform>] [--udid <udid>] [--serial <serial>] [--stale]| Option | What it does |
|---|---|
--stale |
Device status: show only claims with a provably stale owner |
Exact behavior: agent-device help device.
Stop a local daemon or show the providers it registered.
agent-device daemon stop [--clean] [--state-dir <path>] | daemon status [--state-dir <path>]daemon stop
| Option | What it does |
|---|---|
--clean |
Daemon stop: remove retained runner processes and leases after stopping |
daemon status
Reads no options.
Exact behavior: agent-device help daemon.
- Each session claims its device. When another owner holds the claim,
openfails withDEVICE_IN_USEand one of these reasons:DEVICE_CLAIM_LIVE_OWNER,DEVICE_CLAIM_RECOVERY_PENDING, orDEVICE_CLAIM_OWNER_UNCERTAIN. Nothing reached the device. If the device rebooted after the claim was taken,opentakes the claim instead and reports the release inwarnings. To wait for a held device, passopen --wait <ms>. See Sessions. device status --jsonshows whether a new session can take each device now (acquirable) and what blocks it (blockedBy). It does not contact the daemon or run recovery, soopencan still decide differently.device release --staleclears a claim whose owner provably cannot release it, such as an exited process. It refuses live and uncertain owners.- A command that needs the local daemon starts it when none runs. A daemon from another version is replaced only when it holds no work. Otherwise the command fails with
daemon-busy. A daemon from a release too old to report its work fails withdaemon-incompatible. End it deliberately withdaemon stop. Node.js clients can choose differently; see Daemon lifecycle. daemon stop --cleanalso removes the Apple runner processes and leases that daemon kept.- On Windows,
daemon stopforce-terminates the daemon at once (mode: "forced",cleanupConfidence: "unknown") rather than waiting for an in-process teardown. - On macOS,
daemon stopcan refuse a daemon that an older build started, withdetails.terminationReason: identity-unverified. Stop it with the build that started it, or sendSIGTERMto its recorded PID. Do not run an older and a newer build on one macOS host: device claims and runner leases are shared by the host. daemon stoprefuses a daemon that a host process embeds (daemon-owner-embedded). Close it in that process with the handle fromstartAgentDevice(). For the other refusals, see Daemon lifecycle.daemon statusreads the daemon’s record without contacting it, including each registered provider and why a plugin failed to register. See provider plugins.- A
--state-dirorAGENT_DEVICE_STATE_DIRmust be a private directory of your own account. agent-device refuses one that another account owns or can write. See Supported environment variables.
Open apps and links:
Open an app, deep link or URL, save replays.
agent-device open [appOrUrl] [url] [--activity <component>] [--launch-console <path>] [--launch-args <arg>] [--test-ime] [--no-test-ime] [--save-script [path]] [--force, --overwrite] [--no-record] [--relaunch] [--foreground] [--timeout <ms>] [--wait <ms>] [--surface app|frontmost-app|desktop|menubar] [--metro-host <host>] [--metro-port <port>] [--bundle-url <url>] [--launch-url <url>] [--os <version|range>] [--image-tag <tag>] [--device-mode <slim|full>] [--device-baseline <name>] [--physical]Aliases: launch, relaunch.
| Option | What it does |
|---|---|
--force, --overwrite |
Force replacement of existing state (connect: replace an active connection; –save-script: overwrite an existing target instead of refusing) |
--os <version|range> |
Proxy lease: OS version or range the backend picks the device by (Android: API level); refused without such a backend |
--image-tag <tag> |
Proxy lease: Android system image tag the backend picks the device by; refused without such a backend |
--device-mode <slim|full> |
Proxy lease: iOS simulator mode (slim or full) the backend leases; refused without such a backend |
--device-baseline <name> |
Proxy lease: saved device state (baseline) the backend restores on the leased device; refused without such a backend |
--physical |
Proxy lease: ask the backend for a physical device instead of a simulator or emulator; refused without such a backend |
--surface app|frontmost-app|desktop|menubar |
macOS session surface for open (defaults to app) |
--metro-host <host> |
Session-scoped Metro/debug host hint |
--metro-port <port> |
Session-scoped Metro/debug port hint; on an emulator/simulator the host defaults to the loopback alias, physical devices still need –metro-host |
--bundle-url <url> |
Session-scoped bundle URL hint |
--launch-url <url> |
Session-scoped deep link / launch URL hint |
--test-ime |
open/test/replay: activate the headless Android test IME for deterministic Unicode text entry (default on for emulators; opt-in on real devices; on test/replay it applies to the sessions the flow opens) |
--no-test-ime |
open/test/replay: keep the real Android keyboard even on emulators (opt out of the headless test IME; on test/replay it applies to the sessions the flow opens) |
--activity <component> |
Android launch activity (package/Class, .Class, or Class) or HarmonyOS ability name; not for URL opens |
--launch-console <path> |
open: capture the initial local or Limrun iOS simulator launch console window to a file |
--launch-args <arg> |
open: repeatable launch argument forwarded verbatim to the platform launch command (iOS app process args; Android adb shell am start args; HarmonyOS aa start args, each a plain word of letters, digits, and _@%+=:,./-). Linux and macOS reject the flag. |
--no-post-gesture-stabilization |
Scroll, swipe, gesture swipe, open: skip the movement check and the stabilization wait that follow a gesture, and on a local iOS simulator the first-screen wait after an app launch; use it only when your own polling verifies the screen |
--save-script [path] |
Arm evidence capture on open, publish the armed recording on close; close –save-script alone (without an armed open) is rejected — start with open –save-script, or use session save-script mid-session. Optional custom output path. On Windows, absolute paths need a drive letter or ordinary UNC share. |
--relaunch |
open: terminate app process before launching it |
--foreground |
open: keep normal app/device selection and return an initial snapshot of the first screen (a local iOS simulator waits up to 10s for it); without an app, resolve the sole running app on the sole booted iOS simulator; on HarmonyOS with an app target, fail when the launched app does not hold the foreground within 5s |
--no-record |
Do not record this action |
--wait <ms> |
Open: wait up to n ms for a device another session is holding before failing with DEVICE_IN_USE |
Also accepts: common options: --timeout <ms>.
Supported targets: Open and close apps, URLs, and deep links.
Exact behavior: agent-device help open.
Close an app or end the session.
agent-device close [app] [--save-script [path]] [--force, --overwrite] [--shutdown]| Option | What it does |
|---|---|
--force, --overwrite |
Force replacement of existing state (connect: replace an active connection; –save-script: overwrite an existing target instead of refusing) |
--save-script [path] |
Arm evidence capture on open, publish the armed recording on close; close –save-script alone (without an armed open) is rejected — start with open –save-script, or use session save-script mid-session. Optional custom output path. On Windows, absolute paths need a drive letter or ordinary UNC share. |
--shutdown |
close, disconnect: also shut down the session device where supported; a Limrun instance agent-device created is deleted with its data, an attached one keeps running. close also releases a lease or attachment kept on close |
Supported targets: Open and close apps, URLs, and deep links.
Exact behavior: agent-device help close.
open <url>opens deep links on Android and iOS, andopen <app> <url>opens a deep link in that app on iOS. For macOS, see Desktop targets.- On iOS devices,
http(s)://URLs open in Safari when no app is active. Custom-scheme URLs need an active app. - Remote daemons refuse
file:URLs withREMOTE_HOST_INPUT_DENIED. Serve local content over HTTP(S) instead. - On a local iOS Simulator, the first capture after
openwaits for the app’s first screen. If the wait ends first, the snapshot warns withpostGestureOutcome.kind: "loading"or"unsettled". Runsnapshot -iorwait text <expected>before you act. An app whose first screen has no labeled controls, such as a game canvas, always waits the full time; pass--no-post-gesture-stabilizationto skip the wait. open --wait <ms>waits for a device that another session holds. A claim held by another workspace is not waited for:openreturns the recovery command at once.installandreinstallnever wait.- If an app on an iOS simulator shows an empty accessibility tree after an earlier XCTest session, run
open <app> --relaunch, thensnapshot -i. - On iOS simulators,
openmarks the keyboard’s swipe-typing introduction and multilingual keyboard tip as shown before it launches the app, so neither sheet covers the keyboard on the first text entry. A failed write is logged and does not stop the launch. - Android React Native:
open --relaunchneeds an installed package name, not an APK path. For Metro-served JS changes, runmetro reloadinstead. --metro-host,--metro-port,--bundle-url, and--launch-urlapply to the app thatopenopens. A lateropenwithout these flags applies them again only when it opens the same app. It opens another app, such as a system app, without them. Anopenthat passes these flags for another app also removes the earlier hints from the app an earlieropenapplied them to.- ADB-backed Android:
open settings --relaunchrestarts the app that the intent opened. It fails when the intent matches more than one activity. - ADB-backed Android:
closefails withandroid-app-close-timeoutwhen the app does not leave the foreground or its processes do not exit in time. It fails withandroid-process-probe-unavailablewhen it cannot list the app’s processes; if that happens before the stop, the app keeps running. - On HarmonyOS,
openreads the foreground app after the launch dispatch, for up to 5 seconds. When the opened app never holds the foreground, the open succeeds andwarningsname itopen-not-foregroundwith the app that holds the foreground, or the fact that no mission is foreground. A lock screen is a typical cause: unlock the device, then run the open again. When no read of the mission list succeeds in that budget, the warning namesopen-foreground-probe-unreadableinstead and claims nothing about the app: check the device connection. With--foreground, an unconfirmed open fails withdetails.reason: open-not-foregroundoropen-foreground-probe-unreadable, matching the same two cases. - If
closecannot confirm its cleanup, it keeps the session and its device claim. Runcloseagain with the same options to release the device, without--save-scriptif the first attempt saved the script. The same applies whenopen --relaunchcannot confirm its effects.
iOS Simulator launch prompt:
- When
open <app> --launch-url <url>raises anOpen in "<App>"?prompt for a scheme the session app owns,opentaps Open and returnslaunchConfirmation: "accepted". It reads the prompt in the Simulator’s language. launchConfirmation: "unanswered"leaves the prompt on screen. ForlaunchConfirmationReason: url-owner-unresolved, answer it withalert accept. Foralert-unrecognized, read it withalert getfirst: it can be the app’s own alert, such as a permission prompt.launchConfirmationProbeFailuremeansopencould not tell whether a prompt is up. Check withalert getbefore you retry.launch_confirmation_unansweredmeans the app did not start after the prompt, or the prompt stayed up. Answer it withalert acceptoralert dismiss.launch_confirmation_foreign_appmeans another app owns the scheme (details.foreignAppBundleId). Dismiss the prompt withalert dismissand pass a URL that your app handles.ios-simulator-openurl-timeoutmeans the Simulator did not answer the URL hand-off. It may still have received the URL, so check the screen, then retry or runalert accept.- A prompt that appears after
opensaw the app is not answered. Usealert accept.
Back, orientation, and hardware buttons:
Navigate back in the app or system.
agent-device back [--in-app|--system] [--settle]| Option | What it does |
|---|---|
--in-app |
Back: use app-provided back UI when available; on iOS, the one hittable navigation bar back button, confirmed by a bar change, else the verified left-edge back swipe |
--system |
Back: use system back input or gesture when available; on iOS, the same back as –in-app |
Also accepts: common options: --settle, --settle-quiet <ms>, --timeout <ms>.
Supported targets: Back.
Exact behavior: agent-device help back.
Go to the device home screen.
agent-device homeSupported targets: Home.
Exact behavior: agent-device help home.
Open the device app switcher.
agent-device app-switcherSupported targets: App switcher.
Exact behavior: agent-device help app-switcher.
Set device orientation.
agent-device orientation <portrait|portrait-upside-down|landscape-left|landscape-right|auto>Supported targets: Set screen orientation.
Exact behavior: agent-device help orientation.
Press the iPhone, iPad, or Apple Watch Ultra Action Button.
agent-device action-buttonSupported targets: iPhone Action Button.
Exact behavior: agent-device help action-button.
Shake an iOS simulator or Android emulator.
agent-device shakeSupported targets: Shake.
Exact behavior: agent-device help shake.
Press a phone hardware button once.
agent-device hardware-button <volume-up|volume-down|power|mute|sleep|wake|media-play-pause|media-next|media-previous|media-rewind|media-fast-forward>Supported targets: Phone hardware buttons.
Exact behavior: agent-device help hardware-button.
Lock or unlock the device screen.
agent-device lock-screen <lock|unlock>Supported targets: Lock screen.
Exact behavior: agent-device help lock-screen.
backuses the app’s own back navigation: the back key on Android, the visible back control on macOS, and the Menu button on tvOS. On macOS, an app with no back control by identifier or “Back” label refuses within_app_back_control_unavailableand nothing is pressed; press the app’s control by its ref.- iOS has no system back.
backpresses the navigation bar’s system back button when it finds exactly one, and otherwise swipes from the left edge. It never presses a custom “Back” button, and it does not dismiss a modal or sheet: press that screen’s Close or Cancel control. On Android, system back also closes dialogs. back_swipe_no_changemeans the swipe did not change the screen.details.dismissControlslists the Back, Close, and Cancel buttons at the top of the app window as selectors, for exampleagent-device press 'role=button label="Close"'.backnever presses them itself, because they can discard a draft.back_swipe_unverifiedmeansbackcannot tell whether it navigated, for example because the screen kept changing. Check withsnapshot.back_swipe_not_dispatchedmeans nothing reached the device, so a retry is safe.- An app with a left-edge drawer can open the drawer instead of going back. When the app shows its own back or close control, press it by its ref.
back --systemsends system back: the Android back key or the tvOS Menu button. macOS has no system back and refuses it. visionOS refusesback.orientationworks on iOS and Android mobile targets only. On ADB-backed Android, it turns auto-rotate off, and the lock stays after the session ends.orientation autogives rotation back to the sensor on ADB-backed Android only. An iPhone Duo refusesportrait-upside-down.action-buttonreports that the press was sent, not what it triggered. A model without the button fails withhardware_control_unavailableand nothing is pressed. Simulators run no Shortcuts or App Intents, so verify the outcome on a physical iPhone.shakeworks on iOS simulators and local Android emulators, not on Android TV or remote providers. On iOS, the app gets a motion-shake event but no accelerometer data, so an app that detects shakes through CoreMotion does not see it. Take a snapshot to see what the app did.- On Android,
shake-rest-acceleration-unreadablemeans the emulator console returned no accelerometer reading, so nothing was sent.shake-console-refusedafter a swing means the accelerometer may not be back at rest. Check withadb emu sensor get acceleration. hardware-buttonpresses a key once and reports the press, not what the OS did with it. Android presses every key. A physical iPhone or iPad presses volume only, iOS simulators refuse every key, and TV targets point you totv-remote.- On Android,
powertoggles the screen. After a press that turns the screen off, later commands can hit a locked screen; usehardware-button wake, orlock-screen unlockto dismiss the lock screen too. lock-screenreturns once the device reports the lock state, instate.lockleaves a locked screen alone. Android verifies with the keyguard state thatdumpsys windowreports. On a device with a PIN, pattern, or password and “Power button instantly locks” off, the keyguard appears only after “Lock after screen timeout”, solockwaits that long too: at least 5 s, which Android applies even to a shorter setting, and at most one minute. iOS simulators verify with SpringBoard’s lock state and, forlock, a lock screen surface. On iOS, a dark screen is woken with the lock button first:unlockthen swipes up and needs the screen on, andlockpresses again if the screen woke unlocked.unlocklands on the app that was in front, not on the Home Screen. On Android it always sends the wake event, which leaves a screen that is on unchanged.- The session app is not activated, so check the result with
screenshot. On iOS, an app-scoped command such assnapshotbrings the session app back to the front, which can dismiss the lock screen. lock-screen unlocknever enters a credential. A PIN, pattern, password, or passcode lock fails withlock-screen-secure; on Android nothing is sent (dispatched: no).lock-screen-unverifiedmeans the device still reports the previous state. On Android,lockon a screen lock set to None fails withlock-screen-disabledand sends nothing (dispatched: no), because there is no lock screen to show.lock-screen-state-unreadablemeansdumpsysreported no keyguard state or no lock type for the foreground user, and nothing was sent.
Fold a foldable device:
Fold or unfold a foldable iPhone simulator or Android emulator.
agent-device fold [closed|half-open|open] [--keyframes <json>]| Option | What it does |
|---|---|
--keyframes <json> |
Fold: timed {atMs, angle} keyframes; final atMs is motion duration (up to 60000ms) |
Supported targets: Foldable pose.
Exact behavior: agent-device help fold.
fold closed|half-open|opensets the pose of an iPhone Duo simulator or a foldable Android emulator, such aspixel_9_pro_fold. It reports the pose only after the device confirms it. Physical devices are refused.- Take a new snapshot after every fold, even a failed one. Refs and coordinates from before it are stale.
- On iOS,
foldneeds an Xcode with foldable HID support. The first fold on a host or Xcode builds a helper and takes longer. The response’s panel size is not the next snapshot’s viewport, so do not use it to place a tap. - On a foldable iOS simulator,
homeandapp-switcherpress the Home button through the same helper, because the XCUITest Home press does not reach the home screen there. The first press on a host or Xcode builds the helper and takes longer. - On an unfolded iPhone Duo simulator with the inner panel lit, run
gesture swipe split-view-leftorgesture swipe split-view-rightto move the full-screen app to that half. Useopen <bundle>to launch the second app or switch between the two apps. With both apps in Split View, rungesture swipe split-view-exitto drag the divider left and make the right-hand app fill the screen. Other devices, a closed Duo, and WebDriver providers refuse these presets withsplit_view_unavailablebefore any touch. --keyframesplays a timed hinge trajectory on iOS only, for examplefold --keyframes '[{"atMs":0,"angle":0},{"atMs":1667,"angle":160},{"atMs":5000,"angle":180}]'.- For failure reasons, see error reasons. For panels and poses, see
agent-device help foldable.
Simulate an incoming call or SMS:
Simulate an incoming call or SMS on an Android emulator over adb.
agent-device telephony call|accept|cancel <number> | telephony sms <number> <text>Supported targets: Call and SMS simulation.
Exact behavior: agent-device help telephony.
- Use
telephonyto check how an app reacts to a call or message, for example whether video playback pauses and resumes. - It works on Android emulators through the local adb executor only. Physical devices and every other platform refuse it with
UNSUPPORTED_OPERATION. - The emulator console refuses some events, such as
acceptfor a number with no call, withtelephony-console-refused. - The emulator drops characters such as emoji from an SMS and delivers the rest.
- The call screen or notification can cover the app. Take a new snapshot before you use refs.
Remote daemons and tenants:
--tenant,--session-isolation tenant,--run-id, and--lease-idenforce lease admission on tenant-scoped daemons.--daemon-base-url http(s)://host:port[/base-path]calls a remote HTTP daemon instead of a local one. Add--daemon-auth-token <token>(orAGENT_DEVICE_DAEMON_AUTH_TOKEN) for a non-loopback URL.- Remote screenshots download to the path you pass. When a remote
record stopnames no destination, the client saves the file in your working directory and warns. - To drive a Mac’s simulators from another machine, see Remote proxy. For hosted devices in CI, see BrowserStack, AWS Device Farm, or TestMu AI. For
connect --remote-config, see Remote Metro workflow.
Human Takeover
Pause agent interactions while a person controls a device.
agent-device takeover [status | hold | release <hold-id>] [--session <name>]takeover hold
| Option | What it does |
|---|---|
--tenant <id> |
Tenant scope identifier for isolated daemon sessions |
--run-id <id> |
Run identifier used for tenant lease admission checks |
--lease-id <id> |
Lease identifier bound to tenant/run admission scope |
--reason <text> |
Human-control hold reason a blocked agent sees (takeover hold) |
--ttl-ms <ms> |
Human-control hold TTL in milliseconds, 1000 to 86400000 (takeover hold; default 60000) |
--session <name> |
Named session (implicit default is scoped to this workspace + platform) |
takeover status
| Option | What it does |
|---|---|
--daemon-transport auto|socket|http |
Daemon client transport preference |
--tenant <id> |
Tenant scope identifier for isolated daemon sessions |
--session-isolation none|tenant |
Session isolation strategy (tenant prefixes session namespace) |
--run-id <id> |
Run identifier used for tenant lease admission checks |
--lease-id <id> |
Lease identifier bound to tenant/run admission scope |
--session <name> |
Named session (implicit default is scoped to this workspace + platform) |
takeover release
| Option | What it does |
|---|---|
--daemon-transport auto|socket|http |
Daemon client transport preference |
--tenant <id> |
Tenant scope identifier for isolated daemon sessions |
--session-isolation none|tenant |
Session isolation strategy (tenant prefixes session namespace) |
--run-id <id> |
Run identifier used for tenant lease admission checks |
--lease-id <id> |
Lease identifier bound to tenant/run admission scope |
--session <name> |
Named session (implicit default is scoped to this workspace + platform) |
Exact behavior: agent-device help takeover.
Use takeover with an active remote connection when a person needs to use its leased device
without racing the agent:
agent-device takeover --session remote-sessionagent-device takeover status --session remote-sessionagent-device takeover release <hold-id> --session remote-sessiontakeover holds the device until you press Ctrl+C. While it holds, state-changing commands fail with
DEVICE_IN_USE and details.reason: "human_control_active"; read-only diagnostics still work. It
needs a device-scoped remote lease, so local sessions aren’t supported. Holds don’t survive a daemon
restart; reconnect and take the hold again. See Remote proxy.
Web Automation
Manage web automation backend.
agent-device web setup | web doctorExact behavior: agent-device help web.
--platform web drives a browser through agent-browser and requires Node 24+. Use it when a browser step belongs inside an agent-device session, replay, batch, MCP, or Node.js client flow. For standalone browser automation, use agent-browser directly.
Set up and verify the managed web backend before you open a web session:
agent-device web setupagent-device web doctoragent-device open "https://example.com" --platform webagent-device snapshot -i --platform webagent-device get text @e2 --platform webagent-device is visible 'label="Welcome"' --platform webagent-device find text "Welcome" exists --platform webagent-device click @e12 --platform webagent-device hover @e14 --settle --platform webagent-device fill @e13 "test@example.com" --platform webagent-device wait text "Welcome" --platform webagent-device network dump 25 --include headers --platform webagent-device audio probe start 10 1000 --platform webagent-device audio probe status --platform webagent-device audio probe stop --platform webagent-device screenshot ./artifacts/web-home.png --platform webagent-device screenshot ./artifacts/web-full.png --platform web --fullscreenagent-device viewport 1280 900 --platform webagent-device close --platform web- Run
web setupbefore first use and in CI bootstrap. Web commands never install the backend themselves.web doctorverifies the install. - Each web session has its own browser, cookies, and storage. Sessions with different
--sessionnames run at once. A session name is 1 to 30 letters, digits,_, or-(1 to 17 under tenant isolation); another name fails withweb_session_name_invalid. Without--session, each workspace gets its own browser. - Supported: URL open, snapshot refs,
get text/attrs,is visible/hidden/exists/absent/focused/text,find text/selector, click/press, hover, fill/type, wait,network dump,audio probe, screenshot, close, and replay scripts made from those commands. - A coordinate or selector
fillclicks the point and replaces the field’s text. When the click does not reach an editable text field, such as a date input or a field in a cross-origin frame, it fails withtext_entry_focus_not_observedand types nothing. Runsnapshot -iand fill the field by ref instead. hover --settleon web needs a selector or coordinate target, because web refs carry no geometry.audio probesamples HTML media levels; see Debugging and profiling.- Not supported: tab/window/devtools control, network routing/interception/HAR, cookies/storage, downloads/uploads, arbitrary page scripting, multi-page orchestration, and raw browser diagnostics. Use
agent-browserdirectly for those.
Device isolation scopes
agent-device devices --platform ios --ios-simulator-device-set /tmp/tenant-a/simulatorsagent-device devices --platform android --android-device-allowlist emulator-5554,device-1234--ios-simulator-device-set <path>limits simulator discovery and commands to that simulator set. iOS physical devices are not listed while it is set.--android-device-allowlist <serials>limits Android discovery and selection to those serials.- Set the same scopes with the
iosSimulatorDeviceSetandandroidDeviceAllowlistconfig keys, orAGENT_DEVICE_ANDROID_DEVICE_ALLOWLIST. - A daemon started with
AGENT_DEVICE_IOS_SIMULATOR_DEVICE_SET=<path>scopes every iOS request to that set and refuses another path withios_simulator_device_set_outside_daemon_set. A daemon that the CLI starts keeps the first value until it restarts. - Scopes apply before
--device,--udid, and--serial, so an out-of-scope selector fails withDEVICE_NOT_FOUND. - If the selected Xcode cannot find a scoped simulator, the Apple runner fails to start with
simulator_set_destination_not_found. - On macOS, daemon startup removes a symlink at
~/Library/Developer/XCTestDevices, including one you made yourself. A symlinkedXCTestDevicesis not supported.
Device discovery
List available devices and simulators.
agent-device devicesExact behavior: agent-device help devices.
List supported commands for the selected device.
agent-device capabilitiesExact behavior: agent-device help capabilities.
agent-device devices --platform iosagent-device devices --platform vega --target tvagent-device capabilities --platform androidagent-device capabilities --session checkout --jsondeviceslists available targets after--platformand isolation scopes. Each device showsmodelandosVersionwhen the platform reports them. These fields describe a device and are not selectors.open --jsonandsession list --jsonreport the attached device the same way, so a CI job can record the OS a run used. A cloud provider can grant a different OS than you asked for.capabilities --jsonlists the commands the target supports inavailableCommands. Use it instead of keeping your own platform support table. On Android,targetReadiness.press: "bounded-geometry"means ref and selector presses already wait for moving targets, so a test harness needs no fixed delay before a tap.
HarmonyOS command boundary
HarmonyOS support uses HDC and ArkUI uitest. On API 24 devices it supports lifecycle and HAP deployment, ArkUI snapshot/screenshot and selector reads, one-pointer touch and text actions, keyboard enter/dismiss, app logs, foreground app state, process RSS samples, and settings clear-app-state. Run agent-device capabilities --platform harmonyos for the command list of a selected device.
- Gestures use one pointer. Multi-touch gestures and
gesture dragreturnUNSUPPORTED_OPERATION. open --launch-argsappends each argument unchanged to theaa startcommand, such as--launch-args --ps --launch-args configKey --launch-args debugfor a string extra. Each argument must be a plain word of letters, digits, and_@%+=:,./-; other arguments returnINVALID_ARGSbefore any app operation, such as a relaunch force-stop. Device selection can still query HDC.- Physical devices support whole-screen recording with
record start <path> --scope deviceor--scope system, without--fps,--quality, or--hide-touches. Emulator recording is refused. - Not available: orientation, clipboard, alerts, network/audio capture, push and app-event delivery, React Native helpers, and trace capture.
settingssupports onlyclear-app-state.perf memory samplereports process RSS only.
Diagnostics
Diagnose device, app, dev-server, and RN/Expo readiness.
agent-device doctor [--platform ios|android|harmonyos|vega|macos|linux|web|apple] [--app <id-or-name>] [--remote]| Option | What it does |
|---|---|
--app <id-or-name> |
Target an app without opening it: doctor verifies an installed app by id or name; settings applies an app-scoped change (permission, iOS location) to a bundle id or package |
--remote |
Doctor: check remote connection setup instead of local device inventory |
Exact behavior: agent-device help doctor.
agent-device doctoragent-device doctor --platform iosagent-device doctor --platform android --app com.example.myappagent-device doctor --remote --jsondoctoris read-only: it never boots, installs, or changes the device. Without--platform, it checks every discoverable target.--appchecks whether the app is installed and enables app-specific diagnostics. To check Metro reachability, rundoctorlocally on the Metro host from your project directory.--remoteruns only the checks that don’t need a booted device; use it in CI bootstrap.
Prepare Apple runner
Pre-warm platform helpers before automation.
agent-device prepare ios-runner --platform ios|macos [--timeout <ms>]Also accepts: common options: --timeout <ms>.
Supported targets: Prepare the Apple runner.
Exact behavior: agent-device help prepare.
agent-device prepare ios-runner --platform ios --timeout 240000- In Apple CI setup, run
prepare ios-runnerafter the device boots and the app is installed, before the firstsnapshot,replay, ortest. It builds or reuses the Apple runner, starts it, and checks that it answers. - In JSON output, the phase timings can overlap. Use
timing.additivePartsfor totals that add up. - CI may cache
~/.agent-device/apple-runner/derivedwhen the cache key includes the exact agent-device package contents and Xcode version. agent-device rebuilds a cached runner whose files changed, and trims old cache entries; seeAGENT_DEVICE_IOS_RUNNER_CACHE_KEEPin Configuration. runner_cache_uncertifiablemeans the build products could not be verified. PointAGENT_DEVICE_IOS_RUNNER_DERIVED_PATHat a plain directory you own, or follow the error hint.~/.agent-device/ios-runnerbelongs to older versions. Delete it once no older version runs.- On Apple silicon with Xcode 27.x, a stable release can download a matching iOS Simulator runner on the first launch without a local runner cache. If the download is unavailable or the exact Xcode and SDK builds differ, the CLI builds locally.
- Runner build and start output goes to the session’s
runner.log.daemon.logcovers daemon startup.
TV targets
Press a TV remote navigation, media, or hardware button.
agent-device tv-remote [press|longpress] <up|down|left|right|select|menu|home|back|volume-up|volume-down|mute|power|sleep|wake|media-play-pause|media-play|media-pause|media-stop|media-next|media-previous|media-rewind|media-fast-forward|channel-up|channel-down|last-channel|guide|info|captions|tv-input|color-red|color-green|color-yellow|color-blue|android-keycode:<n>> [--duration-ms <ms>]| Option | What it does |
|---|---|
--duration-ms <ms> |
Scroll: pace the gesture over this duration when supported; tv-remote: hold the button this long (Android TV long-presses on any positive value) |
Supported targets: TV remote keys.
Exact behavior: agent-device help tv-remote.
agent-device open YouTube --platform android --target tvagent-device apps --platform android --target tvagent-device snapshot -i --platform android --target tvagent-device tv-remote press down --platform android --target tvagent-device tv-remote press select --platform android --target tvagent-device tv-remote longpress select --platform android --target tvagent-device tv-remote android-keycode:300 --platform android --target tvagent-device screenshot tv-focus.png --overlay-refs --platform android --target tvagent-device open Settings --platform ios --target tvagent-device screenshot apple-tv.png --platform ios --target tvvega virtual-device startagent-device devices --platform vega --target tvagent-device open com.example.app.main --platform vega --target tv --session vega-tvagent-device tv-remote press down --platform vega --target tv --session vega-tvagent-device tv-remote press select --duration-ms 900 --platform vega --target tv --session vega-tvagent-device close com.example.app.main --session vega-tvvega virtual-device stop- TV targets include Apple TV and Android TV simulators, emulators, and devices, plus Fire TV devices running Fire OS. Vega OS support is limited to the Vega Virtual Device (VVD).
- TV targets are focus-first: move focus with
tv-remotebefore you select a control. Do not use rawadb shell input keyeventin command plans. tv-remoteis TV-only. Phones, tablets, and WebDriver (Appium) sessions refuse it.- All TV backends support
up,down,left,right,select,menu,home, andback. The other named buttons are Android TV only. For an Android TV button without a name, useandroid-keycode:<n>. - A response confirms that the button was sent. It does not verify playback, volume, or display state, and
powerandsleepcan turn the screen off. - On Android TV,
longpresshas no exact hold time. On tvOS and Vega,--duration-msis an exact hold. - Fire TV with Fire OS connects as an Android TV device over ADB: enable ADB debugging in Settings > My Fire TV > Developer options, run
adb connect <device-ip>:5555, and use--platform android --target tv. Android TV snapshots need Android 6.0 or newer. - tvOS supports the same runner commands as iOS.
backis the Menu button andhomeis Home. Simulator-only helpers such assettingsandpushstay simulator-only, and multi-touch gestures are refused. - Vega OS: use
--platform vega --target tvwith component IDs such ascom.example.app.main. The VVD supports open, close,back,home, and the eight navigation buttons. It has no snapshot, screenshot, or selectors, so use the VVD display as visual truth. Physical Vega OS devices, including some Fire TV models, are not supported. - LG webOS and Samsung Tizen TVs run through optional plugins. See LG webOS and Samsung Tizen.
- On Android TV and tvOS, use
screenshot --overlay-refsto see which control has focus when focus metadata is missing.
watchOS simulators
Apple Watch simulators use the same XCUITest runner as iOS. Select one with --platform ios and its --udid or --device name; a watch is never picked when another Apple simulator matches.
agent-device open com.apple.NanoSettings --platform ios --device "Apple Watch Series 11 (46mm)" --session watchagent-device snapshot -i --session watchagent-device press 'label="Smart Stack"' --session watch --settleagent-device scroll down --session watchagent-device swipe 180 124 20 124 --session watchagent-device back --session watchagent-device close --session watch --shutdown- Simulators only. The host needs the watchOS simulator runtime:
xcodebuild -downloadPlatform watchOS. scroll up|downturns the Digital Crown, which also moves pickers and steppers that have crown focus.scroll left|rightis refused; swipe instead.gesture swipe right-edgegoes back.backworks only while a navigation back button is shown; on a root screen it refuses withback_swipe_not_dispatched, so press the screen’s close control by ref.homepresses the Digital Crown and acts on whatever is on screen: from an app it shows the watch face, and from the watch face it opens the app grid. Other commands act on the session app and bring it to the foreground first, so they cannot reach the watch face overlays such as Notification Center and the Smart Stack.fillandtypetype into the system input sheet and press its Done button by its English label. On another system language, the command fails withTEXT_INPUT_COMMIT_NOT_OBSERVEDand the text stays in the sheet; press its commit button by ref.action-buttonworks on Apple Watch Ultra only.recordcaptures the watch screen as on an iOS simulator.open,close,install,uninstall,boot,snapshot,find,wait,is,get,press,longpress,appstate, andscreenshotwork as on iOS.- Every other command is refused with
unsupported-platform-leaf, includingorientation,keyboard,app-switcher,clipboard,settings,alert,logs,network,perf,push,apps, and multi-touch gestures. - Open apps by their watch bundle ID, such as
com.apple.NanoSettings. Aliases such assettingsresolve to iPhone bundle IDs.
Desktop targets
agent-device devices --platform macosagent-device open TextEdit --platform macosagent-device open --platform macos --surface desktopagent-device snapshot -i --platform apple --target desktop--platform macos, or--platform apple --target desktop, selects the host Mac as adesktoptarget. Runagent-device help macosfor the exact contract.- Use an
appsession for normal app control:open,snapshot,click,fill,press,scroll,back,screenshot,record. In an app session,screenshotcaptures the app window, not the whole desktop. - Use the other surfaces to inspect desktop-wide UI before you choose an app:
frontmost-appis the focused app,desktopis the visible windows, andmenubaris the active app’s menu bar and menu extras.desktopis inspect-only. To act inside one app, open it in anappsession. open <app> --platform macos --surface menubartargets one app’s menu bar extras. Prefer it for status-item apps.open <app>attaches to a copy of the app that is already running, including one you started yourself. A copy still registering with macOS, or copies running from more than one path, can get a second instance.- Prefer selectors and
@refs over x/y, because window positions shift between runs. Useclick --button secondaryfor context menus, then runsnapshot -iagain. - On
frontmost-appandmenubar, Finder and similar apps read two quick--countclicks as a double-click. Pass an--interval-mslonger than the system double-click time to keep them apart. - macOS also supports
clipboard,trigger-app-event,logs,network dump,audio probe(needs Screen Recording permission),alert, and part ofsettings(see Settings helpers). - Mobile-only commands are unsupported on macOS:
boot,shutdown,home,orientation,app-switcher,action-button,shake,fold,install,reinstall,uninstall,install-from-source, andpush.
Set AGENT_DEVICE_MACOS_APP_BACKEND=native to run macOS app sessions without XCTest. The app can stay behind other windows, and your pointer stays yours. With the native backend:
- Each app on the
appsurface is a device of its own, so several agents can drive different apps on one Mac. Two sessions on the same app conflict. Adesktop,menubar, orfrontmost-appsession holds the whole Mac. - An app session opens and closes only its own app. Use a new
--sessionfor another app or surface. - An app session refuses
clipboard,settings, andaudio probewithunsupported-device-scope, because they act on the whole Mac. Use a--surface desktopsession for them. - An app session cannot see UI that another process shows, such as a system permission prompt.
- Electron and other Chromium-based apps show their web content in the snapshot. The first
snapshotturns on the app’s Chromium accessibility tree, which stays on while the app runs. click,press, andfillneed an element with an accessibility action inside one of the app’s windows, not its menu bar.scrollscrolls the area at the center of the front window.screenshotcaptures only the app’s front window, even when it is covered.click --button secondaryfails withcontext-menu-not-observedwhen no menu opened. Take a snapshot and retry on another element.record,prepare,back,longpress,--hold-ms,--double-tap, and gestures fail withunsupported-device-backend. Use the default XCTest backend for those.- Copies of one app need distinct bundle ids. Use one agent-device version per claims directory.
# One app, full interactionagent-device open TextEdit --platform macosagent-device snapshot -iagent-device fill @e3 "hello"agent-device screenshot textedit.pngagent-device close
# Desktop-global inspection firstagent-device open --platform macos --surface desktopagent-device snapshot -iagent-device is visible 'role="window" label="Notes"'agent-device screenshot desktop.pngagent-device close
# Menubar / menu-extra inspectionagent-device open --platform macos --surface menubaragent-device snapshot -iagent-device wait 'label~="Wi-Fi|Control Center|Battery"'agent-device close
# Targeted menu bar app inspectionagent-device open MenuBarApp --platform macos --surface menubaragent-device snapshot -iagent-device closeSnapshot and inspect
Capture or diff the accessibility tree.
agent-device snapshot [--diff] [-i] [--depth, -d <depth>] [--scope, -s <scope>] [--raw] [--actions] [--observe-only] [--force-full] [--timeout <ms>]| Option | What it does |
|---|---|
--diff |
Snapshot: show structural diff against the previous session baseline |
--record |
Force-record this action into a repair-armed heal; per-invocation only, the retired config key “record” no longer opts in (mutually exclusive with –no-record) |
-i |
Snapshot: interactive elements only |
--actions |
Snapshot: name the affordances merged inside an element (iOS sim); not directly invokable — reach them via the detail screen, labeled children, or coordinates |
--observe-only |
Snapshot: observe the iOS session app without activation or foreground repair |
--force-full |
Snapshot: re-emit the full tree even when unchanged |
Also accepts: common options: --timeout <ms>, --depth, -d <depth>, --scope, -s <scope>, --raw.
Supported targets: Accessibility snapshot, snapshot diff, and audit.
Exact behavior: agent-device help snapshot.
Read element text or attributes.
agent-device get text|attrs <@ref|selector>| Option | What it does |
|---|---|
--record |
Force-record this action into a repair-armed heal; per-invocation only, the retired config key “record” no longer opts in (mutually exclusive with –no-record) |
Also accepts: common options: --depth, -d <depth>, --scope, -s <scope>, --raw.
Supported targets: Refs, selectors, element lookup, and attribute reads.
Exact behavior: agent-device help get.
agent-device snapshot -iagent-device snapshot -i -s "Settings"agent-device diff snapshot -iagent-device get text @e1agent-device get attrs @e1--rawreturns the full provider tree, including offscreen nodes and structural wrappers. See iOS capture behavior and Android capture behavior.- A source checkout must run
pnpm build:androidbefore Android verification, because Android snapshots install a bundled helper. truncated: truemeans the capture hit a backend node limit and the last elements are missing; see Truncated captures.- For
viewport,--scope, and--actions, see Snapshots. diff snapshotcompares with the previous snapshot in the session, then makes the new one the baseline. A snapshot read with different flags starts a new baseline instead of listing changes.
Audit the current screen
Report advisory accessibility findings.
agent-device auditSupported targets: Accessibility snapshot, snapshot diff, and audit.
Exact behavior: agent-device help audit.
audit checks the current screen for accessibility problems. Findings are review prompts, not failures, and audit changes nothing on the device.
- It checks for small targets, controls with no accessible name, controls of one role that share a name, and controls covered by other UI.
agent-device help auditdescribes each check and its exemptions. - On Android,
auditalso prints an estimated TalkBack swipe order for each app window, as refs. The estimate uses TalkBack’s ordering rules on the captured tree, so it can differ from TalkBack where TalkBack scrolls, moves between windows, or reads web content. Confirm an order problem with TalkBack on a device. - On iOS 17+ with the XCTest runner,
auditalso runs Apple’s native accessibility checks. Other targets run the heuristic checks only. Apple’s Dynamic Type and clipped-text checks are not run;agent-device help accessibilitydescribes the large text check to use instead. - A system alert over the app stops Apple’s checks with
native_audit_blocked_by_alert. Runagent-device alert acceptoragent-device alert dismiss, then runauditagain. A runner answer the CLI cannot read fails withnative-audit-invalid-result. - When a native finding matches a captured element, it includes its ref. Otherwise, match its
rectagainst a new snapshot before you act. A finding without a rect names no element, so report it without acting. - Like
find,auditreturns pinned refs such as@eN-s<refsGeneration>; press those. Take a new snapshot before you use other refs.
Wait and alerts
Wait for a duration, text, selector, strict absence, or stable UI.
agent-device wait <ms>|text <text>|@ref|<selector>|absent <selector> [timeoutMs]|stable [quietMs] [timeoutMs]Also accepts: common options: --depth, -d <depth>, --scope, -s <scope>, --raw.
Supported targets: Wait for text, selectors, and timeouts.
Exact behavior: agent-device help wait.
Inspect, accept, or dismiss a platform alert.
agent-device alert [get|accept|dismiss|wait] [timeout]Supported targets: Read, accept, and dismiss system alerts.
Exact behavior: agent-device help alert.
agent-device wait 1500agent-device wait text "Welcome back"agent-device wait @e12agent-device wait 'role="button" label="Continue"' 5000agent-device wait absent 'label="Loading..."' 5000agent-device alertagent-device alert getagent-device alert wait 3000agent-device alert acceptagent-device alert dismiss- Prefer
wait textor a selector wait over a fixedwait <ms>. Selector waits resolve selectors the same way asclickandis. wait absent <selector>is strict absence: it passes only when a complete, readable capture has zero matches, so hidden or off-screen matches keep it pending. It refuses--scopeand--depth.wait text <value>never matches an editable field by its current value. Sowait textafterfillwaits until the app shows that text elsewhere, for example after Save. To check the field itself, useis text <selector> <value>orget text.wait @refwaits for the ref’s label text, so a duplicate label can match another element. To wait for one field, use a selector such aswait 'id="email"'.- Wait failures carry
error.details.reason; see error reasons. Retrywait_capture_stalledandwait_runner_restart_exhausted. Retrywait_readiness_exhaustedwith a timeout that covers the iOS runner start.wait_target_absent,wait_target_present,wait_stable_timeout, andwait_deadline_exceededmean the screen did not reach the expected state in time.wait_landmark_identity_mismatchcomes from a replay guard.predicate_failedmeans strictwait absentcould not prove absence because no valid capture arrived. - Branch on
readableCaptures,waitedMs,matches, andfirstMatchinstead of parsing error text. A timed-out wait also lists itspollsand alogPathto the full request log.
Handle system alerts:
alerthandles system alerts on iOS, macOS, and Android permission dialogs. On iOS it also covers app-owned modal popups and Safari’s page prompts.- On Android,
alertalso handles the “isn’t responding” (ANR) dialog in any device language:dismisspresses Close app, andacceptpresses Wait. While an ANR dialog has focus and its process does not belong to the session app alone, commands that act on the screen are refused and their hint namesalert. An ANR of the session app is closed, and the app is relaunched, before the command runs. - Use
alert getfor a quick check, andalert wait <short-ms>only when a prompt may appear after async work. Do not usesettings permissionto answer a dialog already on screen; it is for setup before a flow. acceptanddismissare sent once and never replayed, even if the response is lost. A closed alert does not prove that a permission was granted, so verify the app outcome.acceptpicks the lasting grant, such asAllow While Using AppoverAllow Once, or “Allow all” on Android’s partial-media sheet. On iOS,dismisspresses only a recognized decline button, such asCancelorDon't Allow. iOS simulators also recognize these labels in the device’s preferred languages; on physical iOS devices, tvOS, and visionOS the runner cannot read the OS strings, so it recognizes the system prompts’ Simplified Chinese wording from a built-in table, at the rank of the English label each entry translates; wording the table does not cover stays unknown.- On iOS and Android, an unrecognized or ambiguous button fails with
ALERT_BUTTON_NOT_FOUNDoralert_button_undecided, and nothing is pressed. Read the labels withalert get, then press your choice withsnapshot -iandpress @ref. macOS falls back to the default or cancel button, then the first or last button. ALERT_UNRESOLVEDmeans the runner found an alert it cannot act on. Inspect it withscreenshotandsnapshot -i, thenpress @refon the visible button.alert-window-expired,ALERT_CONFIRMATION_UNAVAILABLE,ALERT_DEADLINE_EXCEEDED, anddispatched: unknownmean the press may have happened. Runalert getbefore you act again.- An
alert getthat fails withrunner_main_thread_timeoutdoes not mean there is no alert. Runalert getagain. - A screen with no alert answers
alert get --jsonwithstatus:none, on every platform that servesalert. Branch onstatus, not on the message. - If a sheet or permission prompt is visible but
alertreports none, runsnapshot -i -s "<visible label>", thenpress @refon the visible button.
Interactions
Click or tap a UI target.
agent-device click <x y|@ref|@ref,...|selector>| Option | What it does |
|---|---|
--count <n> |
Repeat count for press, swipe and gesture tap series |
--interval-ms <ms> |
Delay between press iterations |
--hold-ms <ms> |
Press or gesture tap hold duration for each iteration; for gesture pan, the hold before the move |
--jitter-px <n> |
Deterministic per-axis coordinate jitter in pixels |
--double-tap |
Use double-tap gesture per press iteration |
--verify |
Capture cheap post-action evidence (AX digest, node counts, changedFromBefore) instead of a follow-up snapshot |
--button primary|secondary|middle |
Click: choose mouse button (middle reserved for future macOS support) |
Also accepts: common options: --settle, --settle-quiet <ms>, --timeout <ms>, --depth, -d <depth>, --scope, -s <scope>, --raw.
Supported targets: Tap, press, and fill.
Exact behavior: agent-device help click.
Short-press a UI target.
agent-device press <x y|@ref|@ref,...|selector>Aliases: tap.
| Option | What it does |
|---|---|
--count <n> |
Repeat count for press, swipe and gesture tap series |
--interval-ms <ms> |
Delay between press iterations |
--hold-ms <ms> |
Press or gesture tap hold duration for each iteration; for gesture pan, the hold before the move |
--jitter-px <n> |
Deterministic per-axis coordinate jitter in pixels |
--double-tap |
Use double-tap gesture per press iteration |
--verify |
Capture cheap post-action evidence (AX digest, node counts, changedFromBefore) instead of a follow-up snapshot |
Also accepts: common options: --settle, --settle-quiet <ms>, --timeout <ms>, --depth, -d <depth>, --scope, -s <scope>, --raw.
Supported targets: Tap, press, and fill.
Exact behavior: agent-device help press.
Focus input at screen coordinates.
agent-device focus <x> <y>Supported targets: Refs, selectors, element lookup, and attribute reads.
Exact behavior: agent-device help focus.
agent-device click @e1agent-device click @e1 --button secondary # macOS secondary click / context menuagent-device click @e13,@e14 # one plan, one admission passagent-device press @e13,@e14 # a two-key plan; up to 16 refsagent-device focus @e2agent-device fill @e2 "text" # Replace the field valueagent-device fill @e2 "search" --delay-ms 100printf %s "$PASSWORD" | agent-device fill @e2 --text-stdin # Text from stdin, kept out of argvagent-device type "text" # Type into focused field without clearingagent-device type "query" --delay-ms 100agent-device press 300 500agent-device press 300 500 --count 12 --interval-ms 45agent-device press 300 500 --count 6 --hold-ms 120 --interval-ms 30 --jitter-px 2agent-device swipe 540 1500 540 500agent-device swipe 540 1500 540 500 --count 8 --pause-ms 30 --pattern ping-pongagent-device gesture pan 200 420 0 -80 500agent-device gesture pan 200 420 80 -40 700 --pointer-count 2agent-device gesture fling right 200 420 180agent-device gesture drag 'id="drag-source"' 'id="drop-target"'agent-device gesture drag @e4-s12 'label="Archive"' 700 600 200agent-device longpress 300 500 800agent-device hover @e12 --settle # Web only: move the pointer without pressingagent-device scroll down 0.5agent-device scroll down --pixels 320agent-device scroll down --until 'label="Sign in"'agent-device scroll refresh # pull-to-refresh at the top of the listagent-device gesture pinch 2.0 # zoom in 2xagent-device gesture pinch 0.5 200 400 # zoom out at coordinatesagent-device gesture pinch 2 @e17 # zoom in 2x centered on an elementagent-device gesture rotate 35 200 420 # rotate app contentagent-device gesture transform 200 420 80 -40 2 35 700 # combined pan, zoom, and rotateagent-device gesture tap 80 300 200 450 310 600 # three fingers at onceagent-device gesture tap 80 300 200 450 --count 20 --pause-ms 100 # repeated two-finger tapA successful click or press means the action was sent to where the command found the target. It does not confirm that the element received it or that the screen changed. When the next step depends on it, add --verify (reports changedFromBefore), add --settle (returns the diff once the UI goes quiet), or follow with wait <selector>. Before you retry a failed interaction, see Retry after a failed command.
--settle reads the tree in the same view as the refs you last read: the full tree after snapshot, the interactive view after snapshot -i.
After an action that animated the screen, a click or press on a ref or selector waits for the target to come to rest. If it does not, the command refuses with target_still_moving and nothing is pressed. Run wait <selector> on the target and retry, or add --settle. A refused @ref press needs a new snapshot -i, because the wait retires the ref. Presses at raw coordinates, and click @ref on the web, skip this check.
A raw-coordinate press has no ref to wait on and skips that check. To confirm that a coordinate press changed the screen, capture before and after, then diff:
agent-device screenshot --out before.pngagent-device press 201 500agent-device diff screenshot --baseline before.png --out diff.png --jsondiff screenshot ranks the changed regions and writes the tinted diff PNG. Before you retry a coordinate press that produced no change, see Screenshots.
On iOS, a press on a control nested inside a larger touch control, such as a swipe action beside its row, refuses with target_not_hittable when the platform reports the control as not hittable. Reveal the control, for example by swiping its row, and take a new snapshot -i.
A comma-separated ref plan, such as press @e13,@e14, presses 2 to 16 refs as one command. Run snapshot -i first and copy the refs exactly. A refusal after the first press reports details.dispatchedSteps; plan again from a new snapshot -i. While script recording is armed, a plan needs --no-record. See agent-device help press.
If rotation stops repeated iOS presses, inspect the screen before you continue with the remaining presses.
Text entry
Replace text in a UI input.
agent-device fill <x> <y> <text> | fill <@ref|selector> <text> | fill <x y|@ref|selector> --text-stdin| Option | What it does |
|---|---|
--delay-ms <ms> |
Delay between typed characters |
--record-as <VAR> |
Fill: send the live text but publish ${VAR} in an armed .ad recording |
--text-stdin |
Fill: read the text from stdin (max 64 KiB, one trailing newline removed) instead of argv |
--verify |
Capture cheap post-action evidence (AX digest, node counts, changedFromBefore) instead of a follow-up snapshot |
Also accepts: common options: --settle, --settle-quiet <ms>, --timeout <ms>, --depth, -d <depth>, --scope, -s <scope>, --raw.
Supported targets: Tap, press, and fill.
Exact behavior: agent-device help fill.
Append text to the focused input.
agent-device type <text> [--delay-ms <ms>]| Option | What it does |
|---|---|
--delay-ms <ms> |
Delay between typed characters |
Supported targets: Type into the focused field.
Exact behavior: agent-device help type.
fillreplaces the field value.typeappends to the focused field: usefill @ref "text"to target a field, orpress @refthentype "text".- Use plain
fillortypefirst. Add--delay-msonly when a debounced or search-as-you-type field misses characters. fill --text-stdinkeeps a secret out of process arguments. Pipe it withprintf %s. Output shows the value as${VAR}with--record-as <VAR>, and as[REDACTED]otherwise. While script recording is armed, pass--record-as <VAR>or--no-record. Batch steps do not accept--text-stdin.--text-stdinand--record-askeep the text out of agent-device’s own output and scripts. On iOS, XCTest’s own logs and.xcresultbundle can still hold typed text, so use test-only credentials. See Security and trust.- On iOS, a masked field that shows as many bullets as its placeholder can look empty after a failed clear, so
fillcan type next to the old text. Check the field after you fill a secure field. - Android text entry is owned by agent-device. Do not fall back to raw
adb, clipboard, or paste; if the backend cannot type non-ASCII text, report the gap. Androidfillverifies the text and fails instead of retrying when the IME captures input.
Text-entry errors and what to do:
TEXT_INPUT_NOT_FOCUSED(type, iOSfill): focus a visible text input and retry. If accessibility does not expose the input, focus it by coordinates. If the input you want already has focus, end editing with a visible control, then retry.NO_TEXT_INPUT_AT_POINT(no_text_input_at_point, iOSfill): no text input is under the point, and nothing changed. A ref or selector fill aims at the center of its node, so runsnapshot -iand pick the input node itself.TEXT_INPUT_PROBE_UNAVAILABLE(text_input_probe_unavailable, iOSfill): the runner could not look up the input, and nothing changed. Retry the fill.TEXT_INPUT_SYNTHESIS_UNAVAILABLE(iOStype "\n"): show the software keyboard, then retry.TEXT_INPUT_COMMIT_NOT_OBSERVED(iOSfill): the field may hold none, part, or all of the text. Runsnapshot -i; if the field is wrong, retryfillwith the--delay-msvalue from the error hint.TEXT_INPUT_CLEAR_NOT_OBSERVED(iOSfill): the old text was not cleared, so nothing was typed. Inspect withsnapshot -i, then retryfill.TEXT_INPUT_SYNTHESIS_BUDGET_EXCEEDED(iOSfill): the text is too long for one command, and nothing was typed. Fill up to the limit that the hint names, then append the rest withtype. A longer timeout does not help.TEXT_ENTRY_MISMATCH(iOSfill): the field shows dropped characters or no change. App masks and filters can cause this too (5into$0.00can show$0.05). Retryfillonly if the field needs correction, with the--delay-msvalue from the error hint.
Recover from these with fill, never type, because type appends to what the field already holds. The exception is the budget error above.
On iOS, a single-line fill that ends in a submit key, or a field that disappears after typing, succeeds without verification. Assert the resulting screen.
fill returns verification: "unconfirmed" when the field’s value differs from the request but no failure is proven, such as app formatting (00 062 91 77 for 000629177). Inspect requested, before, and after, then assert the value or the resulting screen:
agent-device wait 'id="field-phone" value="00 062 91 77"'Pointer and gestures
Hold a UI target to open a context menu.
agent-device longpress <x y|@ref|selector> [durationMs]Aliases: long-press.
Also accepts: common options: --settle, --settle-quiet <ms>, --timeout <ms>, --depth, -d <depth>, --scope, -s <scope>, --raw.
Supported targets: Long press.
Exact behavior: agent-device help longpress.
Hover the pointer over a UI target (web only).
agent-device hover <x y|@ref|selector>Also accepts: common options: --settle, --settle-quiet <ms>, --timeout <ms>, --depth, -d <depth>, --scope, -s <scope>, --raw.
Supported targets: Hover and viewport size.
Exact behavior: agent-device help hover.
Fling between coordinates.
agent-device swipe <x1> <y1> <x2> <y2> [--count <n>] [--pause-ms <ms>] [--pattern one-way|ping-pong] [--settle] [--settle-quiet <ms>] [--timeout <ms>]| Option | What it does |
|---|---|
--count <n> |
Repeat count for press, swipe and gesture tap series |
--no-post-gesture-stabilization |
Scroll, swipe, gesture swipe, open: skip the movement check and the stabilization wait that follow a gesture, and on a local iOS simulator the first-screen wait after an app launch; use it only when your own polling verifies the screen |
--pause-ms <ms> |
Delay between swipe or gesture tap iterations |
--pattern one-way|ping-pong |
Swipe repeat pattern |
Also accepts: common options: --settle, --settle-quiet <ms>, --timeout <ms>.
Supported targets: Gesture plans and swipes.
Exact behavior: agent-device help swipe.
Run pan, fling, swipe, pinch, rotate, transform, tap, or drag gestures.
agent-device gesture <pan|fling|swipe|pinch|rotate|transform|tap|drag> ...gesture pan
| Option | What it does |
|---|---|
--pointer-count <1|2> |
Gesture pan: number of touch pointers (default 1) |
--hold-ms <ms> |
Press or gesture tap hold duration for each iteration; for gesture pan, the hold before the move |
gesture tap
| Option | What it does |
|---|---|
--count <n> |
Repeat count for press, swipe and gesture tap series |
--hold-ms <ms> |
Press or gesture tap hold duration for each iteration; for gesture pan, the hold before the move |
--pause-ms <ms> |
Delay between swipe or gesture tap iterations |
gesture fling
Reads no options.
gesture swipe
| Option | What it does |
|---|---|
--no-post-gesture-stabilization |
Scroll, swipe, gesture swipe, open: skip the movement check and the stabilization wait that follow a gesture, and on a local iOS simulator the first-screen wait after an app launch; use it only when your own polling verifies the screen |
gesture pinch
Reads no options.
gesture rotate
Reads no options.
gesture transform
Reads no options.
gesture drag
Reads no options.
Also accepts: common options: --settle, --settle-quiet <ms>, --timeout <ms>.
Supported targets: Gesture plans and swipes.
Exact behavior: agent-device help gesture.
- Touch platforms refuse
hover; uselongpressfor a hold. Forhoveron the web, see Web Automation. - Add
--settleto a supportedswipeorgestureto wait for the UI to go quiet after the final repetition. The diff compares with the last observed tree. Copy returned refs with their generation suffix. When the observation is inconclusive or the diff lacks your target, runsnapshot -i. swipeis a quick throw.gesture panis a deliberate timed drag with one pointer, or two with--pointer-count 2.gesture flingis a fast directional throw. To update old scripts, see Rewrite old gesture commands.gesture pan --hold-ms <ms>holds one pointer before it moves, for drag handles that expose no element and so no ref, such as reorder grips.gesture drag source destinationholds one pointer from a selector or ref to another. It refuses coordinates; for a coordinate drag, usegesture pan <x> <y> <dx> <dy> [ms] --hold-ms <ms>. It and--hold-mswork on Android touch devices and iOS/iPadOS only.gesture pinch,gesture rotate,gesture transform, and two-fingergesture panwork in Android, iOS, and iPadOS app sessions. iOS sessions through a WebDriver provider refuse them. A path that does not fit the viewport fails instead of being clamped. Useorientationto rotate the device.swipeandgesturecoordinates use the unitssnapshotreports: points on Apple platforms, not screenshot pixels. A gesture that leaves the viewport fails withGESTURE_TRAJECTORY_OUT_OF_BOUNDS, and the message names the viewport size and the first point outside it. Agesture pinch,rotate,transform, or two-fingerpanthat cannot keep its fingers far enough apart in the viewport fails the same way, and its message names only the viewport.gesture taptouches 2 to 5 points at once in Android and iOS/iPadOS app sessions. WebDriver providers refuse it unless they declaretapGesturesupport. Three or more fingers can trigger iOS system gestures such as undo, so verify app state afterwards. Usepressfor one finger.- On iOS, a long press, scroll, or swipe that fails with
synthesized_gesture_not_dispatchedsent nothing, so a retry is safe.synthesized_gesture_outcome_unknownmeans it may have run; check the screen first. - On iOS, a one-finger
gesture pancan cross into the keyboard area. Use it for an intended drag where the app supports interactive keyboard dismissal. - Apps may not report exactly the requested pan, scale, and rotation. Verify app state, and prefer separate
gesture pan,gesture pinch, orgesture rotatecommands when exact values matter. Seeagent-device help gestures.
Scroll
Scroll in a direction or to an edge.
agent-device scroll <direction|top|bottom|refresh> [amount] [--until <selector>] [--max-passes <n>] [--pixels <n>] [--duration-ms <ms>] [--settle]| Option | What it does |
|---|---|
--duration-ms <ms> |
Scroll: pace the gesture over this duration when supported; tv-remote: hold the button this long (Android TV long-presses on any positive value) |
--pixels <n> |
Scroll: explicit gesture distance in pixels |
--until <selector> |
Scroll: repeat passes until the selector is visible on screen |
--max-passes <n> |
Scroll –until: maximum gestures |
--no-post-gesture-stabilization |
Scroll, swipe, gesture swipe, open: skip the movement check and the stabilization wait that follow a gesture, and on a local iOS simulator the first-screen wait after an app launch; use it only when your own polling verifies the screen |
Also accepts: common options: --settle, --settle-quiet <ms>, --timeout <ms>.
Supported targets: Scroll.
Exact behavior: agent-device help scroll.
Things to know:
- A scroll does not land on an exact position. The amount is a fraction of the viewport (
0.5is half), and the app’s scroll physics decide the final offset. - To reach an off-screen element, use
scroll down --until <selector>. It also works in.adscripts on any screen size; see Replay and E2E testing. For a long list, raise--max-passes. If the request times out, inspect the screen and search again. --settlereturns the settled diff with new refs, so you do not need anothersnapshot -ibefore the next action.- Read
movementin the result:moved,at-edge,unchanged, orunobserved. Afterscroll refresh,unchangedmeans that nothing changed on screen, not that a refresh found nothing new. Check the app’s refresh indicator or content. scroll refreshis one slow pull down. On Android it starts inside the scroll container; on iOS it runs down the middle of the screen, so a list only in the top or bottom part of the screen is not pulled.- With a keyboard up, the scroll stays above the keyboard and leaves it open. If too little room is left, end editing first: on Android, use
keyboard dismiss; on iOS, use a visible dismissal control. - A refused scroll names its cause in
details.reason, and the hint gives the next step; see error reasons. Runscroll topafterscroll_refresh_not_at_top. Other reasons:scroll_keyboard_occludes_surface,scroll_no_progress,scroll_until_pass_limit,scroll_until_edge_reached,scroll_until_no_progress,scroll_until_capture_unreadable,scroll_edge_pass_limit,scroll_edge_no_progress,scroll_edge_capture_unreadable,scroll_max_passes_requires_until, andscroll_max_passes_invalid. --no-post-gesture-stabilizationis for a caller that polls the screen itself, such as a test runner. Without your own polling, the next read can return a tree that is still moving. In the Node client or a batch step, passpostGestureStabilization: false. To apply it to every command, setpostGestureStabilizationtofalsein your user config, or setAGENT_DEVICE_POST_GESTURE_STABILIZATION=0.
Retry after a failed command
When a command fails, read error.details.dispatched before you retry:
no: the action never reached the device. Checkdetails.reasonbefore you retry.unknown: the action may have landed. Take a snapshot before you retry; a blind retry can tap, type, or navigate twice.- Missing: no guarantee. Treat it as
unknown.
Read-only commands such as get, snapshot, and wait report no. Once any step of a request reached the device, the failure is unknown.
For a failed batch or replay, check completed steps and details.dispatchedSteps first, because earlier steps may have run. A step refused with bounded_composite_resource_unsupported must run as a separate command: run it with its original arguments and the same --session. details.standaloneCommandName names the command but is not a complete command line.
An Apple runner that returns COMMAND_ALREADY_FINISHED cannot replay that command’s outcome. Run snapshot -i to see the result before you send another interaction.
Error reasons lists the typed reasons by command and subsystem. These refusals carry dispatched: no, so nothing ran:
session_or_device_selector_required: open a session or pass--platform.named_session_not_found: the daemon was replaced or restarted, or the name is wrong. Runagent-device session listto see the sessions it holds. Some commands report the same cause asSESSION_NOT_FOUNDwithout a reason.session_app_required: runopen <app>, or name the app, as insettings clear-app-state com.example.app.app_not_installed: runapps --allfor the exact bundle id or package, or install the app.malformed_request: fix the client that built the request; resending it unchanged fails the same way.remote_daemon_unavailable: the remote daemon did not answer its health check. Make it reachable, or clear--daemon-base-urlorAGENT_DEVICE_DAEMON_BASE_URL. For a savedconnectconnection, rundisconnectto return to the local daemon.webdriver_route_unsupported: the device cloud’s driver does not implement the route. The limit is the driver, not the device.findwith no match (COMMAND_FAILED, no reason): nofindaction ran. Runsnapshot -ito see the current elements, or scroll first if the element may be off-screen.
iOS runner refusals carry a typed error.details.reason too:
runner_busy: the runner ran nothing. Retry the command.runner_main_thread_timeout: the action may still land (dispatched: unknown). Take a snapshot before you retry.synthesized_gesture_not_dispatchedandsynthesized_gesture_outcome_unknown: see Pointer and gestures.
The reasons that back, text entry, and keyboard report are listed under those commands.
Find (semantic)
Find an element and act.
agent-device find <locator|text> [action] [value] [--first|--last]| Option | What it does |
|---|---|
--record |
Force-record this action into a repair-armed heal; per-invocation only, the retired config key “record” no longer opts in (mutually exclusive with –no-record) |
--first |
Find: pick the first match when ambiguous |
--last |
Find: pick the last match when ambiguous |
Also accepts: common options: --depth, -d <depth>, --raw.
Supported targets: Refs, selectors, element lookup, and attribute reads.
Exact behavior: agent-device help find.
agent-device find "Sign In" clickagent-device find label "Email" fill "user@example.com"agent-device find role button clickagent-device find "Follow" listfind locates an element by text, label, or role and runs an action on it (click by default). See Selectors for the action list, ambiguous matches, and --first/--last.
Assertions
Check a UI predicate on a selector.
agent-device is <predicate> <selector> [value] [--depth, -d <depth>] [--scope, -s <scope>] [--raw]| Option | What it does |
|---|---|
--record |
Force-record this action into a repair-armed heal; per-invocation only, the retired config key “record” no longer opts in (mutually exclusive with –no-record) |
Also accepts: common options: --depth, -d <depth>, --scope, -s <scope>, --raw.
Supported targets: Refs, selectors, element lookup, and attribute reads.
Exact behavior: agent-device help is.
agent-device is visible 'role="button" label="Continue"'agent-device is exists 'id="primary-cta"'agent-device is absent 'label="Loading..."'agent-device is hidden 'text="Loading..."'agent-device is editable 'id="email"'agent-device is selected 'label="Wi-Fi"'agent-device is checked 'role=switch label="Wi-Fi"'agent-device is text 'id="greeting"' "Welcome back"isexits non-zero when the predicate fails. It takes selectors, not refs like@e3.- Supported predicates are
visible,hidden,exists,absent,editable,selected,checked,focused, andtext. is visiblepasses when the element is in the visible viewport.is existsonly checks that the selector matches.is checkedpasses only on a switch, checkbox, or radio that is explicitly checked. An iOSmixedstate fails it.is absentpasses only when a complete, readable, settled capture has zero matches. It does not mean hidden, and it refuses--scopeand--depth.- A predicate about one element fails with
AMBIGUOUS_MATCHwhen the selector matches several nodes; that is not a missing element. The error lists up to five candidate refs, so you can act on one directly. See Selectors. - On iOS, React Native text appears as two nodes with the same label.
is,get attrs, and replay treat the pair as one;find ... listandsnapshot --jsonshow both. - On the web, static page text is readable by
wait text,find text,get text, andtext=, but it has no ref and is never a tap target. Usetext=for page text, or addeditable=trueto name a field. - The first read after a scroll or swipe can report
postGestureOutcome. Withkind: "unsettled"or"loading", a miss does not prove absence, so read again. Withkind: "no-effect", nothing changed: the list may be at its edge or ignore synthesized scrolls, and a rawswipe x1 y1 x2 y2inside it can move it.
Replay
Replay a recorded session or Maestro flow.
agent-device replay <path> | replay export <file.ad> [--out <path>]| Option | What it does |
|---|---|
--force, --overwrite |
Force replacement of existing state (connect: replace an active connection; –save-script: overwrite an existing target instead of refusing) |
--metro-host <host> |
Session-scoped Metro/debug host hint |
--metro-port <port> |
Session-scoped Metro/debug port hint; on an emulator/simulator the host defaults to the loopback alias, physical devices still need –metro-host |
--bundle-url <url> |
Session-scoped bundle URL hint |
--test-ime |
open/test/replay: activate the headless Android test IME for deterministic Unicode text entry (default on for emulators; opt-in on real devices; on test/replay it applies to the sessions the flow opens) |
--no-test-ime |
open/test/replay: keep the real Android keyboard even on emulators (opt out of the headless test IME; on test/replay it applies to the sessions the flow opens) |
--save-script [path] |
Arm a repair transaction from this replay (ADR 0012): recording starts at step 1, and the healed script commits when the repair-armed session tears down (close, close –save-script, or idle-reap). Independent of the open/close authoring arm-on-open. Optional custom output path. |
--update, -u |
Replay: retired as a rewrite (ADR 0012) — never edits the .ad file; every divergence already carries ranked selector suggestions, –update or not |
--from <n> |
Replay: resume at 1-based plan step n, skipping 1..n-1 without executing them (requires –plan-digest; see a divergence report’s resume field). replay only, not test |
--plan-digest <sha256> |
Replay: the plan digest a –from resume must match (from a prior divergence report); mismatch, edits, or include/platform-expansion changes fail INVALID_ARGS before any action |
--keep-session |
Replay: leave the session active by suppressing exactly an authored terminal close in a native .ad script; replay only, not test or Maestro YAML |
--maestro |
Replay: treat input as a supported Maestro YAML subset; unsupported syntax fails loudly. See agent-device help maestro for commands and boundaries |
-e KEY=VALUE, --env KEY=VALUE |
Replay/Test: inject or override a ${KEY} variable for the script (repeatable) |
Also accepts: common options: --timeout <ms>, --out <path>.
Exact behavior: agent-device help replay.
Run replay test suites.
agent-device test <path-or-glob>...| Option | What it does |
|---|---|
--metro-host <host> |
Session-scoped Metro/debug host hint |
--metro-port <port> |
Session-scoped Metro/debug port hint; on an emulator/simulator the host defaults to the loopback alias, physical devices still need –metro-host |
--bundle-url <url> |
Session-scoped bundle URL hint |
--test-ime |
open/test/replay: activate the headless Android test IME for deterministic Unicode text entry (default on for emulators; opt-in on real devices; on test/replay it applies to the sessions the flow opens) |
--no-test-ime |
open/test/replay: keep the real Android keyboard even on emulators (opt out of the headless test IME; on test/replay it applies to the sessions the flow opens) |
--update, -u |
Replay: retired as a rewrite (ADR 0012) — never edits the .ad file; every divergence already carries ranked selector suggestions, –update or not |
--maestro |
Replay: treat input as a supported Maestro YAML subset; unsupported syntax fails loudly. See agent-device help maestro for commands and boundaries |
-e KEY=VALUE, --env KEY=VALUE |
Replay/Test: inject or override a ${KEY} variable for the script (repeatable) |
--fail-fast |
Test: stop the suite after the first failing script; with sharding, each shard stops independently |
--retries <n> |
Test: retry each failed script up to n additional times |
--record-video |
Test: record each replay attempt to recording.mp4 in its attempt artifacts |
--artifacts-dir <path> |
Test: root directory for suite artifacts |
--reporter <name-or-path> |
Test: add a replay suite reporter; use default, junit:<path>, or a custom reporter path (repeatable) |
--report-junit <path> |
Test: compatibility alias for –reporter junit:<path> |
--shard-all <n> |
Test: run the full suite on each of n devices; combine with –device id1,id2 for explicit connected devices; AD_SHARD_INDEX is zero-based |
--shard-split <n> |
Test: split runnable suite entries across n devices; AD_SHARD_INDEX is zero-based |
Also accepts: common options: --timeout <ms>.
Exact behavior: agent-device help test.
agent-device open Settings --platform ios --session e2e --save-script [path]agent-device replay ./session.ad # Run deterministic replay from .ad scriptagent-device test ./suite # Run every .ad file in a folder or glob seriallyagent-device test ./suite --timeout 60000 --retries 1agent-device replay ./session.ad --from 4 --plan-digest <sha256> # Execute step 4; if already completed, use the next safe index with this digestagent-device replay ./session.ad --keep-session # Suppress its terminal close and continue interactivelyreplayreads script paths on the calling machine, so the same command works with a local or remote daemon.testruns a serial suite and streamspass/fail/skipon stderr (--verboseprints every result).--platformfilters by each script’scontext platform=...header,--timeoutand--retries(max3) apply per attempt, and artifacts default to.agent-device/test-artifacts.- A failing step returns a
REPLAY_DIVERGENCEreport with the--fromstep and--plan-digestto resume from. See Resume a failed replay.
See Replay and E2E testing for recording and CI workflow details, and Run Maestro flows for Maestro YAML.
Batch
Run multiple commands.
agent-device batch [--steps <json> | --steps-file <path>]| Option | What it does |
|---|---|
--steps <json> |
Batch: JSON array of {“command”,“input”} steps |
--steps-file <path> |
Batch: read steps JSON from file |
--on-error stop |
Batch: stop when a step fails |
--max-steps <n> |
Batch: maximum number of allowed steps |
Also accepts: common options: --out <path>.
Exact behavior: agent-device help batch.
agent-device batch --steps-file /tmp/batch-steps.json --jsonagent-device batch --steps '[{"command":"open","input":{"app":"settings"}}]'batchruns a JSON array of{ command, input, runtime? }steps in a single daemon request and stops at the first failing step.- In non-JSON mode, successful batches print a short per-step summary.
See Batching for payload format, response shape, and usage guidelines.
App install (in-place)
Install an app binary from a path.
agent-device install <path> | install <app> <path> [--os <version|range>] [--image-tag <tag>] [--device-mode <slim|full>] [--device-baseline <name>] [--physical]| Option | What it does |
|---|---|
--os <version|range> |
Proxy lease: OS version or range the backend picks the device by (Android: API level); refused without such a backend |
--image-tag <tag> |
Proxy lease: Android system image tag the backend picks the device by; refused without such a backend |
--device-mode <slim|full> |
Proxy lease: iOS simulator mode (slim or full) the backend leases; refused without such a backend |
--device-baseline <name> |
Proxy lease: saved device state (baseline) the backend restores on the leased device; refused without such a backend |
--physical |
Proxy lease: ask the backend for a physical device instead of a simulator or emulator; refused without such a backend |
Supported targets: Install and reinstall an app.
Exact behavior: agent-device help install.
agent-device install com.example.app ./build/app.apk --platform androidagent-device install com.example.app ./build/MyApp.app --platform iosagent-device install ./build/entry-default-signed.hap --platform harmonyosinstall <app> <path>installs without uninstalling first and keeps app data where the platform allows. Use it for upgrade flows.- It supports Android devices and emulators, iOS simulators, CoreDevice iOS devices, and HarmonyOS devices. On xctrace-only devices, install the app with Xcode before you open it by bundle ID.
- Formats: Android
.apk/.aab, iOS.app/.ipa, HarmonyOS.hap. For an.ipawith several app bundles,<app>picks one by bundle id or name. .aabneedsbundletoolinPATH, orAGENT_DEVICE_BUNDLETOOL_JAR=<absolute-path-to-bundletool-all.jar>withjavainPATH.- Remote daemons upload local app files for you. Prefix the path with
remote:to use a path on the daemon host. A public remote daemon refuses host paths withREMOTE_HOST_INPUT_DENIED.
App reinstall (fresh state)
Replace an installed app with a new build.
agent-device reinstall <app> <path> [--os <version|range>] [--image-tag <tag>] [--device-mode <slim|full>] [--device-baseline <name>] [--physical]| Option | What it does |
|---|---|
--os <version|range> |
Proxy lease: OS version or range the backend picks the device by (Android: API level); refused without such a backend |
--image-tag <tag> |
Proxy lease: Android system image tag the backend picks the device by; refused without such a backend |
--device-mode <slim|full> |
Proxy lease: iOS simulator mode (slim or full) the backend leases; refused without such a backend |
--device-baseline <name> |
Proxy lease: saved device state (baseline) the backend restores on the leased device; refused without such a backend |
--physical |
Proxy lease: ask the backend for a physical device instead of a simulator or emulator; refused without such a backend |
Supported targets: Install and reinstall an app.
Exact behavior: agent-device help reinstall.
agent-device reinstall com.example.app ./build/app.apk --platform androidagent-device reinstall com.example.app ./build/MyApp.app --platform iosreinstall <app> <path>uninstalls and installs in one command, for login resets and repeatable test setup. Device coverage, formats, and remote upload matchinstall.- On iOS and Android, if the new archive cannot be unpacked, the installed app and its data stay. An install failure after the uninstall can still leave the app removed.
App uninstall
Remove an installed app.
agent-device uninstall <app> [--os <version|range>] [--image-tag <tag>] [--device-mode <slim|full>] [--device-baseline <name>] [--physical]| Option | What it does |
|---|---|
--os <version|range> |
Proxy lease: OS version or range the backend picks the device by (Android: API level); refused without such a backend |
--image-tag <tag> |
Proxy lease: Android system image tag the backend picks the device by; refused without such a backend |
--device-mode <slim|full> |
Proxy lease: iOS simulator mode (slim or full) the backend leases; refused without such a backend |
--device-baseline <name> |
Proxy lease: saved device state (baseline) the backend restores on the leased device; refused without such a backend |
--physical |
Proxy lease: ask the backend for a physical device instead of a simulator or emulator; refused without such a backend |
Supported targets: Uninstall an app.
Exact behavior: agent-device help uninstall.
agent-device uninstall com.example.app --platform androiduninstall <app>removes an installed app, for example to start a test without it. Device coverage matchesinstall.- A package name or bundle id that is not installed succeeds with
wasInstalled: false. Another name that matches nothing fails withAPP_NOT_INSTALLED.
App install from source URL
Install app builds from URLs.
agent-device install-from-source <url>| Option | What it does |
|---|---|
--header <name:value> |
install-from-source: repeatable HTTP header for URL downloads |
--retain-paths |
install-from-source: keep materialized artifact paths after install |
--retention-ms <ms> |
install-from-source: retain files for 1-2147483647 ms |
Supported targets: Install from a source URL.
Exact behavior: agent-device help install-from-source.
agent-device install-from-source https://example.com/builds/app.apk --platform androidagent-device install-from-source https://example.com/builds/app.aab --platform androidinstall-from-source <url>installs an artifact that the daemon can reach at a URL. Useinstallorreinstallfor local files. Device coverage matchesinstall.- A URL may point to an Android
.apkor.aab, or to an archive with one.apk,.aab,.ipa, or iOS.app. - Sensitive
--headervalues are not forwarded to other origins. --retain-pathskeeps the downloaded and extracted files for a while, so you can inspect them.- Downloads follow at most five redirects, never downgrade HTTPS to HTTP, and are size-limited.
HTTP_PROXY,HTTPS_PROXY, andNO_PROXYare honored.
Install a GitHub Actions artifact
GitHub gives each artifact a signed download URL. The URL needs no credentials, so the device or remote daemon can fetch the build directly. The URL expires after about one minute, so get it right before the install:
url=$(curl -fsS -o /dev/null -w '%{redirect_url}' \ -H "Authorization: Bearer $(gh auth token)" \ https://api.github.com/repos/<owner>/<repo>/actions/artifacts/<artifact-id>/zip)agent-device install-from-source "$url" --platform androidIn a GitHub Actions job, use ${{ secrets.GITHUB_TOKEN }} instead of gh auth token. The token stays on the machine that runs the command.
Push notification simulation
Deliver a push notification payload.
agent-device push <bundleOrPackage> <payloadOrJson>Supported targets: Push notification simulation.
Exact behavior: agent-device help push.
agent-device push com.example.app ./payload.apns --platform iosagent-device push com.example.app '{"aps":{"alert":"Welcome","badge":1}}' --platform iosagent-device push com.example.app '{"action":"com.example.app.PUSH","extras":{"title":"Welcome","unread":3,"promo":true}}' --platform androidpushtakes a payload file or inline JSON and delivers to the session device or the one named by--platform,--device,--udid, or--serial.- iOS: simulator only, with an APNs-style JSON object payload.
- A daemon that serves the public remote surface accepts only an inline JSON object payload. It refuses payload file paths with reason
REMOTE_HOST_INPUT_DENIED. - Android: sends a broadcast with the payload
{"action":"<intent-action>","receiver":"<optional component>","extras":{...}}. Extras may be strings, booleans, or numbers.
App event triggers (app hook)
Invoke an app-defined automation event.
agent-device trigger-app-event <event> [payloadJson]Supported targets: App event triggers through the app hook.
Exact behavior: agent-device help trigger-app-event.
agent-device trigger-app-event screenshot_taken '{"source":"qa"}'trigger-app-eventopens your app’s deep-link hook with an app-defined event; it does not post OS-level notifications.payloadJsonmust be a JSON object.- Needs an active session or a device selector (
--platform,--device,--udid,--serial). On iOS physical devices, open the app in the session first. - Set the URL template with
AGENT_DEVICE_APP_EVENT_URL_TEMPLATE, or per platform withAGENT_DEVICE_IOS_APP_EVENT_URL_TEMPLATE,AGENT_DEVICE_MACOS_APP_EVENT_URL_TEMPLATE, orAGENT_DEVICE_ANDROID_APP_EVENT_URL_TEMPLATE. Placeholders are{event},{payload}, and{platform}, for examplemyapp://agent-device/event?name={event}&payload={payload}.
Settings helpers
Change OS settings and app permissions.
agent-device settings <wifi|bluetooth|airplane|mobile-data|keep-awake|location|animations> <on|off> | settings location set <lat> <lon> | settings appearance <light|dark|toggle> | settings text-size [extra-small|small|medium|large|extra-large|extra-extra-large|extra-extra-extra-large|accessibility-medium|accessibility-large|accessibility-extra-large|accessibility-extra-extra-large|accessibility-extra-extra-extra-large] | settings timezone <iana-zone|reset> | settings locale <locale-id|reset> | settings <faceid|touchid> <match|nonmatch|enroll|unenroll> | settings fingerprint <match|nonmatch> | settings clear-app-state [app-id] | settings reset-keychain clear | settings permission <grant|deny|reset> <all|camera|microphone|contacts|contacts-limited|notifications|calendar|location|location-always|media-library|motion|reminders|siri> | settings permission <grant|deny|reset> photos [full|limited] | settings permission <grant|reset> <accessibility|screen-recording|input-monitoring> [--app <id-or-name>]| Option | What it does |
|---|---|
--app <id-or-name> |
Target an app without opening it: doctor verifies an installed app by id or name; settings applies an app-scoped change (permission, iOS location) to a bundle id or package |
Supported targets: System and app settings helpers.
Exact behavior: agent-device help settings.
agent-device settings wifi offagent-device settings mobile-data offagent-device settings location set 37.3349 -122.009agent-device settings animations offagent-device settings text-size accessibility-extra-largeagent-device settings locale en_INagent-device settings timezone Asia/Kolkataagent-device settings appearance darkagent-device settings faceid matchagent-device settings fingerprint nonmatchagent-device settings clear-app-state com.example.appagent-device settings permission grant photos limitedagent-device settings permission grant camera --app com.example.appagent-device settings permission grant accessibility --platform macosUse settings to set up device state before a flow, not to answer a dialog already on screen. agent-device help settings lists where each setting runs.
Platform support:
- iOS
settingsworks on simulators only. - macOS supports only
settings appearanceandsettings permission <grant|reset> <accessibility|screen-recording|input-monitoring>. settings location set <lat> <lon>works on iOS simulators and Android emulators.- A target that does not serve a setting refuses it with
UNSUPPORTED_OPERATIONbefore anything changes.
Device settings:
settings animations off(Android) stabilizes runs with heavy animation. Turn animations back on afterwards.settings bluetoothandsettings mobile-dataare Android only and need adb.settings bluetoothneeds Android 8.1 or newer, andsettings airplaneneeds Android 11 or newer. Connectivity takes a moment to settle, so poll the app instead of asserting offline behavior at once.- On iOS simulators,
settings wifiandsettings airplanechange only the status bar, and the output prints a warning that says so. The simulator keeps using the Mac’s network, so these settings cannot test offline behavior. - Pair
settings mobile-data onwithsettings wifi offto move a session, such as a video stream, from Wi-Fi to cellular. On a multi-SIM device, or one without an active SIM, the command can fail even when the switch took effect. settings text-sizewithout a category reads the current size. It works on iPhone and iPad simulators and on Android. A running app picks up a new size only afteropen <app> --relaunch.
Language and region:
settings locale <locale-id>sets the language and region together on iPhone and iPad simulators and on Android devices and emulators, and takesreset. Each response reports the previous locale aspreviousLocale.- A locale id is a language with an optional script and region, written with
-or_, such asen_IN,fr-CA, orzh-Hans-CN. Extensions and variants are refused withINVALID_ARGSbefore anything changes. - On iOS simulators, a running app keeps its old locale until
open <app> --relaunch.settings locale resetremoves the override, which leaves English with no region. The reportedpreviousLocaleis a valuesettings localeaccepts, andpreviousLanguageslists every preferred language. - On Android devices and emulators, running apps take the new locale at once. Android before 8.0 refuses with
locale-api-level-unsupported.settings locale resetappliesro.product.locale, the locale the system image boots with.
Time zone:
settings timezone <iana-zone>sets the time zone on iPhone and iPad simulators and on Android devices and emulators, and takesreset. Each response reports the previous time zone aspreviousTimeZone.- Pass an IANA time zone name such as
Asia/KolkataorAmerica/New_York; offsets and unknown names are refused withINVALID_ARGSbefore anything changes. - On iOS simulators,
settings timezonesetsTZin simulatorlaunchd: it applies only to apps launched afterwards (runopen <app> --relaunchfor a running app), is lost when the simulator reboots, and leaves the status bar on the Mac’s time. A zone missing from the Mac’s time zone database, which simulator apps read, fails withtime-zone-unknown-to-simulatorbefore anything changes.settings timezone resetgives newly launched apps the Mac’s time zone again. - On Android devices and emulators, running apps and the status bar take the new time zone at once.
settings timezoneturns automatic time zone off and verifiespersist.sys.timezone(failing withtime-zone-not-appliedif the device kept another zone; any failure puts the previous automatic time zone setting back).settings timezone resetturns automatic time zone back on and reportstimeZone: null, because the device applies the network zone a moment later.
Biometrics:
faceidandtouchidwork on iPhone and iPad simulators.fingerprintworks on Android emulators and on devices that havecmd fingerprint.matchandnonmatchsimulate a valid or invalid scan.enrollandunenrollchange enrollment.
App state:
settings clear-app-state [app-id]clears the data of the session app or the named app. It is unsupported on iOS physical devices and macOS.- It does not touch the keychain, so keychain-backed logins survive.
settings reset-keychain clearresets the iOS simulator keychain for every app on that simulator; pair it withclear-app-statefor a fresh-install reset. - A built-in app with no data container, such as
com.apple.Preferences, refuses withapp-no-data-container. Erase or recreate the simulator to reset it.
Permissions:
- On iOS and Android,
permissionapplies to the session app. Pass--app <bundle-id, package, or name>to target an installed app without opening it, for example to grant a permission before first launch.--appcounts only on the command line;AGENT_DEVICE_TARGET_APPnever retargets a settings change. - Refusals change nothing:
app_not_installed(install the app or fix the id),session_app_required(runopen <app>or name the app),setting_app_not_package(an Android intent alias such assettingsis not a package), andsetting_app_not_consumed(a device-wide setting such aslocation set,mobile-data,bluetooth,locale, ortimezonetakes no app). - On iOS simulators, targeting
notificationswithgrant,deny, orresetreturnsios-notification-permission-unsupported. Usealert acceptoralert dismissto answer the notification prompt. - On iOS simulators, the simulator decides which other permissions it can change and refuses the rest.
grant allskips a refused service with a warning. - On Android, a permission group applies only the permissions the app declares.
full|limitedapplies only to iOSphotos. - Android kills a running app when you revoke one of its granted permissions. After
denyorreset, runopen <app> --relaunchwhen the warning says so. - On macOS,
grantopens System Settings when access needs your approval; it never grants silently.denyis unsupported.
App state and app lists
Show the foreground app and activity.
agent-device appstateSupported targets: Foreground app state.
Exact behavior: agent-device help appstate.
List installed apps or deferred provider app assets.
agent-device apps [--all]| Option | What it does |
|---|---|
--all |
Apps: include system/OEM apps |
Supported targets: Installed app list.
Exact behavior: agent-device help apps.
agent-device appstateagent-device apps --platform iosagent-device apps --platform ios --allagent-device apps --platform androidagent-device apps --platform android --all- Android and HarmonyOS
appstatereport the live foreground package and activity. - iOS and macOS
appstateneed a session and report that session’s app. On iOS, a live runner adds the app’sstate, such asrunningBackgroundafterhome.appstatenever starts a runner. It does not report which other app took the screen. A command that had to bring the app back reports atargetActivationdisclosure.
Foreground repairs on iOS
An iOS session is bound to one app, but a deep link or a system sheet can hand the screen to another app. The next command brings the session app back so it can answer, and reports that repair:
agent-device open com.example.app --platform iosagent-device screenshot --platform ios # Safari screenagent-device snapshot -i --platform ios # answers with the app's treeThe snapshot response carries targetActivation and a warning:
{ "targetActivation": { "reason": "bundle_changed", "priorState": "runningBackground", "otherActiveApplicationPid": 4562 }}- Anything captured earlier in the session described the other app. Capture again, or drive the other app in its own session.
- Silence is not proof. A coordinate
press, apress @ref, or await <text>that passes at once can bring the app back without saying so. When it matters, runsnapshot -iand read its disclosure. - A coordinate
presson a system surface, such as a notification banner or Control Center, runs in place and does not bring the app back. - No read starts a stopped app, because a launch could drop a URL waiting behind an “Open in …?” prompt. Reads fail with
APP_NOT_RUNNINGinstead. Answer the prompt withalert accept, or relaunch withopen.
Clipboard
Read or write device clipboard text.
agent-device clipboard read | clipboard write <text>Supported targets: Clipboard read and write.
Exact behavior: agent-device help clipboard.
agent-device clipboard write "" # clear clipboardThings to know:
- Treat
clipboard readoutput as sensitive. It can contain copied secrets. - The command works without a session when you pass a device selector (
--platform,--device,--udid,--serial). - iOS physical devices return
UNSUPPORTED_OPERATION. Android 16 (API 36) does too, andcapabilitiesomitsclipboardthere; see Known limitations.
Keyboard
Inspect, press, or dismiss the device keyboard.
agent-device keyboard [status|get|dismiss|enter|return]Supported targets: Keyboard dismiss, enter, and status.
Exact behavior: agent-device help keyboard.
Things to know:
keyboard statusreports whether the software keyboard is visible and, when it can tell, the Return key’s action asreturnKey.keyboard entersends Return to the focused input, so focus the intended field first. The app decides what Return does. If it returnskeyboard_return_unavailable, check the screen before you retry, because Return may have reached the app.- On iOS,
keyboard dismissdoes not close a visible keyboard: it returnskeyboard_dismiss_unavailableand presses nothing. Press the visible Hide Keyboard key or the app control that ends editing. If the app supports interactive dismissal, drag down inside the scrollable content withgesture pan x y 0 dy durationMsand a positivedy. - On Android,
keyboard dismissreturnskeyboard_dismiss_unavailablewhen the keyboard stays up.
Performance diagnostics
Check frames, memory, or native profiles.
agent-device perf frames --jsonagent-device perf memory sample --jsonagent-device perf memory snapshot [--kind android-hprof|memgraph] [--out <path>]agent-device perf cpu profile start --kind xctrace [--template <name>] --out <profile.trace>agent-device perf cpu profile stop --kind xctrace --out <profile.trace>agent-device perf cpu profile report --kind xctrace [--template <name>] --out <report.json>agent-device perf trace start --kind xctrace [--template <name>] --out <path>agent-device perf trace stop --kind xctrace --out <path>agent-device perf cpu profile start --kind simpleperf --out <cpu.perf.data>agent-device perf cpu profile stop --kind simpleperfagent-device perf cpu profile report --kind simpleperf --out <cpu-report.json>agent-device perf trace start|stop --kind perfetto [--out <path>]perf frames
Reads no options.
perf memory sample
Reads no options.
perf memory snapshot
| Option | What it does |
|---|---|
--kind <kind> |
Kind selector for commands that support it, such as metro prepare or perf artifact collectors |
--out <path> |
Output path |
perf cpu profile start
| Option | What it does |
|---|---|
--kind <kind> |
Kind selector for commands that support it, such as metro prepare or perf artifact collectors |
--template <name> |
Perf xctrace template name, for example Time Profiler |
--out <path> |
Output path |
perf cpu profile stop
| Option | What it does |
|---|---|
--kind <kind> |
Kind selector for commands that support it, such as metro prepare or perf artifact collectors |
--out <path> |
Output path |
perf cpu profile report
| Option | What it does |
|---|---|
--kind <kind> |
Kind selector for commands that support it, such as metro prepare or perf artifact collectors |
--template <name> |
Perf xctrace template name, for example Time Profiler |
--out <path> |
Output path |
perf trace start
| Option | What it does |
|---|---|
--kind <kind> |
Kind selector for commands that support it, such as metro prepare or perf artifact collectors |
--template <name> |
Perf xctrace template name, for example Time Profiler |
--out <path> |
Output path |
perf trace stop
| Option | What it does |
|---|---|
--kind <kind> |
Kind selector for commands that support it, such as metro prepare or perf artifact collectors |
--out <path> |
Output path |
Supported targets: Performance samples (frames, memory, CPU profiles).
Exact behavior: agent-device help perf.
Inspect CDP targets, JS heap, and leaks.
agent-device cdp [...args]Exact behavior: agent-device help cdp.
agent-device perf memory snapshot --kind android-hprof --out app.hprofagent-device perf memory snapshot --kind memgraph --out app.memgraphagent-device cdp target list --url http://127.0.0.1:8081agent-device cdp memory usage sample --label baseline --gcagent-device cdp memory snapshot capture --name baseline --gcagent-device perf cpu profile start --kind xctrace --template "Time Profiler" --out app.traceagent-device perf cpu profile stop --kind xctrace --out app.traceagent-device perf cpu profile report --kind xctrace --out app-profile.jsonagent-device perf trace start --kind xctrace --template "Animation Hitches" --out hitches.traceagent-device perf trace stop --kind xctrace --out hitches.trace- Name one area:
frames,memory,cpu, ortrace. Perf commands need an app session; runopen <app>first. perf framesreturns frame health, such asdroppedFramePercent.perf memory samplereturns a compact memory sample.perf memory snapshot,perf cpu profile, andperf tracewrite artifacts and return their paths.cdpsamples the React Native JavaScript heap through Metro; see Debugging and profiling.- App startup duration is in the
startupresult ofopen. - Platform limits that decide which command to use:
perf frames: Android, and connected iOS devices. iOS simulators and macOS report it unavailable.perf memory snapshot --kind android-hprof: Android, for a debuggable or profileable process.--kind memgraph: iOS simulators and macOS.--kind xctrace: iOS simulators, connected iOS devices, and macOS. It does not profile Android; use--kind simpleperfor--kind perfettothere. All three need the app running.- HarmonyOS is memory-only.
For the measurement workflow and output examples, see Performance snapshots.
React Native components
React Native components, props/state/hooks, and render profiling.
agent-device react-devtools tree [@ref|Name]|find <Name>|inspect <@ref|Name>|errors|profile start|stop|report [Component]|commit [N]Exact behavior: agent-device help react-devtools.
agent-device react-devtools tree [@ref|Name] [--depth 8] [--limit 60]agent-device react-devtools find <Name> [--exact] [--limit 20]agent-device react-devtools inspect <@ref|Name>agent-device react-devtools errors [--limit 10]treeprints the mounted component tree with@crefs. Pass a ref or a unique name to print one branch.findlists components whose name contains the text.inspectprints a component’s owners, props, state, hooks, and logged errors.errorslists the components that logged console errors or warnings while rendering. On React Native 0.74 and 0.76, the list can be incomplete.- An open React DevTools window owns the component tree, so
tree,find, anderrorsfail withtree-unavailableuntil you close it and the app reloads.
React Native performance profiling
agent-device react-devtools profile startagent-device react-devtools profile stopagent-device react-devtools profile stop --limit 10agent-device react-devtools profile reportagent-device react-devtools profile report <Component>agent-device react-devtools profile commitagent-device react-devtools profile commit <N>profile startrecords React renders.profile stopends the recording, prints the slowest commits and up to five findings, and saves the recording forreportandcommit.profile reportlists components by self time with why they rendered.profile commit <N>shows what rendered in one commit.- Profiling connects through the app’s Metro dev server and needs no setup. It works with development builds of React Native 0.74 and later on Android emulators, iOS simulators,
agent-device proxyconnections, and remote bridge sessions. On a remote bridge, it needs the Metro server next to the agent, frommetro prepareor--metro-host/--metro-port. - When several apps or devices share one dev server, pick one with
--app <bundle-id>or--metro-device <name>. - See Debugging and profiling for the findings and the workflow.
React Native overlays
Run React Native automation helpers.
agent-device react-native dismiss-overlaySupported targets: React Native overlay dismissal.
Exact behavior: agent-device help react-native.
agent-device react-native dismiss-overlay --platform androidreact-native dismiss-overlayclears a development overlay (redbox/LogBox error or collapsed warning banner) that blocks interaction, and is a no-op when none is present. It works on iOS simulators/devices and Android emulators/devices.
Multiple React Native worktrees
You can reuse one installed iOS simulator debug build across local worktrees when its native binary is compatible with both JavaScript trees. Run one Metro server per worktree on its own port, then open the app on different simulators with explicit Metro hints:
# Worktree A terminalyarn expo start --dev-client --port 8081 --host localhost
# Worktree B terminalyarn expo start --dev-client --port 8082 --host localhost
agent-device open "React Navigation Example" --platform ios --device "iPhone 17" --session rn-a --metro-host 127.0.0.1 --metro-port 8081 --relaunchagent-device open "React Navigation Example" --platform ios --device "iPhone 17 Pro" --session rn-b --metro-host 127.0.0.1 --metro-port 8082 --relaunch- Use a different simulator and session per worktree; one simulator cannot run two copies of the same bundle id.
openpoints the app at the Metro server you name, including an Expo dev client that registers a singleexp+<slug>scheme. A dev build that boots straight into its embedded bundle still needs a native rebuild.- Each session remembers its dev server for a flagless
metro reload --session <name>; see Metro reload. - Rebuild and reinstall when native code, native dependencies, bundle identifiers, entitlements, or generated native project files change.
- Close every session when done:
agent-device close --platform ios --session rn-aagent-device close --platform ios --session rn-bMetro reload
Prepare the dev server or reload apps.
agent-device metro prepare (--public-base-url <url> | --proxy-base-url <url>) [--project-root <path>] [--port <port>] [--kind auto|react-native|expo|repack]agent-device metro reload [--metro-host <host>] [--metro-port <port>] [--bundle-url <url>]metro prepare
| Option | What it does |
|---|---|
--project-root <path> |
metro prepare: React Native project root (default: cwd) |
--kind <kind> |
Kind selector for commands that support it, such as metro prepare or perf artifact collectors |
--metro-kind auto|react-native|expo|repack |
metro prepare: detect or force the React Native dev-server launcher kind |
--public-base-url <url> |
metro prepare: public base URL used for direct dev-server bundle hints |
--proxy-base-url <url> |
metro prepare: optional bridge origin for remote dev-server access |
--bearer-token <token> |
metro prepare: host bridge bearer token (or AGENT_DEVICE_METRO_BEARER_TOKEN; falls back to AGENT_DEVICE_DAEMON_AUTH_TOKEN) |
--port <port> |
metro prepare: local dev-server port (default: 8081) |
--listen-host <host> |
metro prepare: host dev server listens on (default: 0.0.0.0) |
--status-host <host> |
metro prepare: host used for local dev-server /status polling (default: 127.0.0.1) |
--startup-timeout-ms <ms> |
metro prepare: timeout while waiting for the dev server to become ready |
--probe-timeout-ms <ms> |
metro prepare: timeout for /status and proxy bridge calls; metro reload: timeout for the reload request |
--runtime-file <path> |
metro prepare: optional file path to persist the JSON result |
--no-reuse-existing |
metro prepare: always start a fresh Metro process |
--no-install-deps |
metro prepare: skip package-manager install when node_modules is missing |
metro reload
| Option | What it does |
|---|---|
--metro-host <host> |
Session-scoped Metro/debug host hint |
--metro-port <port> |
Session-scoped Metro/debug port hint; on an emulator/simulator the host defaults to the loopback alias, physical devices still need –metro-host |
--probe-timeout-ms <ms> |
metro prepare: timeout for /status and proxy bridge calls; metro reload: timeout for the reload request |
--bundle-url <url> |
Session-scoped bundle URL hint |
Exact behavior: agent-device help metro.
agent-device metro reloadagent-device metro reload --metro-host localhost --metro-port 8081agent-device metro reload --bundle-url "http://localhost:8081/index.bundle?platform=ios"metro reloadasks connected React Native dev builds to reload JavaScript without restarting the native process, like pressingrin the Metro terminal.- Without flags, it reloads the dev server the session bound through
metro prepareoropen’s Metro hints. When no session bound one, and the daemon that answeredopenreported the session’s device as one of its own local devices, it next uses the dev-server address the app itself stored (an iOS simulator only) when a dev server there serves this project, then a local dev server whose reported project root is this directory or a parent or child of it. Run it from the project’s own directory, or pass--metro-port, because a local search matches the working directory. If neither local lookup resolves, it fails withdetails.reason: 'metro_dev_server_unresolved'; a provider device, a device inherited from an earlier request, or an app-less session retains the existinglocalhost:8081default. A reused session name never reloads a previous project’s server. - Use
open <app> --relaunchinstead when the app is not connected to Metro, the reload fails, or the native process must restart. Seeagent-device help metrofor the binding rules.
Media and logs
Capture a screenshot.
agent-device screenshot [path] [--out <path>] [--overlay-refs] [--crop-on <selector-expression>] [--pixel-density <n>] [--screen-mask <black>] [--fullscreen, --full, -f] [--scale <0.01-1>] [--no-stabilize] [--normalize-status-bar] [--capture-backend runner]| Option | What it does |
|---|---|
--overlay-refs |
Screenshot: draw current snapshot refs and target rectangles onto the saved PNG; diff screenshot: also write a separate current-screen overlay guide |
--crop-on <selector-expression> |
Screenshot: crop the capture to the frame of the selector resolved on the same screen |
--pixel-density <n> |
Screenshot: output PNG pixel density in pixels per logical point; iOS-family simulators only, other targets refuse it |
--screen-mask <black> |
Screenshot or live screenshot diff: fill the iOS simulator screen outline with black; requires simctl capture |
--fullscreen, --full, -f |
Screenshot: on web capture the full page; on macOS app sessions capture the full desktop instead of the app window |
--scale <0.01-1> |
Screenshot: resize both dimensions by this factor (or use AGENT_DEVICE_SCREENSHOT_SCALE) |
--no-stabilize |
Screenshot: capture immediately without Android status-bar stabilization (the default) |
--normalize-status-bar |
Screenshot: temporarily normalize iOS simulator or ADB-backed Android status-bar chrome for deterministic screenshot diffs; ADB-backed Android waits for transient UI to fade |
--capture-backend runner |
Screenshot: on Apple targets capture through the XCTest runner (XCUIScreen), which leaves out the simulator-drawn Dynamic Island, instead of simctl; refused on other platforms, provider sessions and macOS surfaces the helper captures, and with –pixel-density, –screen-mask and –normalize-status-bar |
Also accepts: common options: --out <path>.
Supported targets: Screenshots.
Exact behavior: agent-device help screenshot.
Resize the active web viewport for the current session.
agent-device viewport <width> <height>Supported targets: Hover and viewport size.
Exact behavior: agent-device help viewport.
agent-device screenshot # Auto filenameagent-device screenshot page.png --scale 0.3agent-device screenshot page.png --overlay-refsagent-device screenshot page.png --crop-on 'label="Save"'agent-device screenshot baseline.png --screen-mask black --normalize-status-baragent-device viewport 1280 900 --platform web # For fixed-layout or 100vh appsagent-device diff screenshot --baseline baseline.png --out diff.pngagent-device diff screenshot --baseline baseline.png current.png --out diff.pngagent-device record start session.mp4 --scope deviceagent-device record stopScreenshots
- Set
AGENT_DEVICE_SCREENSHOT_SCALE=0.3orscreenshotScalein config to save tokens by default;--scaleoverrides it. Leave it unset or pass--scale 1for pixel-diff baselines.--max-sizeis refused; use--scale. - ADB-backed Android screenshots capture at once. Use
--normalize-status-barfor repeatable status-bar chrome and to wait for transient UI to fade. --overlay-refstakes a new snapshot and draws refs on the image. With--json, each ref also has a screenshot-spacecenterfor apress <x> <y>fallback. At small scales, labels can become unreadable.--crop-onworks on iOS simulators, Android emulators, physical iPhones in portrait, and the Tizen and webOS TV plugins. It needs exactly one framed node, and the crop is re-encoded, so do not byte-compare it with an older crop.- On macOS,
--fullscreenapplies only to app sessions. Other surfaces always capture the main display. - On iOS simulators with a Dynamic Island, use
--capture-backend runnerto leave the island out of the capture. --screen-mask blackblacks out the screen’s rounded corners on handheld iOS simulators. It does not redact app content.- The result can report
displayRotation. The saved image is always upright.
Screenshot diffs
Diff snapshot or screenshot.
agent-device diff snapshot [-i] [-d <depth>] [-s <scope>] [--raw] | diff screenshot --baseline <path> [current.png] [--out <diff.png>] [--threshold <0-1>] [--overlay-refs] [--screen-mask <black>]diff snapshot
| Option | What it does |
|---|---|
-i |
Snapshot: interactive elements only |
--depth, -d <depth> |
Snapshot: limit snapshot depth |
--scope, -s <scope> |
Snapshot: scope snapshot to label/identifier |
--raw |
Snapshot: raw node output |
diff screenshot
| Option | What it does |
|---|---|
--out <path> |
Output path |
--overlay-refs |
Screenshot: draw current snapshot refs and target rectangles onto the saved PNG; diff screenshot: also write a separate current-screen overlay guide |
--screen-mask <black> |
Screenshot or live screenshot diff: fill the iOS simulator screen outline with black; requires simctl capture |
--baseline, -b <path> |
Diff screenshot: path to baseline image file |
--threshold <0-1> |
Diff screenshot: color distance threshold (default 0.1) |
Supported targets: Accessibility snapshot, snapshot diff, and audit.
Exact behavior: agent-device help diff.
diff screenshotcompares a live capture, or a savedcurrent.pngwith no session, against--baseline. It ranks changed regions;--outwrites a diff PNG with changed pixels tinted red. It reads no text, so look at the images yourself for a qualitative review.- Keep
--thresholdabove0when either input is JPEG. - An image of another size is scaled to the baseline width. Extra or missing rows at the bottom count as differences, and system bars are not cropped.
--overlay-refsalso lists the refs under changed regions. It needs a live capture.- Live iOS simulator diffs normalize status-bar chrome. Pass
--screen-mask blackto match a baseline captured withscreenshot --screen-mask black.
Recordings
Start or stop screen recording.
agent-device record start [path] [--scope <app|device|system>] [--fps <n>] [--quality <medium|high>] [--hide-touches] | record stop | record contact-sheet <video.mp4> [--out <sheet.png>]record start
| Option | What it does |
|---|---|
--fps <n> |
Record: target frames per second (iOS physical device runner); also lowers the touch-overlay rate, which never exceeds 30 |
--quality <medium|high> |
Record: output quality preset; Android maps this to screenrecord bitrate, Limrun sessions map medium to recorder quality 5 and high to 8; Apple export always preserves the captured resolution, so it has no effect there. Legacy numeric values 5-7 map to medium; 8-10 map to high |
--hide-touches |
Record: skip touch-overlay post-processing for faster raw benchmark videos |
--scope <app|device|system> |
Record: app requires an active app session; device/system records the whole screen |
record stop
Reads no options.
record contact-sheet
| Option | What it does |
|---|---|
--out <path> |
Output path |
Supported targets: Screen recording.
Exact behavior: agent-device help record.
record startdefaults to app scope, which needs an active app session fromopen <app>; the backend decides what is captured. A local iOS simulator recording always captures the whole display, even at app scope. Use--scope deviceor--scope systemfor whole-screen capture (several apps, settings, the home screen) where the backend supports it.- On physical iOS devices, a recording is a series of runner screenshots: no audio, about 15 FPS by default, and dropped frames are expected.
- Burned-in touch overlays export only on macOS hosts. Elsewhere, or when the export takes too long,
record stopreturns the raw video withoverlayWarning. - Android splits long recordings into MP4 chunks. A clip can end early when the screen stops changing;
capturedDurationMsand a warning report how much the video covers. android_screenrecord_startup_failedmeans the device refused to record, anddetails.stderrholds the device’s message. agent-device has no other Android recording backend.- Limrun sessions always record the whole screen.
apple_simulator_recording_busymeans another recording holds the simulator. Runrecord stopin the session that owns it.record stopis safe to repeat. If it returnsvideo_validator_compile_timeout, or the request ends during export, runrecord stopagain; the recording is kept.video_validator_unavailablenames a host failure to repair before you retry.record start --scope devicewithout a session creates one, andrecord stopends it, unless something else started using the session meanwhile.- On a remote daemon, a recording whose leased session ends stays downloadable by the tenant for a short time through
GET /artifacts. record contact-sheetturns an exported MP4 into one PNG grid of the frames where the screen changed, each labeled with its time. It needs no session and runs on macOS hosts only. A short-lived screen between samples can be missing.
Session app logs: See Debugging and profiling for the clean-repro and grep workflow.
Manage session app logs.
agent-device logs path | logs start | logs stop | logs clear [--restart] | logs doctor | logs mark [message...]logs path
Reads no options.
logs start
Reads no options.
logs stop
Reads no options.
logs clear
| Option | What it does |
|---|---|
--restart |
logs clear: stop active stream, clear logs, then start streaming again |
logs doctor
Reads no options.
logs mark
Reads no options.
Supported targets: App logs.
Exact behavior: agent-device help logs.
Read session event timeline.
agent-device events [limit] [cursor]Exact behavior: agent-device help events.
Inspect HTTP(S) traffic from session logs.
agent-device network dump [limit] [summary|headers|body|all] [--include summary|headers|body|all] | network log [limit] [summary|headers|body|all] [--include summary|headers|body|all]| Option | What it does |
|---|---|
--include summary|headers|body|all |
Network: include headers, bodies, or both in output |
Supported targets: HTTP(S) request inspection.
Exact behavior: agent-device help network.
agent-device logs path # e.g. ~/.agent-device/sessions/default/app.logagent-device logs start # Stream app output to that file (requires open first)agent-device logs clear # Truncate app.log and remove rotated app.log.N files (requires a stopped stream)agent-device logs mark "before submit" # Insert a timeline marker into app.logagent-device events 50 100 # Page 50 events starting at cursor 100agent-device network dump 25 --include alllogsworks on iOS simulators and devices, Android, and macOS. On Apple targets, capture relies on Unified Logging (os_log), so plain stdout and stderr may be missing.- On iOS physical devices,
logs startrelaunches the session app andlogs stopends it. Runopen <app>again afterlogs stop. logs startrotatesapp.logby size. SetAGENT_DEVICE_APP_LOG_REDACT_PATTERNSto a comma-separated regex list to redact secrets as lines are written. Write\,for a literal comma outside{m,n},[...], or(...).openprintsSession state: <path>; see Sessions for the files it holds.eventsreads the session timeline, which leaves out typed content. Events are best effort and can be dropped under load. A cursor older than the kept window fails withEVENT_LOG_CURSOR_EXPIREDanddetails.earliestCursor.network dumpreads recent HTTP(S) entries fromapp.log, or from the browser’s request history on web. Prefer--includeover the positional detail level. Web does not expose bodies.- On iOS,
network dumpcan miss requests that the app does not log, so a missing endpoint is not proof. See Network inspection.
Audio probes: audio probe samples HTML media elements on the web and host system audio on macOS, where it needs Screen Recording permission. See Debugging and profiling.
Probe audio levels.
agent-device audio probe start [durationSeconds] [bucketMs] | audio probe status | audio probe stopSupported targets: Audio probe.
Exact behavior: agent-device help audio.
agent-device audio probe start 10 1000agent-device audio probe statusagent-device audio probe stopCrash symbols: debug symbols symbolicates an Apple crash artifact against local dSYMs, writes the symbolicated artifact to --out, and prints a compact crash report. See Crash symbolication.
Symbolicate Apple crash artifacts.
agent-device debug symbols --artifact <crash.ips|crash.log> (--dsym <App.dSYM> | --search-path <dir>) [--out <symbolicated>]| Option | What it does |
|---|---|
--artifact <path> |
Debug symbols: Apple crash artifact path (.ips, .crash, or .log) |
--dsym <path> |
Debug symbols: matching .dSYM bundle path |
--search-path <dir> |
Debug symbols: directory to scan for matching .dSYM bundles |
Also accepts: common options: --out <path>.
Exact behavior: agent-device help debug.
agent-device debug symbols --artifact crash.log --dsym MyApp.dSYM --out crash-symbolicated.logagent-device debug symbols --artifact crash.ips --search-path ./build --out crash-symbolicated.ipsTracing
Start or stop trace capture.
agent-device trace start [path] | trace stop [path]Exact behavior: agent-device help trace.
agent-device trace startagent-device trace start session.traceagent-device trace stopagent-device trace stop session.tracetracecaptures a trace log for the active session;trace stopwrites or finalizes the artifact at its path. Use it for lower-level session diagnostics thanrecordorlogsprovide.
Remote proxy
Expose a local daemon through an HTTP tunnel.
agent-device proxy [--host <host>] [--port <port>] [--public-origin <origin>] [--daemon-auth-token <token>] [--state-dir <path>]| Option | What it does |
|---|---|
--state-dir <path> |
Daemon state directory (defaults to ~/.agent-device for packages, or a worktree-scoped dev dir from source) |
--daemon-auth-token <token> |
Remote HTTP daemon or proxy auth token (sent as request token and bearer header) |
--host <host> |
Proxy: host interface to bind (default: 127.0.0.1) |
--port <port> |
Proxy: TCP port to bind (default: 0, choose a free port) |
--public-origin <origin> |
Proxy: public HTTP(S) origin for upload tickets |
Exact behavior: agent-device help proxy.
Run proxy on the machine that can reach the simulator, emulator, or device, and drive it from another machine through an HTTP tunnel. It prints a daemon auth token: anyone who has it can control the daemon behind the proxy. Pass --public-origin when the tunnel terminates TLS. It gives direct-upload tickets an HTTPS origin; without it, the client uploads through the HTTPS daemon URL instead, and older clients send that upload over plain HTTP. See Remote proxy for the tunnel setup and connect proxy.
Remote Metro workflow
When the cloud control plane owns the connection profile, connect discovers it. Name the session once, because every command on a cloud connection must name it:
export AGENT_DEVICE_SESSION=checkout-iosagent-device connectagent-device open com.example.myapp --relaunchagent-device snapshot -iagent-device disconnectFor local profile files, create an agent-device.remote.json:
{ "daemonBaseUrl": "https://bridge.example.com/agent-device", "daemonTransport": "http", "tenant": "acme", "runId": "run-123", "session": "adc-ios", "sessionIsolation": "tenant", "platform": "ios", "leaseBackend": "ios-instance", "metroProjectRoot": ".", "metroProxyBaseUrl": "https://bridge.example.com"}agent-device connect --remote-config ./agent-device.remote.jsonagent-device open com.example.myapp --relaunchagent-device snapshot -iagent-device disconnectFor self-contained scripts, pass the same profile to each step:
agent-device install-from-source https://example.com/builds/Demo.app.zip --remote-config ./agent-device.remote.json --platform iosagent-device open com.example.myapp --remote-config ./agent-device.remote.json --relaunchagent-device snapshot --remote-config ./agent-device.remote.json -iagent-device disconnect --remote-config ./agent-device.remote.jsonconnectsaves the connection and waits to lease a device and prepare Metro until a command needs them.connect --remote-config <path>uses a local profile instead of the cloud one.- Cloud auth:
connectuses your stored CLI session, and starts login in an interactive shell. In CI, use anadc_live_...service token. Manage the CLI session withagent-device auth status,auth login, andauth logout. Interactive login prints the code that the browser page must show; approve only when they match. When the cloud rotates the session credential during a refresh, the CLI stores the replacement and any session expiry. One command refreshes a stored session at a time; a command that waits too long fails with a session-file lock timeout, so retry it. A revoked session fails withcli_session_revoked, a refresh without a token fails withcli_session_refresh_unanswered, and a session directory that cannot be written fails withcli_session_store_unwritable. A refresh goes only to the cloud origin stored with the session: anAGENT_DEVICE_CLOUD_BASE_URLwith another origin fails withcloud_login_origin_mismatchuntil you log in again or unset it. A session saved by an older CLI fails withcli_session_issuer_unverified; runagent-device auth login. Cloud auth requests follow at most three redirects on the same origin. A 307 or 308 resends the POST; a 301, 302 or 303 continues as a GET without the body. A redirect to another origin, a fourth redirect, or a target with no readable Location or with a username or password fails withcloud_auth_redirect_refusedbefore anything is sent to it. AGENT_DEVICE_CLOUD_BASE_URLis the bridge API origin, which is not always the dashboard.- On a connection with a lease provider, such as the cloud or
connect proxy, every command must name the session with--session,AGENT_DEVICE_SESSION, or config, or it fails withREMOTE_SESSION_REQUIRED. On other profiles, commands without a session use the most recent connection, which is safe only for one sequential workflow. To replace a connection, pass--session <name> --force. - After
connect, normal commands reuse the connection.connection statusshowsleaseId=pendinguntil the first command that needs a device. - End with
disconnectto release the lease and stop the Metro companion. It does not stop your Metro server. If it cannot release the lease, it prints the lease id so you can release it manually. metroProxyBaseUrlis the bridge origin; do not add/api/metro/...paths.metroPublicBaseUrlis only for direct bundle hints without a bridge.
Configure remote or provider state.
agent-device connect [provider] [--remote-config <path>] [--daemon-base-url <url>] [--tenant <id>] [--run-id <id>] [--lease-id <id>] [--lease-backend <backend>] [--force] [--no-login]| Option | What it does |
|---|---|
--remote-config <path> |
Load remote host + Metro workflow settings from a specific profile file |
--daemon-base-url <url> |
Explicit remote HTTP daemon base URL (skip local daemon discovery/startup) |
--tenant <id> |
Tenant scope identifier for isolated daemon sessions |
--run-id <id> |
Run identifier used for tenant lease admission checks |
--lease-id <id> |
Lease identifier bound to tenant/run admission scope |
--lease-backend ios-simulator|ios-instance|android-instance|harmonyos-instance|macos-app |
Lease backend for remote tenant connection admission |
--provider-app <ref-or-path> |
Cloud provider app reference or local app path used when creating hosted WebDriver sessions |
--provider-os-version <version> |
Hosted cloud provider OS version, for example 17 or 14.0 |
--provider-device-type real|virtual |
TestMu AI device pool: real devices or virtual devices (emulators and simulators). Defaults to virtual |
--provider-project <name> |
Hosted cloud provider project label |
--provider-build <name> |
Hosted cloud provider build label |
--provider-session-name <name> |
Hosted cloud provider session label |
--provider-device-orientation portrait|landscape |
Screen orientation a hosted cloud provider session starts in. Set this rather than rotating after launch: a session that boots landscape renders login webviews landscape |
--provider-geo-location <country> |
Hosted cloud provider IP geolocation country code, for example US |
--provider-timezone <zone> |
Hosted cloud provider device time zone, for example New_York |
--provider-appium-version <version> |
Hosted cloud provider Appium server version, for example 3.2.0. Without it each provider starts its own default (Appium 1.x on BrowserStack) |
--provider-language <language> |
Hosted cloud provider app language, for example Fr |
--provider-locale <locale> |
Hosted cloud provider device locale, for example Fr |
--provider-network-profile <profile> |
Hosted cloud provider named network condition profile, for example 4g-lte-advanced-good. Mutually exclusive with –provider-custom-network |
--provider-custom-network <shape> |
Hosted cloud provider custom network shape. Mutually exclusive with –provider-network-profile |
--provider-no-resign-app |
iOS only: keep an Enterprise-signed app as uploaded instead of letting the provider re-sign it, which strips entitlements such as push notifications |
--provider-network-logs |
Limrun: capture session network traffic; artifacts and close write it as a HAR file on the daemon host and print its path and any capture failures. Pass –provider-network-hosts with your app API hosts. Captured traffic exits through the daemon host, the HAR holds raw headers and bodies, certificate-pinned hosts and HTTPS hosts without HTTP/2 fail to connect, and DNS-over-HTTPS bypasses the capture |
--provider-network-hosts <list> |
With –provider-network-logs: comma-separated hosts to capture, such as your app API hosts (exact hosts, wildcards like *.example.com, or localhost:<port> routes). Replaces the noisy default of common public domains plus localhost:8081 |
--aws-project-arn <arn> |
AWS Device Farm project ARN for hosted WebDriver sessions |
--aws-device-arn <arn> |
AWS Device Farm device ARN for hosted WebDriver sessions |
--aws-app-arn <arn> |
AWS Device Farm app ARN attached to hosted remote access sessions |
--aws-region <region> |
AWS region for Device Farm API calls |
--aws-interaction-mode INTERACTIVE|NO_VIDEO|VIDEO_ONLY |
AWS Device Farm remote access interaction mode |
--force, --overwrite |
Force replacement of existing state (connect: replace an active connection; –save-script: overwrite an existing target instead of refusing) |
--no-login |
Connect: fail instead of starting implicit cloud login |
--os <version|range> |
Proxy lease: OS version or range the backend picks the device by (Android: API level); refused without such a backend |
--image-tag <tag> |
Proxy lease: Android system image tag the backend picks the device by; refused without such a backend |
--device-mode <slim|full> |
Proxy lease: iOS simulator mode (slim or full) the backend leases; refused without such a backend |
--device-baseline <name> |
Proxy lease: saved device state (baseline) the backend restores on the leased device; refused without such a backend |
--physical |
Proxy lease: ask the backend for a physical device instead of a simulator or emulator; refused without such a backend |
Exact behavior: agent-device help connect.
Clear remote connection state and release leases.
agent-device disconnect [--shutdown]| Option | What it does |
|---|---|
--shutdown |
close, disconnect: also shut down the session device where supported; a Limrun instance agent-device created is deleted with its data, an attached one keeps running. close also releases a lease or attachment kept on close |
Exact behavior: agent-device help disconnect.
If agent-device cannot read or parse a session’s own saved connection file or the active-session pointer, it cannot establish which session owns that file. It keeps the file and refuses with connection_record_owner_unknown. A session’s own saved connection file that cannot be read refuses every command that uses that session’s saved connection. An unreadable active-session pointer refuses connect and any command that rewrites the saved connection. The error names the file. Make it readable, or remove it if no session needs it. A file from an older build whose owner cannot be proven is left in place and is not used. A command that only reads the saved connection, such as connection status, changes no file. It uses an older build’s file for the session where that file is, and it treats a file that fails validation as no connection. Only a command that saves or removes the saved connection moves an older file to its session’s own file, or removes a file that fails validation. If an older file cannot move because its session’s own file already exists, that command refuses with connection_session_mismatch. The refused file is kept, and so is the occupied session file. This is also true when both files name the same session, and when the occupied file cannot be read.
Manage cloud login state.
agent-device auth status|login|logoutExact behavior: agent-device help auth.
Inspect the saved remote connection.
agent-device connection statusExact behavior: agent-device help connection.
Session inspection
List sessions, show the state dir, or publish a script.
agent-device session list | session state-dir | session save-script [path] [--force]session list
Reads no options.
session state-dir
Reads no options.
session save-script
| Option | What it does |
|---|---|
--force, --overwrite |
Force replacement of existing state (connect: replace an active connection; –save-script: overwrite an existing target instead of refusing) |
Exact behavior: agent-device help session.
agent-device session listagent-device session list --jsonsession listshows active daemon sessions for your workspace. Add--jsonfor session metadata.session list --jsonreportskind,model, andosVersionflat on each entry when the host reported them: readsessions[0].osVersion, notsessions[0].device.osVersion, which is the device name.
Cloud provider artifacts
List daemon or cloud provider session artifacts.
agent-device artifacts [provider-session-id] [--provider <name>]| Option | What it does |
|---|---|
--provider <name> |
Cloud provider name for provider-scoped commands |
--provider-session <id> |
Cloud provider session id or ARN |
Exact behavior: agent-device help artifacts.
agent-device artifacts --provider browserstack --provider-session <webdriver-session-id> --jsonagent-device artifacts --provider aws-device-farm --provider-session <remote-access-session-arn> --jsonartifactslists the provider-hosted videos, logs, and dashboard links ascloudArtifacts. See Device clouds for what each provider returns.- To look up a past session, pass
--provider <name>and--provider-session <id>. - Providers can finish their URLs only after the session stops, so retry
artifactsif the first response ispending.
MCP server
Start MCP server.
agent-device mcp [--structured]| Option | What it does |
|---|---|
--structured |
MCP: advertise tool output schemas and return structuredContent; results are text only by default |
Exact behavior: agent-device help mcp.
Run agent-device mcp from an MCP client that supports direct tools. Configure the server with AGENT_DEVICE_* environment variables in the client’s server entry; tool calls cannot pass them. For client setup and what MCP does not expose, see AI agent setup.
Provider plugins
Manage installed provider plugins.
agent-device plugins list [--state-dir <path>]|add <package[@version]>|update <package>|remove <package>plugins list
| Option | What it does |
|---|---|
--state-dir <path> |
Daemon state directory (defaults to ~/.agent-device for packages, or a worktree-scoped dev dir from source) |
plugins add
Reads no options.
plugins update
Reads no options.
plugins remove
Reads no options.
Exact behavior: agent-device help plugins.
agent-device plugins add @agent-device/testmuagent-device plugins list --jsonProvider plugins add device providers that agent-device does not bundle. Installing one requires npm on your host. plugins list --json works without a daemon; daemon status shows which providers a running daemon registered. See Provider plugins.
iOS physical-device prerequisites
For CLI-discoverable setup guidance, run agent-device help physical-device.
- Older devices found only through
xctraceuse the XCTest backend. Keep them connected by cable. - XCTest-backed devices support open, close, interactions, snapshots, and screenshots. App inventory, install, logs, performance sampling, recording, deep links, and launch arguments need CoreDevice.
- For Xcode, pairing, Developer Mode, and Apple runner signing, see Installation.
iOS SpringBoard, widgets, and system-UI surfaces
For CLI-discoverable workflow guidance, run agent-device help ios-system-ui.
agent-device open com.apple.springboard --platform iosbinds the session to SpringBoard on iOS simulators and physical iPhones. The widget add, edit, and remove flow is verified on simulators only.- Two steps of the widget flow need coordinates: the long-press on empty space that starts edit mode, and the unlabeled widget-gallery search results.
- SpringBoard labels vary by iOS version and language, so read them from the current snapshot instead of hard-coding
EditorAdd Widget. - Open the app under test again to return to normal app automation.