droidrun 0.2.0__py3-none-any.whl → 0.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. droidrun/__init__.py +16 -11
  2. droidrun/__main__.py +1 -1
  3. droidrun/adb/__init__.py +3 -3
  4. droidrun/adb/device.py +1 -1
  5. droidrun/adb/manager.py +2 -2
  6. droidrun/agent/__init__.py +6 -0
  7. droidrun/agent/codeact/__init__.py +2 -4
  8. droidrun/agent/codeact/codeact_agent.py +330 -235
  9. droidrun/agent/codeact/events.py +12 -20
  10. droidrun/agent/codeact/prompts.py +0 -52
  11. droidrun/agent/common/default.py +5 -0
  12. droidrun/agent/common/events.py +4 -0
  13. droidrun/agent/context/__init__.py +23 -0
  14. droidrun/agent/context/agent_persona.py +15 -0
  15. droidrun/agent/context/context_injection_manager.py +66 -0
  16. droidrun/agent/context/episodic_memory.py +15 -0
  17. droidrun/agent/context/personas/__init__.py +11 -0
  18. droidrun/agent/context/personas/app_starter.py +44 -0
  19. droidrun/agent/context/personas/default.py +95 -0
  20. droidrun/agent/context/personas/extractor.py +52 -0
  21. droidrun/agent/context/personas/ui_expert.py +107 -0
  22. droidrun/agent/context/reflection.py +20 -0
  23. droidrun/agent/context/task_manager.py +124 -0
  24. droidrun/agent/droid/__init__.py +2 -2
  25. droidrun/agent/droid/droid_agent.py +269 -325
  26. droidrun/agent/droid/events.py +28 -0
  27. droidrun/agent/oneflows/reflector.py +265 -0
  28. droidrun/agent/planner/__init__.py +2 -4
  29. droidrun/agent/planner/events.py +9 -13
  30. droidrun/agent/planner/planner_agent.py +288 -0
  31. droidrun/agent/planner/prompts.py +33 -53
  32. droidrun/agent/utils/__init__.py +3 -0
  33. droidrun/agent/utils/async_utils.py +1 -40
  34. droidrun/agent/utils/chat_utils.py +265 -48
  35. droidrun/agent/utils/executer.py +49 -14
  36. droidrun/agent/utils/llm_picker.py +14 -10
  37. droidrun/agent/utils/trajectory.py +184 -0
  38. droidrun/cli/__init__.py +1 -1
  39. droidrun/cli/logs.py +283 -0
  40. droidrun/cli/main.py +364 -441
  41. droidrun/tools/__init__.py +5 -10
  42. droidrun/tools/{actions.py → adb.py} +381 -412
  43. droidrun/tools/ios.py +596 -0
  44. droidrun/tools/tools.py +95 -0
  45. droidrun-0.3.1.dist-info/METADATA +150 -0
  46. droidrun-0.3.1.dist-info/RECORD +50 -0
  47. droidrun/agent/planner/task_manager.py +0 -355
  48. droidrun/agent/planner/workflow.py +0 -371
  49. droidrun/tools/device.py +0 -29
  50. droidrun/tools/loader.py +0 -60
  51. droidrun-0.2.0.dist-info/METADATA +0 -373
  52. droidrun-0.2.0.dist-info/RECORD +0 -32
  53. {droidrun-0.2.0.dist-info → droidrun-0.3.1.dist-info}/WHEEL +0 -0
  54. {droidrun-0.2.0.dist-info → droidrun-0.3.1.dist-info}/entry_points.txt +0 -0
  55. {droidrun-0.2.0.dist-info → droidrun-0.3.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,373 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: droidrun
3
- Version: 0.2.0
4
- Summary: A framework for controlling Android devices through LLM agents
5
- Project-URL: Homepage, https://github.com/droidrun/droidrun
6
- Project-URL: Bug Tracker, https://github.com/droidrun/droidrun/issues
7
- Project-URL: Documentation, https://docs.droidrun.ai/
8
- Author-email: Niels Schmidt <niels.schmidt@droidrun.ai>
9
- License: MIT
10
- License-File: LICENSE
11
- Classifier: Development Status :: 4 - Beta
12
- Classifier: Intended Audience :: Developers
13
- Classifier: Intended Audience :: Information Technology
14
- Classifier: Intended Audience :: Science/Research
15
- Classifier: License :: OSI Approved :: MIT License
16
- Classifier: Programming Language :: Python :: 3
17
- Classifier: Programming Language :: Python :: 3.10
18
- Classifier: Programming Language :: Python :: 3.11
19
- Classifier: Topic :: Communications :: Chat
20
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
- Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
22
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
- Classifier: Topic :: Software Development :: Quality Assurance
24
- Classifier: Topic :: Software Development :: Testing
25
- Classifier: Topic :: Software Development :: Testing :: Acceptance
26
- Classifier: Topic :: System :: Emulators
27
- Classifier: Topic :: Utilities
28
- Requires-Python: >=3.10
29
- Requires-Dist: aiofiles>=23.0.0
30
- Requires-Dist: anthropic>=0.7.0
31
- Requires-Dist: arize-phoenix
32
- Requires-Dist: click>=8.1.0
33
- Requires-Dist: llama-index
34
- Requires-Dist: llama-index-callbacks-arize-phoenix
35
- Requires-Dist: llama-index-llms-anthropic
36
- Requires-Dist: llama-index-llms-deepseek
37
- Requires-Dist: llama-index-llms-gemini
38
- Requires-Dist: llama-index-llms-ollama
39
- Requires-Dist: llama-index-llms-openai
40
- Requires-Dist: openai>=1.0.0
41
- Requires-Dist: pillow>=10.0.0
42
- Requires-Dist: pydantic>=2.0.0
43
- Requires-Dist: python-dotenv>=1.0.0
44
- Requires-Dist: rich>=13.0.0
45
- Provides-Extra: dev
46
- Requires-Dist: black>=23.0.0; extra == 'dev'
47
- Requires-Dist: mypy>=1.0.0; extra == 'dev'
48
- Requires-Dist: ruff>=0.1.0; extra == 'dev'
49
- Description-Content-Type: text/markdown
50
-
51
-
52
- <picture>
53
- <source media="(prefers-color-scheme: dark)" srcset="./static/droidrun-dark.png">
54
- <source media="(prefers-color-scheme: light)" srcset="./static/droidrun.png">
55
- <img src="./static/droidrun.png" width="full">
56
- </picture>
57
-
58
- [![GitHub stars](https://img.shields.io/github/stars/droidrun/droidrun?style=social)](https://github.com/droidrun/droidrun/stargazers)
59
- [![Discord](https://img.shields.io/discord/1360219330318696488?color=7289DA&label=Discord&logo=discord&logoColor=white)](https://discord.gg/ZZbKEZZkwK)
60
- [![Documentation](https://img.shields.io/badge/Documentation-📕-blue)](https://docs.droidrun.ai)
61
- [![Twitter Follow](https://img.shields.io/twitter/follow/droid_run?style=social)](https://x.com/droid_run)
62
-
63
-
64
- DroidRun is a powerful framework for controlling Android devices through LLM agents. It allows you to automate Android device interactions using natural language commands.
65
-
66
- ## ✨ Features
67
-
68
- - Control Android devices with natural language commands
69
- - Supports multiple LLM providers (OpenAI, Anthropic, Gemini, Ollama, DeepSeek)
70
- - Planning capabilities for complex multi-step tasks
71
- - LlamaIndex integration for flexible LLM interactions
72
- - Easy to use CLI with enhanced debugging features
73
- - Extendable Python API for custom automations
74
- - Screenshot analysis for visual understanding of the device
75
- - Execution tracing with Arize Phoenix
76
-
77
- ## 📦 Installation
78
-
79
- ### 🚀 Option 1: Install from PyPI (Recommended)
80
-
81
- ```bash
82
- pip install droidrun
83
- ```
84
-
85
- ### 🔧 Option 2: Install from Source
86
-
87
- ```bash
88
- git clone https://github.com/droidrun/droidrun.git
89
- cd droidrun
90
- pip install -e .
91
- ```
92
-
93
- ## 📋 Prerequisites
94
-
95
- 1. An Android device connected via USB or ADB over TCP/IP
96
- 2. ADB (Android Debug Bridge) installed and configured
97
- 3. DroidRun Portal app installed on your Android device
98
- 4. API key for at least one of the supported LLM providers:
99
- - OpenAI
100
- - Anthropic
101
- - Google Gemini
102
-
103
- ### 🔧 Setting up ADB
104
-
105
- ADB (Android Debug Bridge) is required for DroidRun to communicate with your Android device:
106
-
107
- 1. **Install ADB**:
108
- - **Windows**: Download [Android SDK Platform Tools](https://developer.android.com/studio/releases/platform-tools) and extract the ZIP file
109
- - **macOS**: `brew install android-platform-tools`
110
- - **Linux**: `sudo apt install adb` (Ubuntu/Debian) or `sudo pacman -S android-tools` (Arch)
111
-
112
- 2. **Add ADB to your PATH**:
113
- - **Windows**: Add the path to the extracted platform-tools folder to your system's PATH environment variable
114
- - **macOS/Linux**: Add the following to your ~/.bashrc or ~/.zshrc:
115
- ```bash
116
- export PATH=$PATH:/path/to/platform-tools
117
- ```
118
-
119
- 3. **Verify ADB installation**:
120
- ```bash
121
- adb version
122
- ```
123
-
124
- 4. **Enable USB debugging on your Android device**:
125
- - Go to **Settings → About phone**
126
- - Tap **Build number** 7 times to enable Developer options
127
- - Go to **Settings → System → Developer options** (location may vary by device)
128
- - Enable **USB debugging**
129
-
130
- ## 🛠️ Setup
131
-
132
- ### 📱 1. Install DroidRun Portal App
133
-
134
- DroidRun requires the DroidRun Portal app to be installed on your Android device:
135
-
136
- 1. Download the DroidRun Portal APK from the [DroidRun Portal repository](https://github.com/droidrun/droidrun-portal)
137
- 2. Use DroidRun to install the portal app:
138
- ```bash
139
- droidrun setup --path=/path/to/droidrun-portal.apk
140
- ```
141
-
142
- Alternatively, you can use ADB to install it manually:
143
- ```bash
144
- adb install -r /path/to/droidrun-portal.apk
145
- ```
146
-
147
- ### 🔑 2. Set up API keys
148
-
149
- Create a `.env` file in your working directory or set environment variables:
150
-
151
- ```bash
152
- # Choose at least one of these based on your preferred provider
153
- export OPENAI_API_KEY="your_openai_api_key_here"
154
- export ANTHROPIC_API_KEY="your_anthropic_api_key_here"
155
- export GEMINI_API_KEY="your_gemini_api_key_here"
156
- export DEEPSEEK_API_KEY="your_deepseek_api_key_here"
157
- # For Ollama, no API key is needed
158
- ```
159
-
160
- To load the environment variables from the `.env` file:
161
-
162
- ```bash
163
- source .env
164
- ```
165
-
166
- ### 📱 3. Connect to an Android device
167
-
168
- Connect your device via USB or set up wireless ADB:
169
-
170
- ```bash
171
- # List connected devices
172
- droidrun devices
173
-
174
- # Connect to a device over Wi-Fi
175
- droidrun connect 192.168.1.100
176
- ```
177
-
178
- ## 💻 Using the CLI
179
-
180
- DroidRun's CLI is designed to be simple and intuitive. You can use it in two ways:
181
-
182
- ### 🚀 Basic Usage
183
-
184
- ```bash
185
- # Format: droidrun "task description" [options]
186
- droidrun "Open the settings app"
187
- ```
188
-
189
- ### 🔌 With Provider Options
190
-
191
- ```bash
192
- # Using OpenAI
193
- droidrun "Open the calculator app" --provider OpenAI --model gpt-4o-mini
194
-
195
- # Using Anthropic
196
- droidrun "Check the battery level" --provider Anthropic --model claude-3-sonnet-20240229
197
-
198
- # Using Gemini
199
- droidrun "Install and open Instagram" --provider Gemini --model models/gemini-2.5-pro-preview-05-06
200
-
201
- # Using Ollama (local)
202
- droidrun "Check battery level" --provider Ollama --model llama2
203
- ```
204
-
205
- ### ⚙️ Additional Options
206
-
207
- ```bash
208
- # Specify a particular device
209
- droidrun "Open Chrome and search for weather" --device abc123
210
-
211
- # Enable vision capabilities
212
- droidrun "Analyze what's on the screen" --vision
213
-
214
- # Enable planning for complex tasks
215
- droidrun "Find and download a specific app" --reasoning
216
-
217
- # Enable execution tracing (requires Phoenix server running)
218
- droidrun "Debug this complex workflow" --tracing
219
-
220
- # Set maximum number of steps
221
- droidrun "Open settings and enable dark mode" --steps 20
222
- ```
223
-
224
- ## 📝 Creating a Minimal Test Script
225
-
226
- If you want to use DroidRun in your Python code rather than via the CLI, you can create a minimal test script:
227
-
228
- ```python
229
- #!/usr/bin/env python3
230
- import asyncio
231
- from droidrun.agent.droid import DroidAgent
232
- from droidrun.agent.utils.llm_picker import load_llm
233
- from droidrun.tools import load_tools
234
-
235
- async def main():
236
- # Load tools
237
- tool_list, tools_instance = await load_tools()
238
-
239
- # Load LLM
240
- llm = load_llm(
241
- provider_name="Gemini", # Case sensitive: OpenAI, Ollama, Anthropic, Gemini, DeepSeek
242
- model="models/gemini-2.5-pro-preview-05-06",
243
- temperature=0.2
244
- )
245
-
246
- # Create and run the agent
247
- agent = DroidAgent(
248
- goal="Open the Settings app and check the Android version",
249
- llm=llm,
250
- tools_instance=tools_instance,
251
- tool_list=tool_list,
252
- vision=True, # Enable vision for screen analysis
253
- reasoning=True # Enable planning for complex tasks
254
- )
255
-
256
- # Run the agent
257
- result = await agent.run()
258
- print(f"Success: {result['success']}")
259
- if result.get('reason'):
260
- print(f"Reason: {result['reason']}")
261
-
262
- if __name__ == "__main__":
263
- asyncio.run(main())
264
- ```
265
-
266
- You can also use LlamaIndex directly:
267
-
268
- ```python
269
- import asyncio
270
- from llama_index.llms.gemini import Gemini
271
- from droidrun.agent.droid import DroidAgent
272
- from droidrun.tools import load_tools
273
-
274
- async def main():
275
- # Load tools
276
- tool_list, tools_instance = await load_tools()
277
-
278
- # Create LlamaIndex LLM directly
279
- llm = Gemini(
280
- model="models/gemini-2.5-pro-preview-05-06",
281
- temperature=0.2
282
- )
283
-
284
- # Create and run the agent
285
- agent = DroidAgent(
286
- goal="Open the Settings app and check the Android version",
287
- llm=llm,
288
- tools_instance=tools_instance,
289
- tool_list=tool_list
290
- )
291
-
292
- # Run the agent
293
- result = await agent.run()
294
- print(f"Success: {result['success']}")
295
-
296
- if __name__ == "__main__":
297
- asyncio.run(main())
298
- ```
299
-
300
- ## ❓ Troubleshooting
301
-
302
- ### 🔑 API Key Issues
303
-
304
- If you encounter errors about missing API keys, ensure:
305
- 1. You've set the correct environment variable for your chosen provider
306
- 2. The API key is valid and has appropriate permissions
307
- 3. You've correctly sourced your `.env` file or exported the variables manually
308
-
309
- ### 📱 Device Connection Issues
310
-
311
- If you have trouble connecting to your device:
312
- 1. Ensure USB debugging is enabled on your Android device
313
- 2. Check that your device is recognized by ADB: `adb devices`
314
- 3. For wireless connections, make sure your device and computer are on the same network
315
-
316
- ### 🤖 LLM Provider Selection
317
-
318
- If DroidRun is using the wrong LLM provider:
319
- 1. Explicitly specify the provider with `--provider` (in CLI) or `llm_provider=` (in code)
320
- 2. When using Gemini, ensure you have set `GEMINI_API_KEY` and specified `--provider gemini`
321
-
322
- ### 📊 Tracing Issues
323
-
324
- If you're using the tracing feature:
325
- 1. Make sure to install Arize Phoenix: `pip install "arize-phoenix[llama-index]"`
326
- 2. Start the Phoenix server before running your command: `phoenix serve`
327
- 3. Access the tracing UI at http://localhost:6006 after execution
328
-
329
- ### 🎬 Demo Videos
330
-
331
- 1. **Shopping Assistant**: Watch how DroidRun searches Amazon for headphones and sends the top 3 products to a colleague on WhatsApp.
332
-
333
- Prompt: "Go to Amazon, search for headphones and write the top 3 products to my colleague on WhatsApp."
334
-
335
- [![Shopping Assistant Demo](https://img.youtube.com/vi/VQK3JcifgwU/0.jpg)](https://www.youtube.com/watch?v=VQK3JcifgwU)
336
-
337
- 2. **Social Media Automation**: See DroidRun open X (Twitter) and post "Hello World".
338
-
339
- Prompt: "Open up X and post Hello World."
340
-
341
- [![Social Media Automation Demo](https://img.youtube.com/vi/i4-sDQhzt_M/0.jpg)](https://www.youtube.com/watch?v=i4-sDQhzt_M)
342
-
343
- ## 💡 Example Use Cases
344
-
345
- - Automated UI testing of Android applications
346
- - Creating guided workflows for non-technical users
347
- - Automating repetitive tasks on Android devices
348
- - Remote assistance for less technical users
349
- - Exploring Android UI with natural language commands
350
-
351
- ## 🗺️ Roadmap
352
-
353
- ### 🤖 Agent:
354
- - **Improve memory**: Enhance context retention for complex multi-step tasks
355
- - **Expand planning capabilities**: Add support for more complex reasoning strategies
356
- - **Add Integrations**: Support more LLM providers and agent frameworks (LangChain, Agno etc.)
357
-
358
- ### ⚙️ Automations:
359
- - **Create Automation Scripts**: Generate reusable scripts from agent actions that can be scheduled or shared
360
-
361
- ### ☁️ Cloud:
362
- - **Hosted version**: Remote device control via web interface without local setup
363
- - **Add-Ons**: Marketplace for extensions serving specific use cases
364
- - **Proxy Hours**: Cloud compute time with tiered pricing for running automations
365
- - **Droidrun AppStore**: Simple installation of Apps on your hosted devices
366
-
367
- ## 👥 Contributing
368
-
369
- Contributions are welcome! Please feel free to submit a Pull Request.
370
-
371
- ## 📄 License
372
-
373
- This project is licensed under the MIT License - see the LICENSE file for details.
@@ -1,32 +0,0 @@
1
- droidrun/__init__.py,sha256=LhCCBKH9M1PJG3jAsCG84zyK2WkbTR3WI58LrzuSXMA,659
2
- droidrun/__main__.py,sha256=ganC_pSTITSVwVmdEfd6qEkrHutt3UVoalXTBianP2w,97
3
- droidrun/adb/__init__.py,sha256=tBhoSFmkevb_xQcCfdrigPut9zAU1J4bagpT-TgBj8c,221
4
- droidrun/adb/device.py,sha256=yMndMpO-R0lPmLoZANr-aou8HldyD3TLCP9J5ZjJJao,10992
5
- droidrun/adb/manager.py,sha256=9xohDCbw8XvWW2Esglpcnk9H24hKJG3e9SkCBiFWlDI,2704
6
- droidrun/adb/wrapper.py,sha256=Yz3_JSIidq-5bf-t0UfawTutMaLrINS_1Y15m_Uss4g,7093
7
- droidrun/agent/codeact/__init__.py,sha256=B1wskXGB-xeGCZnUIZxBaEXz1f0YSxAHRljKqMH6nXQ,308
8
- droidrun/agent/codeact/codeact_agent.py,sha256=lyJfBmPshR50-k6wtrOBe3IwSJueiDBpuiGNaWxoagA,16015
9
- droidrun/agent/codeact/events.py,sha256=4O0fJWu_DwJoJF8SqQr8CpALsaSKNOGKksVS9yWWBsY,934
10
- droidrun/agent/codeact/prompts.py,sha256=vRt0z34ND-p1RGkfXbp96Q_-z8HbHmjVB9c2LHnzl7Q,4110
11
- droidrun/agent/droid/__init__.py,sha256=wSuPd9wDEreFYlclfmXEqiqKq0wJQTT3v3PY-WhS6q0,264
12
- droidrun/agent/droid/droid_agent.py,sha256=3JnCkusacpBYiWVFBnVRMGbFt61CJ2_bOn_QW-lFUTk,18576
13
- droidrun/agent/planner/__init__.py,sha256=CWWEA9H6xM-il832tpTG19bMl0j9r4fYXMLikqUGNeU,372
14
- droidrun/agent/planner/events.py,sha256=wWBz5F7_cyNQHJLZp-n-1ML89M82_chcdhUxXTj3k8M,381
15
- droidrun/agent/planner/prompts.py,sha256=8kWudnq8dPuhVpugyT53Y-NPLZvlQadIrjUUrKgy5h4,7065
16
- droidrun/agent/planner/task_manager.py,sha256=u70Syr9OiGKU4IOy9oqblLYjHfELBl-m5nmQc35RPqI,13348
17
- droidrun/agent/planner/workflow.py,sha256=jRLVkEejQk1Rul6mxBXLDtReS8K0G1UFAJdH1JHtXOk,18797
18
- droidrun/agent/utils/async_utils.py,sha256=Bf4J2TmT7Fbp4JKtvS1lfOYBmJ3lBUQ9D0lBYQfChus,2266
19
- droidrun/agent/utils/chat_utils.py,sha256=lSp6snn15EhrZj4eGGN3De710Btub5jV_euSz9LYUu4,3891
20
- droidrun/agent/utils/executer.py,sha256=PKgUwTer-IezZ-NecCGrgcRHjmRIm7RTmgwrUaXJSlQ,3535
21
- droidrun/agent/utils/llm_picker.py,sha256=KSjbOw6oqKuIQUm8lKDEhY13PTd5U70vY9Bb150AvBE,5782
22
- droidrun/cli/__init__.py,sha256=ra9bKoHTIkgRsVFRlWztROPPRswMv_A-wc2b2e0plmo,155
23
- droidrun/cli/main.py,sha256=NQKjHSxMTDSjNyXLnv8KnUQgTw61RFWRVKpL2aukT3M,21197
24
- droidrun/tools/__init__.py,sha256=_wTPn8jhAjtpMdHXc5LlCa2pokpCuM1kcEzxC94gpVg,237
25
- droidrun/tools/actions.py,sha256=0KM-eyJnWx4kIttKG7MVA8gwn9DNoxQv8It0nCyV-GE,34002
26
- droidrun/tools/device.py,sha256=Aq2NzERtFdPLiXXQ_km7DJbw2LAPgpCIf5DQB-VpzCA,1078
27
- droidrun/tools/loader.py,sha256=Glpxz7t1IDlitxcUslmhwPTTpNpx8y_ivLN6JF3CDoE,2372
28
- droidrun-0.2.0.dist-info/METADATA,sha256=mDCK2ij4tifCuew8zv8aii-6dRAyfv2ehs7GfvUknus,12479
29
- droidrun-0.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
30
- droidrun-0.2.0.dist-info/entry_points.txt,sha256=o259U66js8TIybQ7zs814Oe_LQ_GpZsp6a9Cr-xm5zE,51
31
- droidrun-0.2.0.dist-info/licenses/LICENSE,sha256=s-uxn9qChu-kFdRXUp6v_0HhsaJ_5OANmfNOFVm2zdk,1069
32
- droidrun-0.2.0.dist-info/RECORD,,