High-Performance Infrastructure & API for Autonomous Android AI Agents
Sub-millisecond Shadow DOM Streaming · Persistent A* Symbolic UI Router · Standardized OpenAI/Anthropic/MCP Tool Schemas · Opt-In Hybrid Vision · Headless Docker-Android Fleets
English | Русская версия (Russian) · Agent Integrations · Benchmarks · Headless Docker Fleets · Habr Launch Article (RU) · Security · Changelog
Traditional Android automation tools were built for brittle QA scripts, and pure Vision-Language Model (VLM) loops burn thousands of tokens and 10+ seconds per task taking screenshots at every tap.
DroidPath is built from the ground up as an execution layer for autonomous AI agents:
- Zero-Roundtrip Multi-Hop Routing (Layer 3 A*): Streams live incremental accessibility diffs (
Shadow DOM) from an on-device Kotlin daemon over loopback TCP, compiles screens into a persistent Spatial Graph (shadow_graph.json), and executes multi-screen workflows locally in Rust with 1 LLM call instead of 4–10. - Plug-and-Play Agent Schemas (OpenAI · Anthropic · MCP): Export ready-to-use JSON function-calling schemas via CLI (
droidpath schemas), live HTTP (GET /schemas/openai.json,/schemas/anthropic.json,/schemas/mcp.json), or static files inschemas/— zero custom parsers required. - Opt-In Hybrid UI Tree + Vision Streaming: Need visual context for icons or canvases? Pass
include_vision: truetoandroid_get_ui_treeto receive both the structured UI tree and a downscaled, heavily compressed JPEG as multimodal MCP content (text+image). Strictly off by default and hard-blocked onFLAG_SECUREscreens. - Self-Correcting Agentic Feedback Loop: When an element isn't found or a route deviates, DroidPath never returns a bare
"Error". It returns structured, PII-redacted telemetry (screen_delta, newly appeared nodes, rankedclosest_candidates, andsuggested_next_actions) so agents recover in 1 turn. - Headless Docker-Android Fleets: Scale parallel autonomous agents inside headless Linux containers with ephemeral non-colliding daemon ports (
--daemon-port 0),ADB_SERVER_SOCKETrouting,sys.boot_completedsynchronization, and gracefulSIGTERMshutdown. - Safety & Privacy by Construction: Mandatory Human-in-the-Loop (
requires_confirmation) gating for hazardous actions (payments, transfers, deletes), automaticFLAG_SECURE/ biometric pause, on-device password masking, and Luhn card / OTP PII redaction before hashing or persistence.
Measured live over USB ADB on an unlocked Google Pixel 10a (com.android.settings, 54 interactive nodes) using node scripts/benchmark_agentic.mjs --mode live --json against compiled target/release/droidpath-mcp:
Live Pixel 10a Hardware Primitives & End-to-End Suite:
- Shadow DOM Read Latency:
0.32 mssteady-state (41.89 mscold connect) vs2,423.9 msadb uiautomator dump(7,575× faster ·10.7 KBvs29.4 KBXML) - Live E2E Multi-Step Navigation (
Display,Battery,About phone):100%success (3/3) at603 msavg Cold-Start (Seed Graph hydration) and561 msavg Warm A* - Opt-In Hybrid Vision (
include_vision: true,540×1212JPEG q45 + 54 nodes):452.33 ms·38.6 KBJPEG vs658.1 ms·235.3 KBraw PNG fromadb screencap -p(6.1× smaller payload)
Multi-Step Architecture & Cost Comparison ($3.00 / 1M input tokens · Replay Model):
| Architecture | Avg LLM Calls / Task | Avg Tokens / Task | Avg Task Time | Est. Cost / 1k Tasks | Live Success Rate |
|---|---|---|---|---|---|
| DroidPath (Shadow DOM + A* Router) | 1.0 | 39 (warm A*) / ~1,135 (cold tree) | 464 ms (561 ms live) | $0.12 | 100% (3/3 live) |
| Pure Vision (Screenshots + VLM) | 4.2 | 7,673 | 9,954 ms | $23.02 (192× higher) | — |
Appium / uiautomator XML |
4.2 | 29,400 | 8,946 ms | $88.20 (735× higher) | — |
Full hardware & replay methodology and reproduction commands are in docs/benchmarks.md.
Prerequisites: Android 8.0+ (API 26+) with USB/Wireless Debugging (no root, no companion APK) and adb (brew install android-platform-tools / winget install Google.PlatformTools / sudo apt install adb).
macOS & Linux:
curl -fsSL https://raw.githubusercontent.com/V0val0x/DroidPath/main/scripts/install.sh | bash -s -- --configure-mcp all --deployWindows (PowerShell):
$env:DROIDPATH_DEPLOY="1"; $env:DROIDPATH_CONFIGURE_MCP="all"; irm https://raw.githubusercontent.com/V0val0x/DroidPath/main/scripts/install.ps1 | iexVerify installation and start the agent API:
droidpath-mcp doctor # Verify ADB, devices, daemon JAR & Spatial Graph
droidpath-mcp --stdio # Run MCP server over stdio (Claude, Cursor, Gemini CLI)
droidpath-mcp --http --port 8766 # Run loopback HTTP/SSE + /schemas/* API
droidpath-mcp schemas --format openai # Print standardized OpenAI function-calling schemafrom langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
async with MultiServerMCPClient({
"droidpath": {"command": "droidpath-mcp", "args": ["--stdio"], "transport": "stdio"}
}) as client:
agent = create_react_agent("anthropic:claude-3-7-sonnet-latest", client.get_tools())
await agent.ainvoke({"messages": [("user", "Open Display settings and enable Night Light.")]})from crewai import Agent, Task, Crew
from crewai_tools import MCPServerAdapter
from mcp import StdioServerParameters
with MCPServerAdapter(StdioServerParameters(command="droidpath-mcp", args=["--stdio"])) as tools:
operator = Agent(role="Android Operator", goal="Execute Android workflows", backstory="...", tools=tools)
task = Task(description="Navigate to Battery Saver via android_navigate_to_node(auto_explore=true).", expected_output="Arrival JSON", agent=operator)
Crew(agents=[operator], tasks=[task]).kickoff()# Export static JSON schemas or fetch live from http://127.0.0.1:8766/schemas/*
droidpath-mcp schemas --format openai > openai-tools.json
droidpath-mcp schemas --format anthropic > anthropic-tools.jsonSee docs/integrations.md for complete Python/TypeScript examples covering OpenAI SDK, Anthropic SDK (with opt-in hybrid vision), LangChain, CrewAI, MCP, and the Self-Correcting Feedback Loop.
Run parallel autonomous Android agents without any GUI or VNC overhead:
export DROIDPATH_AUTH_TOKEN="local-dev-token"
docker compose -f docker-compose.headless.yml up --build -d- Dynamic ephemeral ports (
--daemon-port 0) prevent TCP collisions across parallel workers. DROIDPATH_HEADLESS=1waits forsys.boot_completed=1and enables exponential backoffUiAutomationretries.ADB_SERVER_SOCKETroutes ADB cleanly across Docker networks or to a host ADB server.
See docs/headless-docker.md for fleet scaling and macOS/CI host-ADB recipes.
All 9 tools are exposed consistently across MCP (tools/list), OpenAI (schemas/openai-tools.json), and Anthropic (schemas/anthropic-tools.json):
| Tool | Role |
|---|---|
android_navigate_to_node |
Primary multi-hop A* graph router (auto_explore: true falls back to live discovery). |
android_explore_and_click |
Live Shadow DOM semantic search + bounded auto-scroll + graph edge recording. |
android_get_ui_tree |
Live compact UI tree inspection + opt-in hybrid JPEG vision (include_vision: true, blocked on FLAG_SECURE). |
android_graph_stats |
Read-only Spatial Graph telemetry (vertices, edges, active hash, daemon status). |
android_list_devices |
Enumerates connected USB, Wi-Fi, and emulator ADB targets. |
android_tap_element |
Direct pixel or selector tap with structured feedback telemetry on miss. |
android_swipe |
Zero-fling daemon touch swipe / drag with graph recording. |
android_type_text |
ASCII & Unicode text entry (safe shell quoting / clipboard paste) + optional ENTER. |
android_keyevent |
System & hardware keyevents (HOME, BACK, ENTER, APP_SWITCH, etc.). |
┌─────────────────────────────────────────────────────────────────────────┐
│ AI Agents (LangChain · CrewAI · Claude · Cursor · OpenAI · Anthropic) │
└───────────────────────────────┬─────────────────────────────────────────┘
│ MCP (stdio / HTTP+SSE) + /schemas/*.json
▼
┌─────────────────────────────────────────────────────────────────────────┐
│ droidpath-mcp & droidpath-core (Native Rust · Zero JVM · ~2 MB) │
│ • Layer 3 A* Spatial Graph Router & Persistent shadow_graph.json │
│ • Self-Correcting Agentic Feedback Loop (Delta + PII-Redacted Ranking) │
│ • Hazardous HITL Gatekeeper & FLAG_SECURE Privacy Pause │
└───────────────────────────────┬─────────────────────────────────────────┘
│ Loopback TCP NDJSON (:27189 or ephemeral :0)
▼
┌─────────────────────────────────────────────────────────────────────────┐
│ android-daemon.jar (Single-DEX Kotlin · app_process · No Root/APK) │
│ • Event-Driven UiAutomation Shadow DOM Diffs (<1 ms incremental) │
│ • Native Zero-Fling Input Injection & Opt-In Compressed Hybrid Vision │
└─────────────────────────────────────────────────────────────────────────┘
DroidPath is 100% shadow_graph.json compatible with native macOS AndOnMac and includes an optional Tauri v2 Desktop HUD (apps/droidpath-desktop) for live visual debugging and graph inspection.
# Rust core & MCP server
cargo test -p droidpath-core -p droidpath-mcp
cargo clippy -p droidpath-core -p droidpath-mcp --all-targets -- -D warnings
# Kotlin Android daemon (tests + single-DEX android-daemon.jar)
./android-daemon/scripts/build-dex.sh
node packages/droidpath-cli/scripts/sync-daemon.mjs
# Node CLI
node --test packages/droidpath-cli/test/cli.test.mjs
# Reproducible Agentic Benchmark
node scripts/benchmark_agentic.mjs- Contributing Guide · Code of Conduct · Security Policy · Accessibility
- Licensed under the MIT License.
