Skip to main content

mobilerun-core-local is the slim async local-driver core of mobilerun.
No CLI, no agent, no LLM providers — just local Android/iOS drivers for higher-level tools such as mobilerun-core.


  • 📱 Drive local devices — Android over ADB with optional Portal, Android Portal HTTP-only, or iOS Portal HTTP.
  • ⚡ TCP-with-content-provider fallback — fast Android HTTP path over adb forward, transparent fallback to content-provider RPC.
  • 🔌 HTTP-only drivers — connect to already-running Android/iOS portals without taking over setup.
  • 🛠 Portal lifecycle — download, install, accessibility enablement, auto-upgrade.
  • 🪶 Slim — a small async driver package with four runtime deps (async_adbutils, httpx, requests, rich).
  • 🔌 Embeddable — designed to be wrapped by sync facades (e.g. mobilerun-core) or used directly.
  • 🤝 In sync with upstream — verbatim slice of droidrun/mobilerun; behaviour and API track upstream.

📦 Installation

Note: Python >=3.11,<3.14. The Android ADB driver requires ADB on PATH and a device with USB debugging enabled. HTTP-only drivers require an already-running portal URL.

uv pip install mobilerun-core-local

🚀 Quick usage

import asyncio
from async_adbutils import adb
from mobilerun_core_local import AndroidDriver
from mobilerun_core_local.driver.android import ensure_portal_ready


async def main():
    # 1. Optional: make sure Portal is installed + accessibility is on for
    #    Portal-enhanced state/text paths. AndroidDriver still works over ADB
    #    without this step.
    device = await adb.device()
    await ensure_portal_ready(device)

    # 2. Drive the device.
    driver = AndroidDriver(serial=device.serial, use_tcp=True)
    await driver.connect()

    await driver.tap(540, 1200)
    await driver.swipe(540, 1600, 540, 400, duration_ms=300)
    await driver.input_text("hello", clear=True)
    png_bytes = await driver.screenshot()
    tree = await driver.get_ui_tree()


asyncio.run(main())

HTTP-only Android:

import asyncio
from mobilerun_core_local import AndroidPortalHttpDriver


async def main():
    driver = AndroidPortalHttpDriver(
        url="http://127.0.0.1:18080",
        token="...",
    )
    await driver.connect()
    await driver.tap(540, 1200)


asyncio.run(main())

iOS with mobilerun-ios --local:

Follow the Connect an iPhone guide to set up and start the iOS portal.

import asyncio
from mobilerun_core_local import IOSPortalHttpDriver


async def main():
    driver = IOSPortalHttpDriver("http://127.0.0.1:8080")
    await driver.connect()
    await driver.start_app("com.apple.Preferences")


asyncio.run(main())

🧱 Layout

Platform-specific code is namespaced under driver/<platform>/ and transport/<platform>/. Adding a new backend (e.g. iOS over USB, a new Android transport) does not pollute the package root.

mobilerun_core_local/
├── __init__.py                       Re-exports the public driver surface
├── driver/
│   ├── base.py                       DeviceDriver ABC, DeviceDisconnectedError
│   ├── android/
│   │   ├── adb.py                    AndroidDriver — ADB-backed driver
│   │   ├── http.py                   AndroidPortalHttpDriver — HTTP-only driver
│   │   └── portal.py                 Portal APK lifecycle + content-provider helpers
│   └── ios/
│       └── http.py                   IOSPortalDriver — ios-portal HTTP driver
└── transport/
    └── android/
        └── portal_client.py          PortalClient — TCP-with-content-provider fallback

📚 Public API

Re-exported from mobilerun_core_local:

Symbol What it is
AndroidDriver ADB-first Android driver with optional Portal enhancement. Async methods: tap, swipe, input_text, press_button, press_key_code, start_app, stop_app, install_app, uninstall_app, clear_app_data, grant_permission, open_deep_link, screenshot, get_ui_tree, get_apps, list_packages, get_date, and (with Portal) get_clipboard, set_clipboard, get_deep_links, resolve_deep_link.
AndroidPortalHttpDriver HTTP-only Android Portal driver. Requires url and bearer token; does not use ADB at runtime. Adds open_deep_link, get_clipboard, set_clipboard, get_date, get_deep_links and resolve_deep_link on top of the input, app and state verbs.
IOSPortalHttpDriver mobilerun-ios --local driver. Same verbs as AndroidPortalHttpDriver plus install_app and uninstall_app.
IOSPortalDriver / IOSDriver iOS Portal HTTP driver. Requires an already-running ios-portal URL.
DeviceDriver Abstract base for drivers. supported: set[str] declares which verbs a subclass implements. get_ui_tree(filter=False) asks the server for the unfiltered tree.
DeviceDisconnectedError Raised when the device drops mid-call.
validate_android_portal_url(url) / validate_ios_portal_url(url) Normalize + sanity-check portal URLs.
discover_ios_portal(...) Scan localhost for a reachable ios-portal HTTP endpoint.

Android Portal helpers live under mobilerun_core_local.driver.android (not at the package root, since they're Android-specific):

Symbol What it is
setup_portal(device, debug=False, *, version=None, uninstall=True) Download + install + enable the Portal APK on a device. With version (your package version), installs the Portal pinned for it in the version map; without it, or when the map has no entry or can't be fetched, installs the latest release. uninstall=True clears Portal's settings first; uninstall=False updates in place unless the installed APK has a different signature or a higher version code, which Android only allows after an uninstall.
ensure_portal_ready(device, debug=False, *, version=None) Idempotent: install Portal and enable accessibility if needed. With version, also upgrades an installed Portal that is older than the pin, in place; a newer Portal is kept, and a failed upgrade keeps the installed one.
setup_keyboard(device) Switch the device to the Mobilerun IME.
ping_portal(device) Verify Portal is installed and reachable.
PORTAL_PACKAGE_NAME, A11Y_SERVICE_NAME Portal identifiers.
portal_content_uri(pkg, path) Build content://<pkg>/<path> URIs.
portal_a11y_service(pkg), portal_ime_id(pkg) Accessibility service / IME component names.

PortalClient (the TCP-with-content-provider transport) lives at mobilerun_core_local.transport.android.PortalClient — used internally by AndroidDriver, exposed for low-level access.

AndroidDriver accepts:

  • serial: str | None — ADB serial; None picks the only connected device.
  • use_tcp: bool = False — when True, the underlying PortalClient port-forwards Portal's HTTP server (localhost:N → device:8080) and uses it instead of the content provider. Faster but requires a working forward; falls back transparently.

🪵 Logging

All output goes through the "mobilerun_core_local" logger. Configure it yourself; the package attaches no handlers.

import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger("mobilerun_core_local").setLevel(logging.DEBUG)

🔗 Relationship to upstream mobilerun

This package owns local execution drivers. The full framework imports these drivers for CLI/agent flows; mobilerun-core wraps them behind a sync, backend-neutral API.

Use mobilerun-core-local when you need async local drivers directly. Use mobilerun when you want the full LLM-agent experience, CLI/TUI, and multi-platform support out of the box.

📄 License

MIT — see LICENSE.

Metadata

Release files for mobilerun-core-local 0.7.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mobilerun-core-local 0.7.2
File Size Uploaded Provenance Actions
mobilerun_core_local-0.7.2.tar.gz 64.9 kB With provenance Details for mobilerun_core_local-0.7.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mobilerun-core-local 0.7.2
File Interpreter ABI Platform Actions
mobilerun_core_local-0.7.2-py3-none-any.whl Python 3 none any Details for mobilerun_core_local-0.7.2-py3-none-any.whl

Total release size: 123.3 kB

Release files / mobilerun_core_local-0.7.2.tar.gz

Download URL mobilerun_core_local-0.7.2.tar.gz
Size 64.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4730e1b839cd0d2d268f1ff3e830da0dde0152b74e782ba52ca96da830fb704b
BLAKE2b-256 checksum
How to use checksums
c6b14d0c69257cc19ec85c2c816bdce4fc9d25f5af2def1de59cc89074988326
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / mobilerun_core_local-0.7.2-py3-none-any.whl

Download URL mobilerun_core_local-0.7.2-py3-none-any.whl
Size 58.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
62f9e53b22589f78e46bd56d1417018f547657b9b6e60642fae140f691c28f30
BLAKE2b-256 checksum
How to use checksums
7e73347d1ab1816eb6bc5780e2df7650eb5f75398f7ef9e5b4dcbdb75199e1ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Security for mobilerun-core-local 0.7.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mobilerun_core_local-0.7.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page