Skip to content

API Reference

The full adb tool signature. One tool, 90+ actions, dispatched via action="...".

from strands_adb import adb

result = adb(action="screenshot")

All actions return:

{
    "status": "success" | "error",
    "content": [{"text": "..."}, {"image": {...}}?],
    # action-specific extras
}

Device

list_devices

adb(action="list_devices")
# Returns: {"devices": [{"serial": "...", "state": "device", "model": "..."}]}

select_device

adb(action="select_device", serial="59230DLCH0012Z")

Sets process-global default serial.

device_info

adb(action="device_info", serial=None)
# Returns model, manufacturer, Android version, SDK, serialno

battery

adb(action="battery", serial=None)

wake

adb(action="wake", serial=None)

unlock

adb(action="unlock", pin="1234", serial=None)

PIN is used once, not stored.


Shell

shell

adb(action="shell", command="dumpsys activity top", serial=None, timeout=30)

Run arbitrary adb shell <cmd>.


UI Input

tap

adb(action="tap", x=500, y=1500, serial=None)

swipe

adb(action="swipe", x1=500, y1=2000, x2=500, y2=500, duration_ms=300, serial=None)

type_text

adb(action="type_text", text="hello world", serial=None)

key

adb(action="key", key="back", serial=None)   # aliases + KEYCODE_*

back / home / recent

adb(action="back")
adb(action="home")
adb(action="recent")

gesture_long_press

adb(action="gesture_long_press", x=500, y=500, duration_ms=800, serial=None)

gesture_path

adb(action="gesture_path", points=[(100, 500), (300, 500), (300, 800)], duration_ms=500)

gesture_pinch

adb(action="gesture_pinch", cx=500, cy=1000, start_radius=200, end_radius=500)

gesture_stream

adb(action="gesture_stream", events=[...])

Screen

screenshot

adb(action="screenshot",
    output_path=None,           # default: /tmp/adb_screenshot_<ts>.png
    serial=None,
    include_image=True,         # embed Converse image block
    return_base64=False)

Returns {path, size_bytes, content: [text, image]}.

screen_record

Blocking fixed-duration recording (≤180s Android hard limit).

adb(action="screen_record", duration_sec=30, output_path=None, serial=None)

screen_record_start

Start a non-blocking background recording. Returns immediately so your agent can keep acting. Auto-chains segments past Android's 180s cap.

adb(
    action="screen_record_start",
    output_path="/tmp/run.mp4",
    screenrec_bit_rate_mbps=4,
    screenrec_size="720x1600",   # None = native resolution
    screenrec_segment_sec=180,
)

screen_record_stop

Stop background recording. Pulls any remaining segment, optionally merges all segments via ffmpeg if present.

result = adb(action="screen_record_stop")
# {
#   "segments":   ["/tmp/run.mp4", "/tmp/run_seg002.mp4", ...],
#   "merged_path": "/tmp/run_merged.mp4",   # if ffmpeg available
#   "duration_sec": 412.3,
#   "total_bytes": 198_234_112,
# }

screen_record_status

adb(action="screen_record_status")
# {"running": True, "elapsed_sec": 47.3, "segments": [...], "output_path": "..."}

screen_frames

adb(action="screen_frames", duration_sec=10, fps=2, output_dir="/tmp/frames/")

video_frames

adb(action="video_frames", device_path="/sdcard/DCIM/Camera/VID.mp4", fps=2)

ui_dump

adb(action="ui_dump", serial=None)

Returns full UIAutomator XML.

ui_find

adb(action="ui_find",
    text=None, resource_id=None, content_desc=None,
    clickable=None, serial=None)

Returns list of matching nodes with bounds + attrs.

ui_tap_by

adb(action="ui_tap_by",
    text=None, resource_id=None, content_desc=None,
    index=0, serial=None)

ui_wait_for

adb(action="ui_wait_for",
    text=None, resource_id=None, content_desc=None,
    timeout_sec=10, serial=None)

smart_tap

adb(action="smart_tap",
    text=None, resource_id=None, content_desc=None,
    serial=None)

High-level semantic tap.


Camera

camera_photo

adb(action="camera_photo",
    facing="back",              # "back" | "front"
    output_path=None,
    auto_pull=True,
    include_image=True,
    return_base64=False,
    timeout_sec=15,
    serial=None)

Returns {path, device_path, size_bytes, content: [text, image]}.

camera_video

adb(action="camera_video",
    duration_sec=10,
    facing="back",
    output_path=None,
    serial=None)

Apps

list_packages

adb(action="list_packages",
    pattern=None,
    third_party=False,
    serial=None)

launch

adb(action="launch", package="com.whatsapp", serial=None)

kill

adb(action="kill", package="com.foo", serial=None)

install

adb(action="install", apk_path="/path/app.apk", serial=None)

uninstall

adb(action="uninstall", package="com.foo", serial=None)

clear_data

adb(action="clear_data", package="com.foo", serial=None)

current_app

adb(action="current_app", serial=None)
# Returns {"package": "...", "activity": "..."}

Files

push

adb(action="push", local="/host/path", remote="/sdcard/x", serial=None)

pull

adb(action="pull", remote="/sdcard/x", local="/host/path", serial=None)

ls

adb(action="ls", remote="/sdcard/DCIM/", serial=None)

Intents

open_url

adb(action="open_url", url="https://example.com", serial=None)

share_text

adb(action="share_text", text="Check this", serial=None)

start_activity

adb(action="start_activity",
    action_name="android.intent.action.VIEW",
    data=None, package=None, component=None,
    extras=None, serial=None)

Sensors

sensors

adb(action="sensors", serial=None)
# Returns structured accelerometer, gyro, light, proximity, pressure, ...

thermals

adb(action="thermals", serial=None)

wifi_info

adb(action="wifi_info", serial=None)

Settings

setting_get

adb(action="setting_get",
    namespace="global",       # "global" | "system" | "secure"
    key="airplane_mode_on",
    serial=None)

setting_put

adb(action="setting_put",
    namespace="system", key="screen_brightness", value="128",
    dry_run=False, serial=None)

setting_delete

adb(action="setting_delete", namespace="secure", key="...", serial=None)

setting_list

adb(action="setting_list", namespace="global", serial=None)

setting_dump

adb(action="setting_dump", namespace="system", serial=None)

set_ringer

adb(action="set_ringer", mode="silent", serial=None)  # silent | vibrate | normal

set_brightness

adb(action="set_brightness", value=128, serial=None)  # 0-255

set_bluetooth

adb(action="set_bluetooth", enabled=True, serial=None)

set_airplane_mode

adb(action="set_airplane_mode", enabled=True, serial=None)

Logs / Notifications

logcat

adb(action="logcat", filter=None, lines=200, serial=None)

log_stream_start

adb(action="log_stream_start",
    filter="NotificationManagerService",
    topic="phone.notifications",
    serial=None)

log_stream_stop

adb(action="log_stream_stop")

log_stream_status

adb(action="log_stream_status")

notifications

adb(action="notifications", serial=None)

Raw dumpsys output.

notifications_parsed

adb(action="notifications_parsed", serial=None)
# Returns [{app, title, text, time}, ...]

dismiss_notifications

adb(action="dismiss_notifications", serial=None)

Accessibility

accessibility_list

adb(action="accessibility_list", serial=None)

accessibility_toggle_service

adb(action="accessibility_toggle_service",
    service="com.google.android.accessibility.talkback/.TalkBackService",
    enabled=True, serial=None)

accessibility_system_action

adb(action="accessibility_system_action", id="home", serial=None)
# ids: home, back, notifications, quick_settings, ...

accessibility_captions

adb(action="accessibility_captions", enabled=True, serial=None)

accessibility_magnification

adb(action="accessibility_magnification", enabled=True, scale=2.0, serial=None)

accessibility_font_scale

adb(action="accessibility_font_scale", scale=1.3, serial=None)

accessibility_status

adb(action="accessibility_status", serial=None)

Comms

dial

adb(action="dial", phone="+1234567890", call=False, serial=None)
# call=True auto-places the call, call=False just opens dialer

sms_compose

adb(action="sms_compose", phone="+1234567890", body="hi", serial=None)

media_control

adb(action="media_control", action="play", serial=None)
# actions: play | pause | next | previous | stop | play_pause

volume

adb(action="volume", action="up", serial=None)
# actions: up | down | mute

Environment

Var Default Purpose
ADB_BIN adb (PATH) adb binary path
ADB_SERIAL none default device serial

Response Shape

{
    "status": "success" | "error",
    "content": [                       # Converse API content blocks
        {"text": "human-readable summary"},
        {"image": {"format": "png" | "jpeg",
                   "source": {"bytes": b"..."}}},
    ],

    # action-specific fields (examples):
    "path": "/tmp/shot.png",
    "size_bytes": 284512,
    "devices": [...],
    "info": {...},
    "settings": {...},
    "events": [...],
}

See Also