$ show droidrun/mobilerun
Mobilerun is a comprehensive CLI and Python SDK framework for controlling Android and iOS devices through natural language commands powered by LLM agents. It orchestrates multi-agent workflows (Manager, Executor, FastAgent) built on llama-index Workflows, with device interaction via ADB (Android) and a separate iOS binary (WebDriverAgent). The system supports multiple LLM providers (OpenAI, Anthropic, Gemini, xAI, DeepSeek, Ollama, etc.), including custom OAuth flows for subscription-based access (Anthropic Claude, Google Code Assist, xAI Grok). It features a configurable agent architecture with Jinja2 prompt templates, macro recording/replay, MCP-based custom tool integration, telemetry (PostHog), tracing (Phoenix, Langfuse), and a rich set of developer tools (device selection, configuration wizard, doctor, credential management). The codebase is well-tested with over 50 test files covering XML parsing, coordinate coordinate contracts, OAuth flows, and agent workflows. While there is some code duplication in OAuth implementations and tight coupling to llama-index internals, the overall architecture is modular and extensible. The project is in active development (version 0.7.0, Beta) with commercial ties to Mobilerun Cloud.
The LLM identified 3 files worth highlighting for reuse:
Provides AuthProfileStore, a thread-safe and process-safe JSON credential store using file locking for atomic reads and writes. It supports nested provider slots (e.g., 'claudeAiOauth', 'grokOauth'), automatic cleanup of expired fields, and deadline-aware writes. This module is independent of the rest of the application (only depends on standard library and a few local config path constants) and can be extracted as a reusable credential persistence utility for any application needing secure, cross-process credential management without a database.
Implements a robust XML tool-calling parser for LLM outputs. It extracts <function_calls>…<invoke>…<parameter> blocks, interleaves thought text, detects malformed or DSML-corrupted markup (e.g., Discord internal XML injection), deduplicates adjacent identical tool calls, and returns a structured ToolCallParseResult with valid/malformed/no_markup status. This module has no internal dependencies beyond standard library and a few shared types, making it directly reusable in any system that needs to parse tool calls from LLM responses.
Provides OAuthLoginDeadline, a context manager for timing OAuth login flows. It includes async browser opening, headless detection, and a deadline mechanism that raises an error if login exceeds a configurable timeout (default 5 minutes). The class is self-contained and can be reused in any OAuth implementation to enforce login deadlines.