Automate an Android phone from Python.
Run pip install mobilebox and set your key. Then create_phone() gives your script or AI agent a ready cloud Android phone: your code reads its screen as text, taps, types, installs your APK and takes screenshots. In our 22 November 2026 benchmark a new phone was ready for its first screenshot in 1.35 s. It costs $0.01 a minute, billed per second after the first minute, and platform="ios" gives you an iPhone simulator for $0.03 a minute.
Sign up with GitHub, Google or email. New workspaces get free credit, no card.
One pull-request check, start to finish.
Start a phone, install the build, walk one step of the flow, keep the picture and delete the phone. The finally block deletes the phone even when a step fails, so nothing keeps running.
# pip install mobilebox; MOBILESANDBOX_API_KEY=... python check.py
from mobilebox import Mobilebox
mb = Mobilebox() # reads MOBILESANDBOX_API_KEY
phone = mb.create_phone(name="checkout-check", max_duration=600)
try:
mb.install_app(phone.id, file="app.apk")
result = mb.act(phone.id, [
{"type": "open_app", "package": "com.example.shop"},
{"type": "tap", "target": {"text": "Sign in"}},
{"type": "wait_for", "text": "Welcome"},
])
with open("signed-in.png", "wb") as f:
f.write(mb.screenshot(phone.id))
print("ok" if result.ok else result.error)
finally:
mb.delete_phone(phone.id)What your code calls
Each method is one call to the REST API, so anything your script does, your agent can do over MCP as well.
| Method | What it does |
|---|---|
create_phone() | A cloud Android phone, ready; platform="ios" for an iPhone, city="Berlin" for GPS, time zone and language there |
install_app() | Your APK, .apks or .xapk from a file or a URL, or a simulator build on an iPhone |
observe() | The screen as text and numbered elements; screen.find("Pay") returns one |
act() | Tap, type, swipe, open apps and URLs, wait for text: up to 20 actions, stopping at the first failure |
screenshot() | PNG bytes, for your CI artifacts or the pull request |
park_phone(), start_phone() | Park keeps the apps, data and logins at no cost; start picks up where it left off |
Python 3.10 or newer, no other dependencies. For an agent framework, pip install langchain-mobilebox gives LangChain and LangGraph the phone as tools; OpenAI Agents SDK, CrewAI and browser-use have their own pages.
Questions
Android automation from Python.
Is there a Python package for Android automation?
Yes, it's pip install mobilebox. create_phone() gives you a cloud Android phone, and observe, act, install_app and screenshot drive it. $0.01 a minute, billed per second.
Do I need ADB, Appium or a local emulator?
No. The phone runs in the Mobilebox cloud and your Python code talks to it over HTTPS, from a laptop, a CI runner or a container without KVM.
Can my Python AI agent drive the phone?
Yes. Give the model observe and act as tools, or use langchain-mobilebox for LangChain and LangGraph. The LangGraph page has a complete program; when we ran it against production, it answered in 34 seconds.
Can I run many phones at once?
Yes, one create_phone() per task, with idempotency_key= so a retried job doesn't start a second phone. 50 Android phones for 10 minutes cost $5.00; see phones in parallel.
What does a run cost?
$0.01 a minute while the phone is ready, billed per second with a one-minute minimum; boot time is free. A 3-minute check on 100 pull requests a month costs $3 in phones.
Can the same code drive an iPhone?
Yes. create_phone(platform="ios") gives you an iPhone simulator, model="ipad" an iPad, at $0.03 a minute, with the same observe and act.
Read more
Python Android automation for AI agents
Control a cloud Android phone from Python: pip install mobilebox, then one cloud phone per pull request: start it, install the build, walk the flow, screenshot each step, delete it. A tested script, the LangGraph version and what a run costs.
How many Android emulators can run in parallel in CI?
Local emulators in parallel compete for one runner’s KVM, CPU and memory. Create one cloud phone per task with one call each, give each an idempotency key, run the agents side by side and park or delete every phone in finally. What 50 phones cost.