Overview
The Allternit Android Bridge is a local HTTP service that exposes a real Android device to the Allternit runtime. It wraps thephone-harness-android ADB harness and lets agents and sidecars send SMS, read messages, take screenshots, tap elements, type text, and press hardware keys — all through a small REST API.
The bridge is typically consumed by the Open Connector sidecar so that agents can interact with mobile apps and messaging workflows without handling ADB directly.
The Android Bridge runs on a host with an authorized Android device attached over USB or ADB-over-network. Screenshots, messages, and device state stay on that host.
How it works
- An Android device is connected to a host machine and authorized for ADB.
- The
phone-harness-androidharness provides low-level ADB helpers such asscreenshot,tap_text, and_adb. - The Android Bridge exposes those helpers as FastAPI endpoints on
127.0.0.1. - The Allternit runtime or sidecar calls the bridge over HTTP to perform mobile actions remotely.
Installation
Requirements
- Python 3.10+
- ADB installed and on the host
PATH - An Android device with USB debugging enabled and authorized
- The
phone-harness-androidharness checked out on the host
Install dependencies
Start the service
127.0.0.1:8020 and looks for the harness at /Users/joe/phone-harness-android.
Configuration
The harness directory must contain a
harness.py module with at least the following helpers:
check_device()— returnsTruewhen an authorized Android device is connectedpress_home()— presses the home keywait_stable(seconds)— waits briefly for the UI to settle_adb(args, **kwargs)— runs anadbcommand and returns the resultscreenshot(path)— writes a PNG screenshot topathtap_text(text, screenshot_path)— OCR-taps the first matching text on screen
Endpoints
Health check
ready is true only when the harness loaded successfully and an authorized device is connected.
Send an SMS
Read messages
Screenshot
Tap
Tap by OCR text:text is provided, the bridge takes a screenshot and uses the harness to locate and tap the first matching text. If the text is not found, the endpoint returns HTTP 404.
Type text
%s) before the command is sent.
Press a key
Supported keys:home, back, recent, power, menu.
Error handling
Integrating with the runtime
The Android Bridge is normally consumed through the Open Connector sidecar as an action or MCP tool. A minimal tool registration maps each bridge endpoint to a typed function:Security considerations
- The bridge binds to
127.0.0.1by default and has no built-in authentication. Only run it on trusted hosts or behind a gateway that enforces auth. - ADB authorization is handled by the Android device itself. An unauthorized device cannot be controlled until the RSA key dialog is accepted on the device.
- SMS and screenshots contain sensitive data. Keep the bridge on the same host as the device and avoid exposing it to untrusted networks.