manus_mobile
A Python library for AI-driven mobile device automation using LLMs to control Android devices.
Installation
pip install manus_mobile
Requirements
- Python 3.8+
- Android SDK with ADB configured
- Connected Android device or emulator
Features
- AI-powered mobile automation
- Natural language instructions for mobile device control
- ADB integration for Android devices
- Screenshots and UI hierarchy inspection
- Touch, swipe, type, and other gesture control
- LLM-agnostic: works with any LLM provider
Basic Usage
The library is designed to be LLM-agnostic, allowing you to use any LLM provider:
import asyncio
from manus_mobile import mobile_use
async def call_my_llm(messages, tools=None):
return {
"role": "assistant",
"content": "I'll help automate your mobile device."
}
async def main():
result = await mobile_use(
task="Open the calculator app and press the number 5",
llm_function=call_my_llm
)
print(result)
if __name__ == "__main__":
asyncio.run(main())
Integration with Minion
import asyncio
import sys
from pathlib import Path
from manus_mobile import mobile_use
minion_path = Path('/path/to/minion')
sys.path.append(str(minion_path))
from minion.configs.config import config
from minion.providers import create_llm_provider
from minion.schema.message_types import Message
async def minion_llm_function(messages, tools=None):
"""Function to call minion LLM"""
model_name = "gpt-4o"
llm_config = config.models.get(model_name)
if not llm_config:
raise ValueError(f"Model configuration for '{model_name}' not found")
llm = create_llm_provider(llm_config)
minion_messages = [
Message(role=msg["role"], content=msg["content"])
for msg in messages
]
response = await llm.generate(minion_messages, tools=tools)
return {
"role": "assistant",
"content": response
}
async def main():
result = await mobile_use(
task="Open the calculator app and press the number 5",
llm_function=minion_llm_function
)
print(result)
if __name__ == "__main__":
asyncio.run(main())
ADB Functions
The library provides direct access to ADB functionality:
from manus_mobile import ADBClient
async def main():
adb = ADBClient()
screenshot = await adb.screenshot()
await adb.tap(500, 500)
await adb.inputText("Hello, world!")
await adb.keyPress("KEYCODE_ENTER")
ui = await adb.dumpUI()
if __name__ == "__main__":
asyncio.run(main())
Available Functions
screenshot()
: Take a screenshot of the device
tap()
: Tap at specific coordinates
swipe()
: Perform swipe gestures
inputText()
: Input text
keyPress()
: Press a specific key
dumpUI()
: Get the UI hierarchy for analysis
openApp()
: Open an application by package name
License
MIT