A library for controlling mobile applications via native debugging bridges
Project description
App Use - AI Control for Mobile Apps
Warning: This project is currently under active development. APIs will change! Currently in experimental stages.
App Use is the easiest way to connect AI agents with mobile applications. It enables AI to control your mobile apps through native debugging bridges, providing a powerful yet simple interface for app automation.
Currently, App Use focuses on Flutter apps via the Dart VM Service, with plans to expand to other frameworks like React Native in the future.
Overview
App Use allows you to automate interactions with mobile apps, such as:
- Clicking buttons and interactive widgets
- Entering text into fields
- Scrolling and navigating screens
- Building AI-powered agents that can interact with mobile app UIs
Perfect for testing, automation, and AI agent applications.
Getting Started
Installation
Install the package using pip:
pip install -r requirements.txt
Quick Start with LLM Agents
Use AI agents to intelligently interact with your mobile app:
import asyncio
import os
from dotenv import load_dotenv
from langchain_openai import ChatOpenAI
from app_use.agent.service import Agent
from app_use.app.app import App
# Load environment variables (like OPENAI_API_KEY)
load_dotenv()
async def main():
# WebSocket URI for a running Flutter app
VM_SERVICE_URI = "ws://127.0.0.1:50505/ws"
# Set up your LLM
llm = ChatOpenAI(
api_key=os.environ.get("OPENAI_API_KEY"),
model="gpt-4o", # or any other model
temperature=0
)
# Create an App instance to connect to the Flutter application
app = App(vm_service_uri=VM_SERVICE_URI)
# Create an agent to control the app
agent = Agent(
task="Explore the app and find all buttons, then click on the Login button if it exists.",
llm=llm,
app=app,
)
try:
# Run the agent
history = await agent.run()
# Print results
if history.is_successful():
print("✅ Agent successfully completed the task!")
else:
print("⚠️ Agent couldn't complete the task.")
# Show the final result/message
print(f"Final result: {history.final_result()}")
except Exception as e:
print(f"❌ Error: {e}")
finally:
# Make sure to close resources
await agent.close()
app.close()
if __name__ == "__main__":
asyncio.run(main())
### Setting Up a Flutter App for Control
> Currently, App Use supports Flutter apps, with more frameworks coming soon.
1. Makesure to enable the flutter driver extension in your mobile app
```dart
import 'package:flutter_driver/driver_extension.dart';
void main() {
enableFlutterDriverExtension();
runApp(const HomeScreen());
}
- Run your Flutter app with the VM service enabled:
flutter run
- Look for the VM service URI in the console output, which looks like:
ws://127.0.0.1:50505/ws
Features
- Smart Widget Interaction: Automatically attempts to interact with parent or child widgets if direct interaction fails
- Automatic Resource Management: Proper cleanup of connections and services
- Context Manager Support: Use the
withstatement for proper resource handling - Intelligent Port Management: Automatically handles port conflicts
- Extensive UI Tree Access: Full access to the application's UI tree
- Flexible Element Finding: Find UI elements by key, text, type, or hierarchical position
Extending App Use
You can extend App Use by:
- Creating custom Agent implementations
- Adding new widget interaction patterns
- Adding support for additional app frameworks
- Building domain-specific UI automation tools
Community & Support
Contributions are welcome! Please feel free to submit a Pull Request.
App Use is actively maintained and designed to make mobile app control as simple and reliable as possible.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file app_use-0.0.1.dev5.tar.gz.
File metadata
- Download URL: app_use-0.0.1.dev5.tar.gz
- Upload date:
- Size: 44.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2eb69e1a2a9972b2c8a28ab553cae469ba1e234d9f8498df3b2260bb4b2b5ad0
|
|
| MD5 |
48282c721caf2934ce1df43e95c10043
|
|
| BLAKE2b-256 |
f58cae8cd023b7675b5eb49efba9881df08d8667a65ce422206a3bf21966f4d5
|
File details
Details for the file app_use-0.0.1.dev5-py3-none-any.whl.
File metadata
- Download URL: app_use-0.0.1.dev5-py3-none-any.whl
- Upload date:
- Size: 46.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1336880dca6d59d5b981c956a8e0cae3cb692e2fd48ba42d53bdb691166e9398
|
|
| MD5 |
4444aaad185f0f9eb0c0709d81eaaf0f
|
|
| BLAKE2b-256 |
c80c8382600ca5ffc881515ab0e6056a4e819063a829b008aeab0fc86e919b58
|