A CLI tool that gives AI agents the context and control they need to interact with mobile applications. Native Agent provides a unified interface for driving Android and iOS devices — tapping, typing, swiping, taking screenshots, and more — all through simple shell commands backed by Appium.
Built for agentic workflows where an AI (like Claude) needs to see and operate a mobile app, but works just as well for scripting and manual testing.
Run the install script to set up everything automatically:
curl -fsSL https://raw.githubusercontent.com/jjcavallo5/native-agent/main/install.sh | shThis will:
- Ensure Node.js >= 18 is installed
- Install the
native-agentCLI globally via npm - Install Appium and the appropriate drivers (UiAutomator2 for Android, XCUITest for iOS on macOS)
- Verify that platform prerequisites (Android SDK, Xcode, Java) are in place
Android
- Android SDK with
ANDROID_HOMEset - At least one AVD (Android Virtual Device) configured
- Java runtime
- ADB
iOS (macOS only)
- Xcode with iOS Simulator SDK
xcrun simctlavailable on PATH
# 1. Start a device
native-agent device start -p android
# 2. Start the server (connects Appium to the device)
native-agent server start --platform android
# 3. Take a screenshot to see what's on screen
native-agent view
# 4. Interact with the device
native-agent click "Settings"
native-agent text "hello world" --target "Search"
native-agent key Enter
# 5. When you're done
native-agent server stop
native-agent device stopStart the native-agent server, which launches Appium and connects to the target device.
| Option | Description | Default |
|---|---|---|
--port <port> |
Port for the native-agent server | 8647 |
--headless |
Run in headless mode (no GUI) | false |
--device <id> |
Target a specific device by ID | auto-detect |
-p, --platform <platform> |
android or ios |
android |
native-agent server start --platform ios --port 9000Stop the running native-agent server.
| Option | Description | Default |
|---|---|---|
--port <port> |
Port the server is running on | 8647 |
native-agent server stopStart an emulator (Android) or simulator (iOS).
| Option | Description | Default |
|---|---|---|
-p, --platform <platform> |
android or ios (required) |
— |
--headless |
Launch without a GUI window | false |
native-agent device start -p android --headlessStop the running emulator or simulator.
native-agent device stopFind an element by its text label and click it.
| Argument / Option | Description |
|---|---|
<element text> |
Text of the element to click |
--index <n> |
If multiple matches, click the nth one |
native-agent click "Sign In"
native-agent click "Item" --index 2Tap at a specific point on the screen using screenshot pixel coordinates. Screenshots are always 768px wide — use the pixel position from the screenshot image directly. The server converts to device coordinates automatically.
| Option | Description |
|---|---|
-x <value> |
X pixel coordinate in screenshot (768px wide) |
-y <value> |
Y pixel coordinate in screenshot |
native-agent tap -x 384 -y 832Type text into an input field.
| Argument / Option | Description |
|---|---|
<text> |
The text to type |
-t, --target <value> |
Label of the input field to type into |
--focused |
Type into the currently focused element |
native-agent text "[email protected]" --target "Email"
native-agent text "password123" --focusedPress a key.
Supported keys: Enter, Back, Home, Tab, Delete, Up, Down, Left, Right, Space, Escape
native-agent key Enter
native-agent key BackSwipe across the screen using screenshot pixel coordinates. Useful for scrolling. Screenshots are always 768px wide — use pixel positions from the screenshot image directly.
| Option | Description |
|---|---|
--startX |
Starting X pixel coordinate in screenshot |
--startY |
Starting Y pixel coordinate in screenshot |
--endX |
Ending X pixel coordinate in screenshot |
--endY |
Ending Y pixel coordinate in screenshot |
# Scroll down (on a 768x1664 screenshot)
native-agent swipe --startX 384 --startY 1165 --endX 384 --endY 499
# Scroll right
native-agent swipe --startX 154 --startY 832 --endX 614 --endY 832Take a screenshot of the current device state. The image is resized to 768px wide for efficient consumption by AI agents.
| Option | Description | Default |
|---|---|---|
-o, --output <path> |
Save screenshot to a custom path | /tmp/native-agent-screenshots/<timestamp>.png |
native-agent view
native-agent view -o ./current-state.pngGet the device viewport dimensions in pixels.
native-agent get-size
# Output: { width: 1080, height: 2400 }Launch an app by its identifier.
| Argument | Description |
|---|---|
<appId> |
Bundle ID (iOS) or package name (Android) |
native-agent open com.android.settings
native-agent open com.apple.mobilesafariNative Agent is a monorepo with three packages:
native-agent/
├── apps/cli # CLI entry point (commander.js)
├── packages/server # Express server + Appium WebDriverIO integration
└── packages/devices # Platform-specific emulator/simulator management
The CLI sends HTTP requests to a local Express server (default port 8647), which translates them into Appium/WebDriverIO commands against the connected device. Appium runs on port 4723.
Native Agent is designed to be used as a tool by AI agents. The CLI commands are simple and composable, and native-agent view returns screenshots that multimodal models can interpret. A typical agent loop looks like:
native-agent view— see the current screen- Decide what to do based on the screenshot
- Execute an action (
click,text,swipe, etc.) - Repeat
This repo includes a SKILL.md that teaches AI agents how to use the native-agent HTTP API. Install it for your agent of choice:
| Agent | Install command |
|---|---|
| Claude Code | /plugin install github:jjcavallo5/native-agent |
| Codex | $skill-installer github:jjcavallo5/native-agent |
| OpenCode | Automatically discovers skills installed by Claude Code or Codex |
Once installed, start the server (native-agent server start) and then ask your agent to interact with the device — the skill provides all the instructions it needs.