droidrun 0.3.3__tar.gz → 0.3.4__tar.gz

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 (99) hide show
  1. {droidrun-0.3.3 → droidrun-0.3.4}/.gitignore +3 -1
  2. {droidrun-0.3.3 → droidrun-0.3.4}/PKG-INFO +1 -2
  3. droidrun-0.3.4/docs/.generated-files.txt +4 -0
  4. {droidrun-0.3.3 → droidrun-0.3.4}/docs/docs.json +2 -3
  5. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v3/concepts/agent.mdx +2 -1
  6. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v3/guides/gemini.mdx +1 -1
  7. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v3/guides/ollama.mdx +8 -4
  8. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v3/guides/openailike.mdx +1 -1
  9. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v3/quickstart.mdx +1 -1
  10. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v3/sdk/adb-tools.mdx +119 -24
  11. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v3/sdk/base-tools.mdx +44 -13
  12. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v3/sdk/droid-agent.mdx +7 -2
  13. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v3/sdk/ios-tools.mdx +39 -36
  14. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/codeact/codeact_agent.py +13 -8
  15. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/context/task_manager.py +8 -3
  16. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/droid/droid_agent.py +35 -10
  17. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/droid/events.py +1 -0
  18. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/planner/planner_agent.py +18 -13
  19. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/utils/chat_utils.py +1 -1
  20. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/utils/executer.py +10 -2
  21. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/cli/main.py +49 -22
  22. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/macro/cli.py +1 -1
  23. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/portal.py +23 -7
  24. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/telemetry/events.py +1 -1
  25. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/tools/adb.py +86 -98
  26. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/tools/tools.py +28 -0
  27. {droidrun-0.3.3 → droidrun-0.3.4}/pyproject.toml +17 -32
  28. droidrun-0.3.3/docs/.generated-files.txt +0 -5
  29. droidrun-0.3.3/docs/v3/sdk/adb-utils.mdx +0 -399
  30. {droidrun-0.3.3 → droidrun-0.3.4}/.github/workflows/bounty.yml +0 -0
  31. {droidrun-0.3.3 → droidrun-0.3.4}/.github/workflows/publish.yml +0 -0
  32. {droidrun-0.3.3 → droidrun-0.3.4}/CHANGELOG.md +0 -0
  33. {droidrun-0.3.3 → droidrun-0.3.4}/CONTRIBUTING.md +0 -0
  34. {droidrun-0.3.3 → droidrun-0.3.4}/LICENSE +0 -0
  35. {droidrun-0.3.3 → droidrun-0.3.4}/MANIFEST.in +0 -0
  36. {droidrun-0.3.3 → droidrun-0.3.4}/README.md +0 -0
  37. {droidrun-0.3.3 → droidrun-0.3.4}/docs/favicon.png +0 -0
  38. {droidrun-0.3.3 → droidrun-0.3.4}/docs/logo/dark.svg +0 -0
  39. {droidrun-0.3.3 → droidrun-0.3.4}/docs/logo/light.svg +0 -0
  40. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v1/concepts/agent.mdx +0 -0
  41. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v1/concepts/android-control.mdx +0 -0
  42. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v1/concepts/portal-app.mdx +0 -0
  43. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v1/overview.mdx +0 -0
  44. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v1/quickstart.mdx +0 -0
  45. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v2/concepts/agent.mdx +0 -0
  46. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v2/concepts/android-control.mdx +0 -0
  47. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v2/concepts/planning.mdx +0 -0
  48. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v2/concepts/portal-app.mdx +0 -0
  49. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v2/concepts/tracing.mdx +0 -0
  50. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v2/overview.mdx +0 -0
  51. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v2/quickstart.mdx +0 -0
  52. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v3/concepts/android-tools.mdx +0 -0
  53. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v3/concepts/models.mdx +0 -0
  54. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v3/concepts/portal-app.mdx +0 -0
  55. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v3/guides/cli.mdx +0 -0
  56. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v3/guides/overview.mdx +0 -0
  57. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v3/guides/telemetry.mdx +0 -0
  58. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v3/images/portal_apk.png +0 -0
  59. {droidrun-0.3.3 → droidrun-0.3.4}/docs/v3/overview.mdx +0 -0
  60. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/__init__.py +0 -0
  61. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/__main__.py +0 -0
  62. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/__init__.py +0 -0
  63. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/codeact/__init__.py +0 -0
  64. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/codeact/events.py +0 -0
  65. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/codeact/prompts.py +0 -0
  66. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/common/default.py +0 -0
  67. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/common/events.py +0 -0
  68. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/context/__init__.py +0 -0
  69. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/context/agent_persona.py +0 -0
  70. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/context/context_injection_manager.py +0 -0
  71. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/context/episodic_memory.py +0 -0
  72. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/context/personas/__init__.py +0 -0
  73. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/context/personas/app_starter.py +0 -0
  74. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/context/personas/big_agent.py +0 -0
  75. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/context/personas/default.py +0 -0
  76. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/context/personas/ui_expert.py +0 -0
  77. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/context/reflection.py +0 -0
  78. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/droid/__init__.py +0 -0
  79. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/oneflows/reflector.py +0 -0
  80. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/planner/__init__.py +0 -0
  81. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/planner/events.py +0 -0
  82. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/planner/prompts.py +0 -0
  83. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/utils/__init__.py +0 -0
  84. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/utils/async_utils.py +0 -0
  85. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/utils/llm_picker.py +0 -0
  86. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/agent/utils/trajectory.py +0 -0
  87. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/cli/__init__.py +0 -0
  88. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/cli/logs.py +0 -0
  89. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/macro/__init__.py +0 -0
  90. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/macro/__main__.py +0 -0
  91. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/macro/replay.py +0 -0
  92. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/telemetry/__init__.py +0 -0
  93. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/telemetry/tracker.py +0 -0
  94. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/tools/__init__.py +0 -0
  95. {droidrun-0.3.3 → droidrun-0.3.4}/droidrun/tools/ios.py +0 -0
  96. {droidrun-0.3.3 → droidrun-0.3.4}/gen-docs-sdk-ref.sh +0 -0
  97. {droidrun-0.3.3 → droidrun-0.3.4}/setup.py +0 -0
  98. {droidrun-0.3.3 → droidrun-0.3.4}/static/droidrun-dark.png +0 -0
  99. {droidrun-0.3.3 → droidrun-0.3.4}/static/droidrun.png +0 -0
@@ -24,4 +24,6 @@ patch_apis.py
24
24
  .arize-phoenix
25
25
 
26
26
 
27
- uv.lock
27
+ uv.lock
28
+
29
+ todo.txt
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: droidrun
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: A framework for controlling Android devices through LLM agents
5
5
  Project-URL: Homepage, https://github.com/droidrun/droidrun
6
6
  Project-URL: Bug Tracker, https://github.com/droidrun/droidrun/issues
@@ -46,7 +46,6 @@ Requires-Dist: posthog==6.0.2
46
46
  Requires-Dist: pydantic>=2.0.0
47
47
  Requires-Dist: python-dotenv>=1.0.0
48
48
  Requires-Dist: rich>=13.0.0
49
- Requires-Dist: typing-extensions
50
49
  Provides-Extra: dev
51
50
  Requires-Dist: bandit>=1.7.0; extra == 'dev'
52
51
  Requires-Dist: black>=23.0.0; extra == 'dev'
@@ -0,0 +1,4 @@
1
+ md5 0b688f460703d59bd84fe71387e626d5 v3/sdk/droid-agent.mdx
2
+ md5 47f362d52ba26155d647efec628294cf v3/sdk/base-tools.mdx
3
+ md5 2e83b80e94101d983ed52ac5ae91314f v3/sdk/adb-tools.mdx
4
+ md5 7d779482901cc5eb62288ac9c8d85199 v3/sdk/ios-tools.mdx
@@ -14,7 +14,7 @@
14
14
  "tab": "Framework",
15
15
  "versions": [
16
16
  {
17
- "version": "0.3.2",
17
+ "version": "0.3.3",
18
18
  "groups": [
19
19
  {
20
20
  "group": "Introduction",
@@ -49,8 +49,7 @@
49
49
  "v3/sdk/droid-agent",
50
50
  "v3/sdk/adb-tools",
51
51
  "v3/sdk/ios-tools",
52
- "v3/sdk/base-tools",
53
- "v3/sdk/adb-utils"
52
+ "v3/sdk/base-tools"
54
53
  ]
55
54
  }
56
55
  ]
@@ -21,7 +21,7 @@ def __init__(
21
21
  reflection: bool = False, # Enable reflection
22
22
  enable_tracing: bool = False, # Enable tracing (this requires arize phoenix)
23
23
  debug: bool = False, # Enable additional debug logs
24
- save_trajectories: bool = False, # Save the Trajectory data of the run (GIF + logs)
24
+ save_trajectories: str = "none", # Trajectory saving level: "none" (no saving), "step" (save per step), "action" (save per action)
25
25
  *args,
26
26
  **kwargs
27
27
  )
@@ -92,6 +92,7 @@ agent = DroidAgent(
92
92
  reflection=True
93
93
  )
94
94
  ```
95
+ <Warning>Reflection is based on screenshots. Use it alongside an LLM model with vision capabilities (e.g., GPT-4o, Gemini-2.5-Flash etc.).</Warning>
95
96
  **Flow:** Goal → Planning → Execution → Reflection → Re-planning (if needed) → Result
96
97
 
97
98
  **Best Practice:**
@@ -46,7 +46,7 @@ from droidrun import DroidAgent, AdbTools
46
46
 
47
47
  async def main():
48
48
  # load adb tools for the first connected device
49
- tools = await AdbTools.create()
49
+ tools = AdbTools()
50
50
 
51
51
  # Set up the Gemini LLM
52
52
  llm = GoogleGenAI(
@@ -61,12 +61,14 @@ from droidrun import DroidAgent, AdbTools
61
61
 
62
62
  async def main():
63
63
  # load adb tools for the first connected device
64
- tools = await AdbTools.create()
64
+ tools = AdbTools()
65
65
 
66
66
  # Set up the Ollama LLM with a modern model
67
67
  llm = Ollama(
68
- model="qwen2.5vl", # or "gemma3", "deepseek", "llama4", etc.
69
- base_url="http://localhost:11434" # default Ollama endpoint
68
+ model="qwen2.5vl", # or "gemma3", "deepseek", "llama4", etc.
69
+ base_url="http://localhost:11434", # default Ollama endpoint
70
+ context_window=8192, # limit the max context window to prevent running out of memory.
71
+ request_timeout=120.0 # increase the request timeout
70
72
  )
71
73
 
72
74
  # Create the DroidAgent
@@ -74,7 +76,7 @@ async def main():
74
76
  goal="Open Settings and check battery level",
75
77
  llm=llm,
76
78
  tools=tools,
77
- vision=True, # Optional: enable vision. use vision=False for deepseek models
79
+ vision=False, # Optional: enable vision. use vision=True only in conjunction with a vision model
78
80
  reasoning=True, # Optional: enable planning/reasoning. Read more about the agent configuration in Core-Concepts/Agent
79
81
  )
80
82
 
@@ -88,6 +90,8 @@ if __name__ == "__main__":
88
90
  asyncio.run(main())
89
91
  ```
90
92
 
93
+ <Note>Limiting the llm's context_window reduces memory usage, but degrades the agent's performance too. For the best results try extending it as much as possible.</Note>
94
+
91
95
  ## 4. Troubleshooting
92
96
 
93
97
  - **Ollama not running:** Make sure `ollama serve` is running and accessible at `http://localhost:11434`.
@@ -50,7 +50,7 @@ from droidrun import DroidAgent, AdbTools
50
50
 
51
51
  async def main():
52
52
  # Load adb tools for the first connected device
53
- tools = await AdbTools.create()
53
+ tools = AdbTools()
54
54
 
55
55
  # Set up the OpenAI-like LLM (uses env vars for API key and base by default)
56
56
  llm = OpenAILike(
@@ -59,7 +59,7 @@ from llama_index.llms.google_genai import GoogleGenAI
59
59
 
60
60
  async def main():
61
61
  # Load tools
62
- tools = await AdbTools.create()
62
+ tools = AdbTools()
63
63
  # set up google gemini llm
64
64
  llm = GoogleGenAI(
65
65
  api_key="YOUR_GEMINI_API_KEY", # Replace with your Gemini API key
@@ -19,7 +19,11 @@ Core UI interaction tools for Android device control.
19
19
  #### AdbTools.\_\_init\_\_
20
20
 
21
21
  ```python
22
- def __init__(serial: str) -> None
22
+ def __init__(
23
+ serial: str | None = None,
24
+ use_tcp: bool = False,
25
+ tcp_port: int = 8080
26
+ ) -> None
23
27
  ```
24
28
 
25
29
  Initialize the AdbTools instance.
@@ -27,32 +31,53 @@ Initialize the AdbTools instance.
27
31
  **Arguments**:
28
32
 
29
33
  - `serial` - Device serial number
34
+ - `use_tcp` - Whether to use TCP communication (default: False)
35
+ - `tcp_port` - TCP port for communication (default: 8080)
30
36
 
31
- <a id="droidrun.tools.adb.AdbTools.create"></a>
37
+ <a id="droidrun.tools.adb.AdbTools.setup_tcp_forward"></a>
32
38
 
33
- #### AdbTools.create
39
+ #### AdbTools.setup\_tcp\_forward
34
40
 
35
41
  ```python
36
- async def create(cls: Type[Self], serial: str = None) -> Self
42
+ def setup_tcp_forward() -> bool
37
43
  ```
38
44
 
39
- Create an AdbTools instance.
45
+ Set up ADB TCP port forwarding for communication with the portal app.
40
46
 
41
- **Arguments**:
47
+ **Returns**:
42
48
 
43
- - `serial` - Optional device serial number. If not provided, the first device found will be used.
44
-
49
+ - `bool` - True if forwarding was set up successfully, False otherwise
50
+
51
+ <a id="droidrun.tools.adb.AdbTools.teardown_tcp_forward"></a>
52
+
53
+ #### AdbTools.teardown\_tcp\_forward
54
+
55
+ ```python
56
+ def teardown_tcp_forward() -> bool
57
+ ```
58
+
59
+ Remove ADB TCP port forwarding.
45
60
 
46
61
  **Returns**:
47
62
 
48
- AdbTools instance
63
+ - `bool` - True if forwarding was removed successfully, False otherwise
64
+
65
+ <a id="droidrun.tools.adb.AdbTools.__del__"></a>
66
+
67
+ #### AdbTools.\_\_del\_\_
68
+
69
+ ```python
70
+ def __del__()
71
+ ```
72
+
73
+ Cleanup when the object is destroyed.
49
74
 
50
75
  <a id="droidrun.tools.adb.AdbTools.tap_by_index"></a>
51
76
 
52
77
  #### AdbTools.tap\_by\_index
53
78
 
54
79
  ```python
55
- async def tap_by_index(index: int, serial: Optional[str] = None) -> str
80
+ def tap_by_index(index: int) -> str
56
81
  ```
57
82
 
58
83
  Tap on a UI element by its index.
@@ -74,7 +99,7 @@ to find the element with the given index and tap on its center coordinates.
74
99
  #### AdbTools.tap\_by\_coordinates
75
100
 
76
101
  ```python
77
- async def tap_by_coordinates(x: int, y: int) -> bool
102
+ def tap_by_coordinates(x: int, y: int) -> bool
78
103
  ```
79
104
 
80
105
  Tap on the device screen at specific coordinates.
@@ -94,7 +119,7 @@ Tap on the device screen at specific coordinates.
94
119
  #### AdbTools.tap
95
120
 
96
121
  ```python
97
- async def tap(index: int) -> str
122
+ def tap(index: int) -> str
98
123
  ```
99
124
 
100
125
  Tap on a UI element by its index.
@@ -116,12 +141,12 @@ to find the element with the given index and tap on its center coordinates.
116
141
  #### AdbTools.swipe
117
142
 
118
143
  ```python
119
- async def swipe(
144
+ def swipe(
120
145
  start_x: int,
121
146
  start_y: int,
122
147
  end_x: int,
123
148
  end_y: int,
124
- duration_ms: int = 300
149
+ duration_ms: float = 300
125
150
  ) -> bool
126
151
  ```
127
152
 
@@ -134,7 +159,35 @@ To perform a hold (long press), set the start and end coordinates to the same va
134
159
  - `start_y` - Starting Y coordinate
135
160
  - `end_x` - Ending X coordinate
136
161
  - `end_y` - Ending Y coordinate
137
- - `duration_ms` - Duration of swipe in milliseconds
162
+ - `duration` - Duration of swipe in seconds
163
+
164
+ **Returns**:
165
+
166
+ Bool indicating success or failure
167
+
168
+ <a id="droidrun.tools.adb.AdbTools.drag"></a>
169
+
170
+ #### AdbTools.drag
171
+
172
+ ```python
173
+ def drag(
174
+ start_x: int,
175
+ start_y: int,
176
+ end_x: int,
177
+ end_y: int,
178
+ duration: float = 3
179
+ ) -> bool
180
+ ```
181
+
182
+ Performs a straight-line drag and drop gesture on the device screen.
183
+
184
+ **Arguments**:
185
+
186
+ - `start_x` - Starting X coordinate
187
+ - `start_y` - Starting Y coordinate
188
+ - `end_x` - Ending X coordinate
189
+ - `end_y` - Ending Y coordinate
190
+ - `duration` - Duration of swipe in seconds
138
191
 
139
192
  **Returns**:
140
193
 
@@ -145,7 +198,7 @@ To perform a hold (long press), set the start and end coordinates to the same va
145
198
  #### AdbTools.input\_text
146
199
 
147
200
  ```python
148
- async def input_text(text: str, serial: Optional[str] = None) -> str
201
+ def input_text(text: str) -> str
149
202
  ```
150
203
 
151
204
  Input text on the device.
@@ -165,7 +218,7 @@ Always make sure that the Focused Element is not None before inputting text.
165
218
  #### AdbTools.back
166
219
 
167
220
  ```python
168
- async def back() -> str
221
+ def back() -> str
169
222
  ```
170
223
 
171
224
  Go back on the current view.
@@ -176,7 +229,7 @@ This presses the Android back button.
176
229
  #### AdbTools.press\_key
177
230
 
178
231
  ```python
179
- async def press_key(keycode: int) -> str
232
+ def press_key(keycode: int) -> str
180
233
  ```
181
234
 
182
235
  Press a key on the Android device.
@@ -196,7 +249,7 @@ Common keycodes:
196
249
  #### AdbTools.start\_app
197
250
 
198
251
  ```python
199
- async def start_app(package: str, activity: str = "") -> str
252
+ def start_app(package: str, activity: str | None = None) -> str
200
253
  ```
201
254
 
202
255
  Start an app on the device.
@@ -211,7 +264,7 @@ Start an app on the device.
211
264
  #### AdbTools.install\_app
212
265
 
213
266
  ```python
214
- async def install_app(
267
+ def install_app(
215
268
  apk_path: str,
216
269
  reinstall: bool = False,
217
270
  grant_permissions: bool = True
@@ -231,7 +284,7 @@ Install an app on the device.
231
284
  #### AdbTools.take\_screenshot
232
285
 
233
286
  ```python
234
- async def take_screenshot() -> Tuple[str, bytes]
287
+ def take_screenshot() -> Tuple[str, bytes]
235
288
  ```
236
289
 
237
290
  Take a screenshot of the device.
@@ -243,7 +296,7 @@ Also stores the screenshot in the screenshots list with timestamp for later GIF
243
296
  #### AdbTools.list\_packages
244
297
 
245
298
  ```python
246
- async def list_packages(include_system_apps: bool = False) -> List[str]
299
+ def list_packages(include_system_apps: bool = False) -> List[str]
247
300
  ```
248
301
 
249
302
  List installed packages on the device.
@@ -277,7 +330,7 @@ Mark the task as finished.
277
330
  #### AdbTools.remember
278
331
 
279
332
  ```python
280
- async def remember(information: str) -> str
333
+ def remember(information: str) -> str
281
334
  ```
282
335
 
283
336
  Store important information to remember for future context.
@@ -314,7 +367,7 @@ Retrieve all stored memory items.
314
367
  #### AdbTools.get\_state
315
368
 
316
369
  ```python
317
- async def get_state(serial: Optional[str] = None) -> Dict[str, Any]
370
+ def get_state(serial: Optional[str] = None) -> Dict[str, Any]
318
371
  ```
319
372
 
320
373
  Get both the a11y tree and phone state in a single call using the combined /state endpoint.
@@ -328,3 +381,45 @@ Get both the a11y tree and phone state in a single call using the combined /stat
328
381
 
329
382
  Dictionary containing both 'a11y_tree' and 'phone_state' data
330
383
 
384
+ <a id="droidrun.tools.adb.AdbTools.get_a11y_tree"></a>
385
+
386
+ #### AdbTools.get\_a11y\_tree
387
+
388
+ ```python
389
+ def get_a11y_tree() -> Dict[str, Any]
390
+ ```
391
+
392
+ Get just the accessibility tree using the /a11y_tree endpoint.
393
+
394
+ **Returns**:
395
+
396
+ Dictionary containing accessibility tree data
397
+
398
+ <a id="droidrun.tools.adb.AdbTools.get_phone_state"></a>
399
+
400
+ #### AdbTools.get\_phone\_state
401
+
402
+ ```python
403
+ def get_phone_state() -> Dict[str, Any]
404
+ ```
405
+
406
+ Get just the phone state using the /phone_state endpoint.
407
+
408
+ **Returns**:
409
+
410
+ Dictionary containing phone state data
411
+
412
+ <a id="droidrun.tools.adb.AdbTools.ping"></a>
413
+
414
+ #### AdbTools.ping
415
+
416
+ ```python
417
+ def ping() -> Dict[str, Any]
418
+ ```
419
+
420
+ Test the TCP connection using the /ping endpoint.
421
+
422
+ **Returns**:
423
+
424
+ Dictionary with ping result
425
+
@@ -13,12 +13,23 @@ class Tools(ABC)
13
13
  Abstract base class for all tools.
14
14
  This class provides a common interface for all tools to implement.
15
15
 
16
+ <a id="droidrun.tools.tools.Tools.ui_action"></a>
17
+
18
+ #### Tools.ui\_action
19
+
20
+ ```python
21
+ def ui_action(func)
22
+ ```
23
+
24
+ "
25
+ Decorator to capture screenshots and UI states for actions that modify the UI.
26
+
16
27
  <a id="droidrun.tools.tools.Tools.get_state"></a>
17
28
 
18
29
  #### Tools.get\_state
19
30
 
20
31
  ```python
21
- async def get_state() -> Dict[str, Any]
32
+ def get_state() -> Dict[str, Any]
22
33
  ```
23
34
 
24
35
  Get the current state of the tool.
@@ -28,7 +39,7 @@ Get the current state of the tool.
28
39
  #### Tools.tap\_by\_index
29
40
 
30
41
  ```python
31
- async def tap_by_index(index: int) -> bool
42
+ def tap_by_index(index: int) -> str
32
43
  ```
33
44
 
34
45
  Tap the element at the given index.
@@ -38,7 +49,7 @@ Tap the element at the given index.
38
49
  #### Tools.swipe
39
50
 
40
51
  ```python
41
- async def swipe(
52
+ def swipe(
42
53
  start_x: int,
43
54
  start_y: int,
44
55
  end_x: int,
@@ -49,12 +60,28 @@ async def swipe(
49
60
 
50
61
  Swipe from the given start coordinates to the given end coordinates.
51
62
 
63
+ <a id="droidrun.tools.tools.Tools.drag"></a>
64
+
65
+ #### Tools.drag
66
+
67
+ ```python
68
+ def drag(
69
+ start_x: int,
70
+ start_y: int,
71
+ end_x: int,
72
+ end_y: int,
73
+ duration_ms: int = 3000
74
+ ) -> bool
75
+ ```
76
+
77
+ Drag from the given start coordinates to the given end coordinates.
78
+
52
79
  <a id="droidrun.tools.tools.Tools.input_text"></a>
53
80
 
54
81
  #### Tools.input\_text
55
82
 
56
83
  ```python
57
- async def input_text(text: str) -> bool
84
+ def input_text(text: str) -> str
58
85
  ```
59
86
 
60
87
  Input the given text into a focused input field.
@@ -64,7 +91,7 @@ Input the given text into a focused input field.
64
91
  #### Tools.back
65
92
 
66
93
  ```python
67
- async def back() -> bool
94
+ def back() -> str
68
95
  ```
69
96
 
70
97
  Press the back button.
@@ -74,7 +101,7 @@ Press the back button.
74
101
  #### Tools.press\_key
75
102
 
76
103
  ```python
77
- async def press_key(keycode: int) -> bool
104
+ def press_key(keycode: int) -> str
78
105
  ```
79
106
 
80
107
  Enter the given keycode.
@@ -84,7 +111,7 @@ Enter the given keycode.
84
111
  #### Tools.start\_app
85
112
 
86
113
  ```python
87
- async def start_app(package: str, activity: str = "") -> bool
114
+ def start_app(package: str, activity: str = "") -> str
88
115
  ```
89
116
 
90
117
  Start the given app.
@@ -94,7 +121,7 @@ Start the given app.
94
121
  #### Tools.take\_screenshot
95
122
 
96
123
  ```python
97
- async def take_screenshot() -> Tuple[str, bytes]
124
+ def take_screenshot() -> Tuple[str, bytes]
98
125
  ```
99
126
 
100
127
  Take a screenshot of the device.
@@ -104,7 +131,7 @@ Take a screenshot of the device.
104
131
  #### Tools.list\_packages
105
132
 
106
133
  ```python
107
- async def list_packages(include_system_apps: bool = False) -> List[str]
134
+ def list_packages(include_system_apps: bool = False) -> List[str]
108
135
  ```
109
136
 
110
137
  List all packages on the device.
@@ -114,7 +141,7 @@ List all packages on the device.
114
141
  #### Tools.remember
115
142
 
116
143
  ```python
117
- async def remember(information: str) -> str
144
+ def remember(information: str) -> str
118
145
  ```
119
146
 
120
147
  Remember the given information. This is used to store information in the tool's memory.
@@ -124,7 +151,7 @@ Remember the given information. This is used to store information in the tool's
124
151
  #### Tools.get\_memory
125
152
 
126
153
  ```python
127
- async def get_memory() -> List[str]
154
+ def get_memory() -> List[str]
128
155
  ```
129
156
 
130
157
  Get the memory of the tool.
@@ -134,7 +161,7 @@ Get the memory of the tool.
134
161
  #### Tools.complete
135
162
 
136
163
  ```python
137
- def complete(success: bool, reason: str = "") -> bool
164
+ def complete(success: bool, reason: str = "") -> None
138
165
  ```
139
166
 
140
167
  Complete the tool. This is used to indicate that the tool has completed its task.
@@ -144,7 +171,10 @@ Complete the tool. This is used to indicate that the tool has completed its task
144
171
  #### describe\_tools
145
172
 
146
173
  ```python
147
- def describe_tools(tools: Tools) -> Dict[str, Callable[..., Any]]
174
+ def describe_tools(
175
+ tools: Tools,
176
+ exclude_tools: Optional[List[str]] = None
177
+ ) -> Dict[str, Callable[..., Any]]
148
178
  ```
149
179
 
150
180
  Describe the tools available for the given Tools instance.
@@ -152,6 +182,7 @@ Describe the tools available for the given Tools instance.
152
182
  **Arguments**:
153
183
 
154
184
  - `tools` - The Tools instance to describe.
185
+ - `exclude_tools` - List of tool names to exclude from the description.
155
186
 
156
187
 
157
188
  **Returns**:
@@ -33,7 +33,8 @@ def __init__(
33
33
  reflection: bool = False,
34
34
  enable_tracing: bool = False,
35
35
  debug: bool = False,
36
- save_trajectories: bool = False,
36
+ save_trajectories: str = "none",
37
+ excluded_tools: List[str] = None,
37
38
  *args,
38
39
  **kwargs
39
40
  )
@@ -52,6 +53,10 @@ Initialize the DroidAgent wrapper.
52
53
  - `reflection` - Whether to reflect on steps the CodeActAgent did to give the PlannerAgent advice
53
54
  - `enable_tracing` - Whether to enable Arize Phoenix tracing
54
55
  - `debug` - Whether to enable verbose debug logging
56
+ - `save_trajectories` - Trajectory saving level. Can be:
57
+ - "none" (no saving)
58
+ - "step" (save per step)
59
+ - "action" (save per action)
55
60
  - `**kwargs` - Additional keyword arguments to pass to the agents
56
61
 
57
62
  <a id="droidrun.agent.droid.droid_agent.DroidAgent.run"></a>
@@ -59,7 +64,7 @@ Initialize the DroidAgent wrapper.
59
64
  #### DroidAgent.run
60
65
 
61
66
  ```python
62
- def run() -> WorkflowHandler
67
+ def run(*args, **kwargs) -> WorkflowHandler
63
68
  ```
64
69
 
65
70
  Run the DroidAgent workflow.