
- What it is: An open-source toolkit (CLI, MCP Server, and Node.js API) created by Callstack (5,000+ GitHub stars) that gives AI coding agents full control over real or simulated mobile, web, and desktop apps.
- Why it matters: Instead of making LLMs guess UI coordinates from expensive visual screenshots, it generates token-efficient accessibility snapshots so agents can tap, text, inspect, and verify UI changes automatically.
- Who should use it: Developers using Claude Code, Cursor, Windsurf, Cline, or Goose who want AI agents to write, execute, and verify front-end code across iOS, Android, HarmonyOS, TV, and web platforms.
AI coding agents are fast at writing code. You give Claude Code or Cursor a prompt like “Fix the button padding on the checkout screen,” and within seconds, your git working tree has three modified files.
Then comes the manual roadblock: You boot up an iOS simulator or Android emulator, navigate through five setup screens, tap the button yourself, and verify whether the layout actually looks correct.
If the agent made a mistake, you copy-paste the error back into the chat window and repeat the entire loop manually.
agent-device eliminates this friction. Developed by Callstack, this utility gives AI agents direct control over running applications across iOS, Android, HarmonyOS, TV platforms, Web, macOS, and Linux. Agents stop writing code blind—they apply changes, inspect the live UI tree, perform taps, capture evidence, and verify their own work before asking for your code review.
The Problem: Why AI Coding Agents Get Stuck on Mobile
Visual AI agents face three primary challenges when operating mobile user interfaces:
- Token Exhaustion: Sending raw 4K screenshots into LLM context windows burns through tokens quickly. High-resolution vision inputs slow down execution speed and increase costs.
- Coordinate Hallucination: Expecting an LLM to reliably output pixel coordinates (
x: 240, y: 580) across varying screen resolutions leads to misclicks, missed inputs, and broken interactions. - Lack of Instant Feedback: Without an execution environment, an agent cannot confirm whether a tap opened a modal or threw a silent runtime error.
+-----------------------------------------------------------------------+
| Traditional Agent Loop |
| Agent Writes Code --> Human Boots Simulator --> Human Verifies |
+-----------------------------------------------------------------------+
| agent-device Loop |
| Agent Writes Code --> Agent Launches App --> Agent Taps & Checks |
+-----------------------------------------------------------------------+
agent-device solves these friction points by providing structural accessibility trees instead of relying solely on heavy visual images. The AI sees element roles, text labels, and unique short references (@e1, @e2), making UI manipulation fast, accurate, and token-light.
How agent-device Works Under the Hood
Rather than forcing the LLM to process millions of image pixels, agent-device extracts the runtime target’s Accessibility Snapshot. This tree structure tells the agent precisely what elements exist on screen and how to interact with them.
graph TD
A[AI Coding Agent
Claude Code / Cursor / Windsurf] -->|1. MCP / CLI Command| B[agent-device Core Runtime]
B -->|2. Query UI Tree| C[Target App
iOS / Android / Web / TV]
C -->|3. Return Accessibility Tree| B
B -->|4. Token-Efficient Snapshot + Diffs| A
A -->|5. Action: press @e2, fill @e7| B
B -->|6. Execute & Wait for Settlement| C
Key Concepts
- Accessibility Snapshots: Compact text representations of the visible screen structure. Instead of analyzing images, agents receive structured UI logs.
- Ref Identifiers (
@e1,@e2): Short, temporary element handles assigned dynamically to screen targets. - UI Settlement (
--settle): Ensures animations and network calls complete before the agent receives control back, avoiding race conditions. - State Diffs: After every interaction,
agent-deviceoutputs explicit UI diffs showing newly opened views, modified text fields, or removed buttons.
Accessibility Snapshots vs. Visual Vision Processing
Here is how agent-device compares to conventional visual-only AI automation tools:
| Feature | Visual Screenshot AI Agents | agent-device Hybrid Approach |
|---|---|---|
| Context Cost | High (Thousands of tokens per frame) | Low (Token-optimized text tree) |
| Precision | Variable (Pixel coordinates drift with resolution) | Exact (Direct element targeting via semantic refs) |
| Execution Speed | Slower (Vision processing overhead) | Fast (Sub-second UI diffing & settled states) |
| Supported Platforms | Desktop vision capture only | iOS, Android, HarmonyOS, tvOS, Web, Linux, macOS |
| Worktree Isolation | Single active instance | Parallel multi-agent execution support |
Hands-On: Driving Mobile Apps with CLI Commands
You can test agent-device manually or wire it directly into an AI agent setup.
1. Installation & Environment Check
First, verify Node.js requirements (Node.js 22.12+ for mobile platforms; Node.js 24+ for web target support):
npm install -g agent-device@latest
# Run the built-in environment diagnosis tool
agent-device doctor
The doctor check identifies missing Xcode dependencies, Android SDK paths, or browser drivers before handing execution off to an LLM.
_____ _ _ _
| _ |___ ___ ___| |_ ___ ___|_|___ ___ _| |___
| __ | . | -_| | _|- _| -_| | _| -_| . | -_|
|__|__|_ |___|_|_|_| |___|___|_|_| |___|___|___|
|___|
✔ Node.js version 22.14.0
✔ Xcode CLI tools installed
✔ iOS Simulators available
✔ Android SDK & ADB configured
✔ Doctor check passed. Ready for agent automation!
2. Live Inspection & Interaction Workflow
Here is how an agent launches the native iOS Contacts app, reads the layout, and adds a contact:
# Open the target app on an iOS Simulator
agent-device open Contacts --platform ios
# Generate an interactive accessibility snapshot
agent-device snapshot -i
Terminal Snapshot Output:
@e1 [window]
@e2 [button] "Add"
@e3 [search-field] "Search"
@e4 [table]
Notice the assigned handle @e2 next to the “Add” button. The agent presses that element and waits for screen transitions to complete:
# Press element @e2 and wait for UI settlement
agent-device press @e2 --settle
Diff Output returned to Agent:
- @e2 [button] "Add"
+ @e7 [text-field] "First name"
+ @e8 [text-field] "Last name"
+ @e9 [button] "Done"
The UI diff shows new text inputs available on screen. The agent completes the fields:
agent-device fill @e7 "Ada" --settle
agent-device fill @e8 "Lovelace" --settle
agent-device press @e9 --settle
Within four atomic terminal commands, the agent populated real mobile app inputs and verified state changes without loading full visual frames into memory.
Integrations: Connect to Your Existing AI Agent Stack
agent-device works across different developer environments:
1. Model Context Protocol (MCP) Server
agent-device includes a native Model Context Protocol (MCP) server. If you use tools like Cursor, Windsurf, Claude Code, or Cline, configure the MCP connection to give your agent built-in device control tools out of the box.
{
"mcpServers": {
"agent-device": {
"command": "npx",
"args": ["-y", "agent-device", "mcp"]
}
}
}
2. Node.js Programmatic API
Building custom internal coding agents using the Vercel AI SDK or custom orchestration frameworks? agent-device provides a fully typed JavaScript/TypeScript SDK:
import { DeviceSession } from 'agent-device';
async function verifyLoginFlow() {
const session = await DeviceSession.launch({
platform: 'android',
appId: 'com.example.myapp',
});
// Extract snapshot
const snapshot = await session.getSnapshot();
// Interact programmatically via references or selectors
await session.fill('@username_input', 'testuser@example.com');
await session.press('@submit_btn', { settle: true });
// Save evidence screenshot for pull request logging
await session.saveEvidence('./pr-artifacts/login-verified.png');
await session.close();
}
Real-World Production Use Cases
agent-device is active across real engineering team workflows:
- Expensify: Uses
agent-deviceto automate end-to-end bug evidence generation. When bugs are reported, agents reproduce issues on physical and simulated mobile devices, record video/screenshots, gather performance profiling stats, and attach verified evidence directly to GitHub issues. - Shopify: Integrates agent verification into mobile app component workflows to validate interface rendering across distinct screen form factors.
- Multi-Platform TV Apps: Automates hard-to-test media platforms including tvOS, Android TV, and Amazon Vega OS TV using unified automation scripts.
- Parallel Worktree Execution: Coordinates device pool locks across git worktrees, enabling multiple agent instances to run independent tests simultaneously without device collision.
Common Myths & Misconceptions
Myth 1: “AI Agents only need visual vision models to automate UIs.”
Reality: Vision-only models are slower and consume context limits quickly. Using accessibility trees provides precise structural awareness, reserving vision passes for visual regression checks.
Myth 2: “It only works on local iOS simulators.”
Reality: agent-device supports physical devices, local simulators/emulators, remote device clouds, and cross-platform desktop targets (macOS, Linux, Web).
Myth 3: “Setting up mobile agent automation is too brittle for CI.”
Reality: Features like settlement flags (--settle), native device pool coordination, and built-in diagnostic tools (agent-device doctor) stabilize setup pipelines in local and cloud CI environments.
Actionable Tips to Get Started Immediately
- Start Small with
doctor: Runagent-device doctoron your local development machine to confirm local iOS, Android, or Web drivers are correctly mapped. - Hook Up Your Favorite IDE Agent: Add the
agent-deviceMCP configuration to Cursor or Windsurf. Prompt the AI: “Open our React Native app on the iOS simulator, navigate to the Settings tab, and verify that dark mode toggles cleanly.” - Enforce Verification in Prompt System Instructions: Update your repository’s
.cursorrulesor system prompts to instruct agents: “Always verify UI changes usingagent-devicebefore outputting code completions.” - Collect PR Artifacts automatically: Have your agents attach evidence logs generated via
agent-device snapshotdirectly to pull request descriptions.
Closing Takeaway
Coding agents shouldn’t stop at generating code—they should prove their solutions work. agent-device gives AI assistants the hands and eyes needed to drive mobile, web, and TV interfaces directly.
By swapping heavy vision processing for fast, token-efficient accessibility trees, agent-device brings reliable automated execution loops to everyday app development.
📂 Explore the open-source repository on GitHub: https://github.com/callstack/agent-device


Leave a Reply