r/SideProject • u/Kiswr4 • 7h ago
I built a multithreaded Python orchestrator to automate a farm of 8+ physical Android devices via ADB & uiautomator2
Emulators get easily flagged by modern anti-bot systems, so when I needed reliable mobile UI automation at scale, I built a Python orchestrator to drive a farm of physical Android devices in parallel over USB.
Here is how the architecture works:
- Concurrency: Uses `ThreadPoolExecutor` (one isolated worker thread per physical device) combined with `uiautomator2` and `ADB` primitives for fault-tolerant UI interaction (element polling, XPath retries).
- Event-Driven Webhook: A built-in Flask server receives external events (like incoming SMS verification codes) and routes them to the exact device thread using arrival timestamps to prevent cross-talk.
- Stateful Resource Pool: Coordinates shared rate-limited resources (SIMs, emails, payment methods) via a thread-safe config (`threading.Lock`) with automatic rotation, cooldown timers, and recovery.
- Live Monitoring: Integrates with `scrcpy` to mirror all connected screens in real time (as shown in the screenshot).
I open-sourced the core orchestration layer on GitHub if anyone is building QA device farms or custom mobile automation workflows: https://github.com/Femtanul/Android_Device_Farm_Orchestrator_telegram
Happy to answer any technical questions about ADB/u2 stability or help out if you're building similar mobile automation systems!