Give a Google ADK agent a cloud Android phone with McpToolset.

Why give an ADK agent a phone?

ADK agents are great at calling APIs. Most mobile apps don't have one. With Phonebox, your Gemini-powered agent uses the app the way a person does: on a cloud Android phone, with its own screen, apps and sign-ins. That unlocks:

  • Testing the app you just built. Install the APK, walk the changed screens, report bugs with the exact screen text.
  • Automating apps that have no API. Read a balance, change a setting, check a listing.
  • Multi-agent workflows. One ADK sub-agent owns the phone; others plan and write up results.

Phonebox's MCP server is hosted and stateless, so ADK connects to it over HTTPS like any other remote MCP server.

The code

Install ADK with its MCP extra:

pip install "google-adk[mcp]"
export PHONEBOX_API_KEY=pbx_...
export GOOGLE_API_KEY=...   # or your Vertex AI settings
agent.py
import asyncio
import os

from google.adk.agents import Agent
from google.adk.agents.run_config import RunConfig
from google.adk.runners import InMemoryRunner
from google.adk.tools.mcp_tool import McpToolset, StreamableHTTPConnectionParams
from google.genai import types

phonebox = McpToolset(
    connection_params=StreamableHTTPConnectionParams(
        url="https://phonebox.dev/mcp",
        headers={"Authorization": f"Bearer {os.environ['PHONEBOX_API_KEY']}"},
    ),
)

agent = Agent(
    name="android_operator",
    model="gemini-3.5-flash",
    instruction=(
        "You operate a cloud Android phone through the Phonebox tools. "
        "Start or create one phone, call observe before every action, "
        "batch steps in act, and park the phone when you are done."
    ),
    tools=[phonebox],
)


async def main() -> None:
    runner = InMemoryRunner(agent=agent, app_name="phonebox_demo")
    session = await runner.session_service.create_session(
        app_name="phonebox_demo", user_id="dev"
    )
    task = types.Content(
        role="user",
        parts=[types.Part(text="Open Settings and tell me the Android version.")],
    )
    try:
        async for event in runner.run_async(
            user_id="dev",
            session_id=session.id,
            new_message=task,
            run_config=RunConfig(max_llm_calls=60),
        ):
            if event.is_final_response() and event.content and event.content.parts:
                print(event.content.parts[0].text)
    finally:
        await phonebox.close()


if __name__ == "__main__":
    asyncio.run(main())

McpToolset opens the MCP session when the agent first needs its tools; close() ends it. The tools appear under their own names, such as observe and act.

Using it with adk web or adk run

ADK's dev UI looks for a root_agent in your agent package. Put the phonebox toolset and the Agent in agent.py, name the agent variable root_agent, and run adk web from the parent folder. You can then watch every observe and act call in the trace view, and open the phone's live view (the live_view_url tool) in your browser to watch it, or take over for a sign-in.

Keep the tool list short

A phone task rarely needs all 34 tools. ADK's tool_filter limits what the model sees, which saves tokens and keeps the agent on task:

tool_filter
phonebox = McpToolset(
    connection_params=StreamableHTTPConnectionParams(
        url="https://phonebox.dev/mcp",
        headers={"Authorization": f"Bearer {os.environ['PHONEBOX_API_KEY']}"},
    ),
    tool_filter=["create_phone", "start_phone", "observe", "act",
                 "install_app", "live_view_url", "park_phone"],
)

How the agent drives the phone

The loop is simple: create_phone (or start_phone for a parked one), then observe to read the screen as a numbered list of elements plus a screenshot, then act to tap, type or swipe. act runs up to 20 actions in one call and stops at the first failure, so the agent spends fewer model calls per task. ADK's default ceiling of 500 model calls per run is plenty; the example sets max_llm_calls=60 as a cost guard.

Which agent in a multi-agent ADK app gets the phone?

Give the Phonebox toolset only to the sub-agent that operates the phone, and let a coordinator agent delegate to it. One agent owns starting and parking the phone, and the others don't carry 34 tool schemas they never use.

Keys, costs and cleanup

Create an Agent key in API keys and export it as PHONEBOX_API_KEY. An Agent key can create, start, use and park phones but can't delete them, which is the right default for an agent. Give the key an expiry, and set a monthly spending limit in Settings: it stops new sessions when it's reached.

Tell the agent to park every phone it starts. A parked phone costs nothing and keeps its apps, files and sign-ins for the next run. Phonebox also parks a phone after its idle timeout and ends a session at its maximum length, so a crashed script doesn't leave a phone running.

Phonebox's tool schemas also list context (a short reason for the call) and llm_model, which are used only for analytics. Models fill them in from the schema, so an agent needs nothing extra. The server doesn't reject a call without them, so code that calls a tool directly can leave them out.

Pricing: Starter is $20/month and includes $20 of phone time; phone time is $0.06 a minute, billed per second. See pricing.

What was checked

Checked on December 3, 2026 with google-adk 2.15.1 and mcp 2.3.0: ADK's McpToolset connected to https://phonebox.dev/mcp with a project API key and listed all 34 Phonebox tools. Without a key, a request to the same URL returns 401. That check didn't start a phone or run a model. See ADK's MCP tools docs for the toolset's other options.

Google ADK: common questions

Can Google ADK use a hosted MCP server?

Yes. McpToolset with StreamableHTTPConnectionParams connects to a remote MCP server over Streamable HTTP with a URL and headers. For Phonebox, use https://phonebox.dev/mcp and your project API key as a bearer token.

Which pip package do I need?

google-adk[mcp]. The MCP extra installs the mcp client library; without it, McpToolset can't be imported from google.adk.tools.mcp_tool.

Does this work with Gemini on Vertex AI?

Yes. The Phonebox connection doesn't depend on the model backend; set ADK's usual Vertex AI environment variables instead of GOOGLE_API_KEY.

Do I need an Android emulator or the Android SDK?

No. The phone runs in Phonebox's cloud and the MCP server is hosted, so nothing Android-related runs on your machine.

Can ADK agents in TypeScript or Java use Phonebox?

Any MCP client that can send an Authorization header over Streamable HTTP works with the same URL and key. This page's code is for ADK Python.