Give a LangChain or LangGraph agent a cloud Android phone, in Python or TypeScript.
Python
Install with pip install langchain langchain-mcp-adapters and your model provider's package:
import asyncio, os
from langchain_mcp_adapters.client import MultiServerMCPClient
from langchain.agents import create_agent
async def main():
client = MultiServerMCPClient({
"phonebox": {
"transport": "streamable_http",
"url": "https://phonebox.dev/mcp",
"headers": {"Authorization": f"Bearer {os.environ['PHONEBOX_API_KEY']}"},
}
})
agent = create_agent(
model=os.environ["LANGCHAIN_MODEL"], # a "provider:model" string
tools=await client.get_tools(),
system_prompt="You control cloud Android phones through Phonebox. Park every phone you start when you're done.",
)
result = await agent.ainvoke({"messages": [{"role": "user", "content": "Create a phone named settings-check, open Settings, tell me the Android version, then park the phone."}]})
print(result["messages"][-1].content)
asyncio.run(main())In Python the tools keep their own names: create_phone, observe, act, park_phone and the rest.
TypeScript
Install with npm install langchain @langchain/mcp-adapters:
import { MultiServerMCPClient } from "@langchain/mcp-adapters";
import { createAgent } from "langchain";
const client = new MultiServerMCPClient({
mcpServers: {
phonebox: {
transport: "http",
url: "https://phonebox.dev/mcp",
headers: { Authorization: `Bearer ${process.env.PHONEBOX_API_KEY}` },
},
},
});
try {
const agent = createAgent({
model: process.env.LANGCHAIN_MODEL!, // a "provider:model" string, such as one for OpenAI or Anthropic
tools: await client.getTools(),
systemPrompt: "You control cloud Android phones through Phonebox. Park every phone you start when you're done.",
});
const result = await agent.invoke({
messages: [{ role: "user", content: "Create a phone named settings-check, open Settings, tell me the Android version, then park the phone." }],
});
console.log(result.messages.at(-1)?.content);
} finally {
await client.close();
}The TypeScript adapter prefixes each tool with the server name, so the agent sees phonebox_create_phone, phonebox_observe and so on.
Inside your own LangGraph graph
The tools from get_tools() are ordinary LangChain tools, so a custom graph can bind them to a model node and run them in a tool node. Keep the phone ID in the graph's state between steps, and park the phone in a final node, so a run that fails halfway still parks it.
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.
What was checked
Checked on December 1, 2026 with langchain-mcp-adapters 0.3.2 and langchain 1.5.2 for Python, and @langchain/mcp-adapters 2.0.3 and langchain 1.6.8 for TypeScript: the framework's MCP client connected to https://phonebox.dev/mcp with a project API key, listed all 14 Phonebox tools and called get_account. That check didn't start a phone or run a model; the agent code on this page was type-checked against those versions. See the LangChain MCP adapters for more options.
LangChain and LangGraph: common questions
How do I use a remote MCP server in LangGraph?
Use MultiServerMCPClient from langchain-mcp-adapters with the streamable_http transport, the server's URL and any headers, then pass await client.get_tools() to create_agent or bind them in your own graph. For Phonebox, the URL is https://phonebox.dev/mcp with your API key as a bearer token.
Is there a LangChain integration for Android phones?
Phonebox's hosted MCP server works with LangChain through the official MCP adapters, in Python and TypeScript, so a LangChain or LangGraph agent can create a cloud Android phone, read the screen, tap, type and install APKs.