agent-device README

The project's README from github.com/callstack/agent-device. As one markdown file: README.md.

agent-device: mobile app automation and verification for AI coding agents

agent-device

npm version CI License: MIT Glama MCP server

Mobile app automation and verification for AI coding agents. Give coding agents a live app feedback loop through a CLI, built-in MCP server, or typed Node.js API.

Let your coding agent verify its changes in the running app. agent-device lets agents inspect, control, debug, and verify apps on iOS, Android, and HarmonyOS (simulators, emulators, and physical devices), plus tvOS, Android TV, Amazon Vega OS TV (Vega Virtual Device), web, macOS, and Linux. Agents read token-efficient accessibility snapshots instead of reasoning over screenshots alone, act through refs and selectors, and save evidence for review. It also coordinates device access across parallel agent worktrees and connects to remote device clouds.

Works with Claude Code, Codex, Cursor, Windsurf, Cline, Goose, and any agent that can run a CLI or connect over MCP, or as the runtime under agents you build with the AI SDK or Eve. Developers at Expensify, Shopify, and others use it to verify their apps.

Quick start

Install the CLI and check setup. It requires Node.js 22.12 or newer; web automation requires Node.js 24 or newer. See Installation for target requirements.

npm install -g agent-device@latest
agent-device doctor
agent-device help workflow

Run doctor yourself before handing the CLI to an agent; help workflow links to the guides for debugging, replay, and profiling, and the installed help always matches the installed version.

Drive an app from the CLI

Add a contact in the built-in iOS Contacts app:

# Start a session.
agent-device open Contacts --platform ios

# Inspect the screen. The example below shows the output; refs vary.
agent-device snapshot -i
# @e2 [button] "Add"

# Use the ref and wait for the UI to settle.
agent-device press @e2 --settle
# The diff includes:
# + @e7 [text-field] "First name"

agent-device fill @e7 "Ada" --settle
# The next diff shows changed values and current refs:
# - @e7 [text-field] "First name"
# + @e14 [text-field] "Ada"
# = @e15 [text-field] "Last name"

# Capture evidence and close the session.
agent-device screenshot ./contact-form.png
agent-device close

Refs are only valid from the latest output: after a --settle command, use the refs in its diff, and take a new snapshot only if the diff omits what you need. Snapshots come from the app's accessibility tree, so clear labels, roles, and test IDs make agent runs more reliable; use screenshots and video as evidence or when accessibility data is poor.

agent-device demo showing Codex using agent-device to create a new contact in the iOS Contacts app from a simple prompt

Add MCP tools to your agent

agent-device mcp starts the official stdio MCP server, exposing the installed commands as structured tools over the same execution path as the CLI:

{
  "mcpServers": {
    "agent-device": {
      "command": "agent-device",
      "args": ["mcp"]
    }
  }
}

See AI Agent Setup for per-client setup and when to prefer plain CLI over MCP.

Script it from Node.js

createAgentDeviceClient() gives Node.js code typed access to the same commands, as model tools in your own agent or from orchestration code:

import { createAgentDeviceClient } from 'agent-device';

const client = createAgentDeviceClient({ session: 'qa-run' });
try {
  await client.apps.open({ app: 'com.apple.Preferences', platform: 'ios' });
  const snapshot = await client.capture.snapshot({ interactiveOnly: true });
  const button = snapshot.nodes.find((node) => node.role === 'button');
  if (button) await client.interactions.press({ ref: button.ref });
} finally {
  await client.sessions.close();
}

See the Node.js API, the runnable examples, and the AI SDK and Eve integration guides.

What agents can do

See Commands for the commands and evidence each target supports.

Diagram of the agentic development loop: humans assign tasks, agents write and review code, agent-device verifies mobile apps, pull requests receive evidence, and bugs or performance issues lead to fixes

What to ask your agent

With the CLI installed, prompts like these work end to end:

Next steps

Where to run agent-device

The same session and evidence model works at every step: the agent explores the app, captures evidence, saves a replay, runs it in CI, and moves onto remote devices.

Path Best for Start with
Local Trying commands and debugging apps on simulators, emulators, physical devices, macOS, and Linux. Follow the Quick Start.
CI/CD Automated pull request and merge validation with replay scripts and captured artifacts. Try the EAS workflow template.
Cloud / remote Linux runners, managed devices, and remote jobs. Set up a remote proxy, connect a device cloud (BrowserStack, AWS Device Farm, Limrun), or contact Callstack for team QA.

How it works

agent-device keeps device state in sessions. It uses a local accessibility bridge for iOS Simulator snapshots and XCTest for iOS interactions, physical iOS, and tvOS; ADB and the snapshot helper on Android; HDC and ArkUI uitest on HarmonyOS; Vega CLI/VDA on the Vega Virtual Device; a local helper on macOS; and AT-SPI on Linux.

Support depth varies by target. Newer backends such as HarmonyOS and Vega OS cover a subset of commands; run agent-device capabilities --platform <platform> to see what a target supports.

Sessions are scoped to the caller's git worktree, and host-local device claims stop parallel agents from taking over each other's simulators and emulators. Inspect ownership without a daemon via agent-device device status, and settle provably dead owners with agent-device device release --stale. The same commands drive hosted devices on BrowserStack, AWS Device Farm, and Limrun.

agent-device uses the inspect-act-verify process from Vercel's agent-browser for mobile, TV, and desktop apps. Basic --platform web support runs agent-browser in the same session and replay system.

FAQ

What is agent-device?

agent-device is a command-line tool and MCP server that lets AI coding agents inspect, control, and verify mobile apps and save evidence for review. It supports iOS, Android, HarmonyOS, TV, web, macOS, and Linux.

Is there an MCP server for mobile app automation?

Yes. agent-device mcp starts the official stdio MCP server. The Quick start above has the client config, and AI Agent Setup covers per-client details.

Does it work with React Native, Expo, Flutter, and native apps?

Yes. agent-device supports native iOS and Android apps, plus React Native, Expo, and Flutter apps on supported targets. The commands and evidence vary by target.

How is it different from mobile MCP servers?

The MCP server is one entry point to the same runtime used by the CLI and typed Node.js API. Sessions, device ownership, selectors, evidence, replay, CI workflows, and cloud routing stay consistent across all three.

Can I build my own agent or QA product on agent-device?

Yes. The typed Node.js client is a public surface over that same runtime, so an agent you build inherits everything above. Start from the Node.js API, AI SDK, or Eve guides.

How is it different from Appium, Detox, or Maestro?

With agent-device, an agent reads app state and chooses each command at run time. Teams use Appium, Detox, and Maestro to write and maintain test suites. agent-device can complement them by saving its runs as .ad scripts or exporting them as strict Maestro YAML.

Can agent-device run in CI?

Yes. Record a run as an .ad script, replay it in CI, and keep the screenshots and logs as artifacts; the EAS workflow template is a working example.

Articles and videos

Articles

Videos

Who uses agent-device?

Teams and developers at Callstack, JPMorgan Chase, Expensify, Shopify, Kindred, Total Wine & More, LegendList, HerLyfe, App & Flow, and others use agent-device.

Documentation

Contributing

See CONTRIBUTING.md.

Made at Callstack

agent-device is open source under the MIT license. Visit agent-device.dev or contact Callstack.

agent-device (callstack/agent-device)

Searching Database…

这是什么?agent-device 让 AI 编程代理能够在真实的移动端和桌面应用上形成反馈闭环:它可以检查、控制、调试和验证 iOS、Android、HarmonyOS、电视平台、Web、macOS 和 Linux 上的应用,并保存证据以供审查。
这是 CLI、MCP 服务器还是库?三者都是,它们基于同一个运行时:一个独立的 CLI、一个内置的 MCP 服务器(可作为工具添加到任何代理客户端中),以及一个带类型的 Node.js API,用于构建你自己的代理或 QA 产品。
我该如何让它运行起来?先安装 CLI,然后自己运行它的 doctor 命令来验证环境配置,再交给代理使用;之后你可以直接通过 CLI 操控应用,用 agent-device mcp 启动 MCP 服务器,或者在 Node.js 中调用 createAgentDeviceClient()。
首先需要安装什么,以及需要哪个 Node 版本?运行 CLI 需要 Node.js 22.12 或更高版本;如果你想使用 Web 自动化功能,则需要 Node.js 24+。
每个平台都能获得同等程度的支持吗?不是——支持深度因目标而异;HarmonyOS 和 Vega OS 等较新的后端只支持部分命令。你可以用 agent-device capabilities --platform 精确查看某个目标支持哪些功能。
它实际覆盖哪些平台和设备类型?iOS、Android 和 HarmonyOS 的模拟器、仿真器和真机,以及 tvOS、Android TV、亚马逊的 Vega OS TV、Web、macOS 和 Linux,每个目标使用不同的原生桥接方式(XCTest、ADB、HDC/ArkUI、Vega CLI、AT-SPI 等)。
agent-device 与 Appium、Detox 或 Maestro 有何不同?使用 agent-device 时,AI 代理会读取实时的应用状态,并在运行时选择每条命令,而不是遵循手写的测试脚本。它仍然可以将运行过程导出为严格的 Maestro YAML,或将其保存为可重放的 .ad 脚本,因此它是对这些框架的补充,而不是替代。
它支持 React Native、Expo 和 Flutter 应用,还是只支持原生应用?它支持原生 iOS 和 Android 应用,也支持在受支持的目标上运行的 React Native、Expo 和 Flutter 应用,包括读取 React Native 组件树和 React 性能分析器数据,以发现不必要的重新渲染。
哪些编程代理可以使用它?它支持 Claude Code、Codex、Cursor、Windsurf、Cline、Goose,以及任何能够运行 CLI 或通过 MCP 连接的代理,也支持使用 AI SDK 或 Eve 构建的自定义代理。
agent-device 会话能在 CI 或远程设备云上运行吗?可以——你可以将一次运行录制为 .ad 重放脚本,并在 CI 中运行它(提供 EAS 工作流模板),或者将相同的命令指向 BrowserStack、AWS Device Farm 或 Limrun 上的托管设备。
What are similar projects?e2e, testsprite-cli, Maestro, vicoa, paseo, rea, ng-native, happy
Creator
callstack
Size
217.8 MB
Stars
5.1K
Age
8mo
Commits · 90 Days