Mobilebox
Menu

OpenAI Agents SDK on Android: give your agent a phone.

Yes, the OpenAI Agents SDK can operate Android apps. Point MCPServerStreamableHttp at Mobilebox and your agent gets a cloud phone: it reads the screen as numbered elements, then taps, types, swipes and installs apps. The example below is the whole program.

Python, 27 lines, the hosted MCP server and its 13 tools. Android and iPhone over one API.

Run it in three steps.

Your code owns the phone; the agent only drives it.

Read the quickstart
  1. 1

    Get a key

    Sign up with GitHub and create an API key in the dashboard. New accounts get $2 of credit.

  2. 2

    Install OpenAI Agents SDK

    pip install openai-agents

  3. 3

    Run the example

    python agent.py with MOBILESANDBOX_API_KEY and OPENAI_API_KEY set. It creates a phone, gives the agent one task and deletes the phone, also when the run fails.

The whole example

MCP calls in the SDK time out after 5 seconds by default; the example allows 60, so a long act batch can finish.

python · agent.py
# OpenAI Agents SDK + Mobilebox: an agent drives a cloud Android phone over MCP.
#   pip install openai-agents
#   MOBILESANDBOX_API_KEY=... OPENAI_API_KEY=... python agent.py
import asyncio, json, os, urllib.request

from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp

API = "https://mobilebox.dev"
AUTH = {"Authorization": f"Bearer {os.environ['MOBILESANDBOX_API_KEY']}"}


def phones(method, path=""):  # your code owns the phone: create it, and always delete it
    req = urllib.request.Request(f"{API}/v1/phones{path}", method=method, headers=AUTH)
    with urllib.request.urlopen(req) as res:
        return json.loads(res.read() or "null")


async def main():
    phone = phones("POST", "?wait=ready")["id"]
    try:
        async with MCPServerStreamableHttp(name="mobilebox", params={"url": f"{API}/mcp", "headers": AUTH, "timeout": 60}) as mobilebox:
            agent = Agent(
                name="Phone operator",
                instructions=f"You operate the Android phone {phone} with the Mobilebox tools. "
                "Observe, act, and check each result on the returned screen. Don't create or delete phones.",
                mcp_servers=[mobilebox],
            )
            result = await Runner.run(agent, "Open Settings > Display and tell me the brightness level.", max_turns=20)
            print(result.final_output)
    finally:
        phones("DELETE", f"/{phone}")


asyncio.run(main())

Ran once against production on 5 November 2026: the agent answered “Brightness level: 83%” in 38 s, and the phone was deleted. Run log

Questions

Before you wire OpenAI Agents SDK to a phone.

Does the OpenAI Agents SDK support remote MCP servers?

Yes. MCPServerStreamableHttp connects to any Streamable HTTP server with your headers, and the agent lists its tools on every run. Mobilebox serves 13 tools at https://mobilebox.dev/mcp.

Which models can drive the phone?

Any model the SDK can call that uses tools. The example runs on the SDK’s default model; set OPENAI_DEFAULT_MODEL or pass model to Agent to pick another.

Can the agent install my app?

Yes. install_app takes a public APK or split-bundle URL, or your code uploads the file over REST; then the agent opens it with {"type":"open_app","package":…}. See installing APKs and split bundles.

Does it work on iPhone?

Yes. Create the phone with platform: "ios" and the agent uses the same tools. See iPhone and iPad.

What does a run like this cost?

A ready phone costs $0.01 a minute, billed per second with a one-minute minimum; boot time and parked phones are free, so a run like the one above costs about a cent. See pricing.

Read more

Using another framework? LangGraph, CrewAI, browser-use, Mastra, Vercel AI SDK, Claude Agent SDK.

All integrations