agemu

v0.2.2
io.github.piotr-graczyk-dev/agemu Checked 10 hours ago Published 16 days ago

Fast Android emulator and iOS Simulator control for coding agents: screenshots, UI tree, taps, logs

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

devices

List Android and iOS devices with state, profile and screen size.

profiles

List screen profiles (real device sizes) usable with set_profile.

ParameterTypeDescription
platformstringandroid or ios

create

Create a new device.

ParameterTypeDescription
name *stringDevice name
platform *stringandroid or ios
profilestringProfile name

boot

Boot a device to an agent-ready state; from its baseline snapshot this takes seconds and returns state booted. The first boot of a new Android device (or a baseline retake after a GPU mode, AVD configuration or agemu upgrade) prepares the baseline once, which usually takes 7-8 minutes and never more than 20 (then the boot fails): boot then returns at once with state "preparing" and the phase; poll devices every 30-60 s (or call boot again) until the state is booted. Other calls on a preparing device fail at once with an error saying so.

ParameterTypeDescription
coldbooleanForce a cold boot
devicestringDevice id or name (optional when exactly one device is booted)

shutdown

Shut a device down.

ParameterTypeDescription
devicestringDevice id or name (optional when exactly one device is booted)

reset

Restore a booted device to its clean baseline state (fast).

ParameterTypeDescription
devicestringDevice id or name (optional when exactly one device is booted)

park

Park a booted device: stop it in place, so it uses no CPU and the host can reclaim its memory, keeping its apps and screen as they are. The next call on it resumes it (or use resume).

ParameterTypeDescription
devicestringDevice id or name (optional when exactly one device is booted)

resume

Resume a parked device; returns once it is agent-ready. Does nothing on a device that is not parked.

ParameterTypeDescription
devicestringDevice id or name (optional when exactly one device is booted)

set_profile

Switch the screen to a real-device profile (see profiles) or a custom Android size.

ParameterTypeDescription
densitynumberCustom density dpi (Android)
devicestringDevice id or name (optional when exactly one device is booted)
heightnumberCustom height px (Android)
profilestringProfile name
widthnumberCustom width px (Android)

screenshot

Capture the screen. Returns the image plus its file path. Coordinates on a scale=1 image are tap coordinates.

ParameterTypeDescription
devicestringDevice id or name (optional when exactly one device is booted)
formatstringpng or jpeg
scalenumberDownscale factor 0-1 for the returned image (default 0.5)

ui_tree

Accessibility/UI hierarchy as a compact outline: [ref] role "text" id=... @(x,y wxh). Frames are screenshot pixels.

ParameterTypeDescription
devicestringDevice id or name (optional when exactly one device is booted)
jsonbooleanReturn full JSON instead of the outline

find

Find elements by text/label/id/role.

ParameterTypeDescription
containsstringCase-insensitive substring of text or label
devicestringDevice id or name (optional when exactly one device is booted)
idstringresource-id (Android) or accessibilityIdentifier (iOS)
indexnumberPick the n-th match (0-based)
rolestringNormalized role: button, text, textfield, switch, image, cell...
textstringExact text or accessibility label

tap

Tap at x,y (screenshot pixels) or at the center of the element matching a selector. With waitFor it also waits for the next screen.

ParameterTypeDescription
containsstringCase-insensitive substring of text or label
devicestringDevice id or name (optional when exactly one device is booted)
idstringresource-id (Android) or accessibilityIdentifier (iOS)
indexnumberPick the n-th match (0-based)
returnUibooleanAlso return the UI outline of the screen the action ends on (act, wait and observe in one call)
rolestringNormalized role: button, text, textfield, switch, image, cell...
textstringExact text or accessibility label
waitForobjectAfter the action, wait for an element matching this selector (fields: text, contains, id, role) in the same call
waitGonebooleanWait for waitFor to disappear instead
waitTimeoutMsnumberTimeout for waitFor, default 10000
xnumberX in screenshot pixels
ynumberY in screenshot pixels

swipe

Swipe from (x,y) to (x2,y2) in screenshot pixels.

ParameterTypeDescription
x *numberstart x
x2 *numberend x
y *numberstart y
y2 *numberend y
devicestringDevice id or name (optional when exactly one device is booted)
durationMsnumberduration, default 300
returnUibooleanAlso return the UI outline of the screen the action ends on (act, wait and observe in one call)
waitForobjectAfter the action, wait for an element matching this selector (fields: text, contains, id, role) in the same call
waitGonebooleanWait for waitFor to disappear instead
waitTimeoutMsnumberTimeout for waitFor, default 10000

type_text

Type text into the focused field.

ParameterTypeDescription
text *stringText to type
devicestringDevice id or name (optional when exactly one device is booted)
keysbooleanSend one key event per character (slower) instead of setting the field's text (Android) or pasting it (iOS)
returnUibooleanAlso return the UI outline of the screen the action ends on (act, wait and observe in one call)
waitForobjectAfter the action, wait for an element matching this selector (fields: text, contains, id, role) in the same call
waitGonebooleanWait for waitFor to disappear instead
waitTimeoutMsnumberTimeout for waitFor, default 10000

press_key

Press a key: home, back, enter, delete, tab, escape, lock, volumeup, volumedown.

ParameterTypeDescription
key *stringKey name
devicestringDevice id or name (optional when exactly one device is booted)
returnUibooleanAlso return the UI outline of the screen the action ends on (act, wait and observe in one call)
waitForobjectAfter the action, wait for an element matching this selector (fields: text, contains, id, role) in the same call
waitGonebooleanWait for waitFor to disappear instead
waitTimeoutMsnumberTimeout for waitFor, default 10000

install

Install an app (.apk for Android, .app for iOS Simulator).

ParameterTypeDescription
path *stringAbsolute path
devicestringDevice id or name (optional when exactly one device is booted)

launch

Launch an app by package name / bundle id. iOS also takes process arguments (e.g. an Expo dev client's --initialUrl), environment and relaunch.

ParameterTypeDescription
app *stringPackage name or bundle id
argsarrayProcess arguments (iOS)
devicestringDevice id or name (optional when exactly one device is booted)
envobjectProcess environment (iOS)
relaunchbooleanTerminate a running instance first (iOS)
returnUibooleanAlso return the UI outline of the screen the action ends on (act, wait and observe in one call)
waitForobjectAfter the action, wait for an element matching this selector (fields: text, contains, id, role) in the same call
waitGonebooleanWait for waitFor to disappear instead
waitTimeoutMsnumberTimeout for waitFor, default 10000

terminate

Force-stop an app.

ParameterTypeDescription
app *stringPackage name or bundle id
devicestringDevice id or name (optional when exactly one device is booted)

wait_for

Wait until an element matching the selector appears (or disappears with gone=true).

ParameterTypeDescription
containsstringCase-insensitive substring of text or label
devicestringDevice id or name (optional when exactly one device is booted)
gonebooleanWait for disappearance
idstringresource-id (Android) or accessibilityIdentifier (iOS)
indexnumberPick the n-th match (0-based)
rolestringNormalized role: button, text, textfield, switch, image, cell...
textstringExact text or accessibility label
timeoutMsnumberTimeout, default 10000

open_url

Open a URL or deep link as a link tapped in another app would (Android: VIEW intent with CATEGORY_BROWSABLE). App/universal links open the app only if their domain is verified. With waitFor it also waits for the next screen.

ParameterTypeDescription
url *stringURL with a scheme: https://..., myapp://path, exp+app://...
devicestringDevice id or name (optional when exactly one device is booted)
returnUibooleanAlso return the UI outline of the screen the action ends on (act, wait and observe in one call)
waitForobjectAfter the action, wait for an element matching this selector (fields: text, contains, id, role) in the same call
waitGonebooleanWait for waitFor to disappear instead
waitTimeoutMsnumberTimeout for waitFor, default 10000

permission

Grant, revoke or reset an app's privacy permissions without the system dialog. revoke = denied without asking again; reset = ask again on next use. Android kills the app when one is revoked or reset. A grant the app could not get on a device (not in its manifest / no Info.plist usage description) is refused.

ParameterTypeDescription
action *stringWhat to do
app *stringPackage name or bundle id
devicestringDevice id or name (optional when exactly one device is booted)
permissionsarrayNames: camera, microphone, photos, photos-add, location, location-always, contacts, contacts-limited, calendar, reminders, notifications, motion, media-library, siri; or a raw Android permission (andr…

location

Set the simulated GPS location, or clear it (back to the device's baseline).

ParameterTypeDescription
actionstringset (default when coordinates are given) or clear
devicestringDevice id or name (optional when exactly one device is booted)
latitudenumberDegrees, -90..90
longitudenumberDegrees, -180..180

clipboard

Read the device clipboard (plain text), or set it.

ParameterTypeDescription
actionstringget (default) or set (default when text is given)
devicestringDevice id or name (optional when exactly one device is booted)
textstringText to put on the clipboard (action set; empty clears it)

appearance

Read the system appearance, or switch light/dark mode.

ParameterTypeDescription
devicestringDevice id or name (optional when exactly one device is booted)
modestringOmit to read the current appearance

apps

List installed user apps (not the system image's).

ParameterTypeDescription
devicestringDevice id or name (optional when exactly one device is booted)

uninstall

Uninstall a user app with its data.

ParameterTypeDescription
app *stringPackage name or bundle id
devicestringDevice id or name (optional when exactly one device is booted)

clear_app_data

Clear one app's data so it starts like a fresh install (stopped, data and permissions gone; iOS keeps keychain items, as a reinstall does on a device).

ParameterTypeDescription
app *stringPackage name or bundle id
devicestringDevice id or name (optional when exactly one device is booted)

push

Send a push notification to an app (iOS; Android has no faithful path). It shows only if the app may post notifications. With waitFor it also waits for the banner or screen.

ParameterTypeDescription
app *stringBundle id
payload *objectAPNs payload with an "aps" object, at most 4096 bytes, e.g. {"aps":{"alert":{"title":"Hi","body":"Hello"}}}
devicestringDevice id or name (optional when exactly one device is booted)
returnUibooleanAlso return the UI outline of the screen the action ends on (act, wait and observe in one call)
waitForobjectAfter the action, wait for an element matching this selector (fields: text, contains, id, role) in the same call
waitGonebooleanWait for waitFor to disappear instead
waitTimeoutMsnumberTimeout for waitFor, default 10000

logs

Recent log lines of one app (or the whole device), oldest first, as `time level process[pid] tag: message`. Filter by time, minimum level and text; the newest lines that fit limit and maxBytes are returned. The last line gives a cursor: pass it as since to read only newer lines.

ParameterTypeDescription
appstringPackage name or bundle id: only its processes' lines (default: every process)
containsstringCase-insensitive substring of the tag or the message
devicestringDevice id or name (optional when exactly one device is booted)
jsonbooleanReturn JSON instead of text lines
levelstringMinimum level (iOS: debug lines are not captured; info includes iOS default)
limitnumberAt most this many lines, the newest (default 100, max 10000)
maxBytesnumberAt most about this many bytes of lines (default 16384, max 1048576)
regexstringRE2 regular expression matched against the tag or the message
sincestringOnly lines from this point: a time (2026-11-07T10:00:00Z), a duration back from now (30s, 5m), "launch" (the app's last launch through agemu) or a cursor from a previous logs result (c123...)

crashes

Crash, ANR (Android), system-kill (iOS watchdog, jetsam) and unexpected-exit reports of the device's apps, oldest first: time, kind, exception, reason and the crashing thread's top frames.

ParameterTypeDescription
appstringPackage name or bundle id (default: every app)
devicestringDevice id or name (optional when exactly one device is booted)
jsonbooleanReturn JSON instead of text
limitnumberAt most this many reports, the newest (default 10, max 100)
sincestringA time (2026-11-07T10:00:00Z), a duration back from now (5m) or "launch" (the app's last launch through agemu)