🤖 VisionBot-SDK: Real-Time Mobile Automation Framework
VisionBot-SDK is a high-performance, developer-first Android automation engine in Python. It provides a lightweight, robust, and zero-bloat alternative to heavier mobile testing platforms like Appium.
🚀 Key Advantages
- ⚡ <1ms Input Latency: Directly injects taps and swipes over an Android Monkey socket, bypassing the 300ms Java VM overhead of standard
input tap. - 📸 Non-Blocking Screencapping: Background thread-safe frame streaming decodes device frames continuously into an active buffer using binary-safe pipes.
- 📐 Bounding-Box Coordinate Autoscale: Normalizes screen layout coordinates from
0.0to1.0. The SDK automatically scales actions to match the actual display resolution. - 🧠 Extensible State Machine: Replaces spaghetti code loops and fragile
time.sleep()statements with an event-driven Finite State Machine (FSM) framework. - 🖥️ Reusable Visual Dashboard: An optional, dark-themed GUI submodule (
visionbot.gui.VisionBotDashboard) that dynamically renders live viewports, sliders, and telemetry statistics.
🛠️ Getting Started
1. Prerequisites
- Python 3.8+
- ADB (Android Debug Bridge) installed and added to your system
PATH. - A connected Android device or emulator (verify with
adb devices).
2. Installation
Install the required packages in your local environment:
pip install -r requirements.txt
💻 Quick Start Example
This code demonstrates how to connect to a device, stream the screen at 15 FPS, check for visual elements, and trigger clicks with absolute ease.
from visionbot import AndroidDevice, TemplateMatcher
from visionbot.input import FastInput
import time
# 1. Automatically connect to the active device/emulator
device = AndroidDevice(capture_fps=15, downscale_factor=1.0)
# 2. Start high-speed low-latency touch client (Port 1080)
fast_input = FastInput(device)
# 3. Initialize CV Template Matcher
play_btn = TemplateMatcher("templates/play_button.png")
print("Waiting for Play button to appear on screen...")
while True:
frame = device.get_frame()
if frame is not None:
# Search for the button with 85% confidence threshold
match = play_btn.match(frame, threshold=0.85)
if match:
x, y = match
print(f"Play button found at pixel: {x}, {y}. Tapping!")
device.tap(x, y)
break
time.sleep(0.05)
🌀 Building Robust Bots with the State Machine (FSM)
The recommended pattern is to structure your automations into modular State classes. Each state performs one action and routes to the next state based on real-time screen assessments.
Example FSM Design
import time
from visionbot import State, StateMachine, AndroidDevice
from visionbot.vision import get_color_ratio
LOW_CYAN, UP_CYAN = (80, 60, 160), (110, 255, 255)
class StateExploring(State):
def on_enter(self, machine):
print("Walking to trigger encounter...")
machine.device.tap(0.94, 0.46) # Auto-scales normalized float coordinate!
def execute(self, machine):
frame = machine.device.get_frame()
if frame is not None:
# Check for battle Run button (crop box on left side of screen)
cyan_ratio = get_color_ratio(frame, LOW_CYAN, UP_CYAN, region=(0.05, 0.1, 0.15, 0.25))
if cyan_ratio > 0.08:
return StateInBattle
return None
class StateInBattle(State):
def on_enter(self, machine):
print("In Battle! Transitioning to action...")
machine.stop() # Stops execution loop
# Run FSM Orchestrator
device = AndroidDevice()
fsm = StateMachine(device)
fsm.register(StateExploring())
fsm.register(StateInBattle())
fsm.start(StateExploring)
fsm.run(tick_rate_seconds=0.05)
For full battle-ready examples, check out:
- examples/encounter_bot.py (Console version)
- examples/encounter_bot_gui.py (Visual GUI version utilizing the generic dashboard module)
Metadata
Release files for visionbot-sdk 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| visionbot_sdk-0.1.0.tar.gz | 17.1 kB | Without provenance | Details for visionbot_sdk-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| visionbot_sdk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for visionbot_sdk-0.1.0-py3-none-any.whl |
Total release size: 33.2 kB
Release files / visionbot_sdk-0.1.0.tar.gz
| Download URL | visionbot_sdk-0.1.0.tar.gz |
|---|---|
| Size | 17.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c1d6919f4cc9e89c68fd6fcc62640385358444de1f9698a655444d5cb25a3b7
|
|
BLAKE2b-256 checksum How to use checksums |
fbb07024410ee60501c2d33023016fd68296a111aba963df1404eed4fed48b34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.5
|
Release files / visionbot_sdk-0.1.0-py3-none-any.whl
| Download URL | visionbot_sdk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 16.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2ec751e81b773d71adf2df186714654b087e7b8e07d9abdd20665f504c19ffdc
|
|
BLAKE2b-256 checksum How to use checksums |
b483d96f0ba9f8d220e327f97a11e620439935e8ce877723c0c46f9d773fa1d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.5
|
Security for visionbot-sdk 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.