droidrun 0.3.9__py3-none-any.whl → 0.3.10.dev2__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.
- droidrun/__init__.py +2 -3
- droidrun/__main__.py +1 -1
- droidrun/agent/__init__.py +1 -1
- droidrun/agent/codeact/__init__.py +1 -4
- droidrun/agent/codeact/codeact_agent.py +66 -40
- droidrun/agent/codeact/events.py +6 -3
- droidrun/agent/codeact/prompts.py +2 -2
- droidrun/agent/common/events.py +4 -2
- droidrun/agent/context/__init__.py +1 -3
- droidrun/agent/context/agent_persona.py +2 -1
- droidrun/agent/context/context_injection_manager.py +6 -6
- droidrun/agent/context/episodic_memory.py +5 -3
- droidrun/agent/context/personas/__init__.py +3 -3
- droidrun/agent/context/personas/app_starter.py +3 -3
- droidrun/agent/context/personas/big_agent.py +3 -3
- droidrun/agent/context/personas/default.py +3 -3
- droidrun/agent/context/personas/ui_expert.py +5 -5
- droidrun/agent/context/task_manager.py +15 -17
- droidrun/agent/droid/__init__.py +1 -1
- droidrun/agent/droid/droid_agent.py +327 -180
- droidrun/agent/droid/events.py +91 -9
- droidrun/agent/executor/__init__.py +13 -0
- droidrun/agent/executor/events.py +24 -0
- droidrun/agent/executor/executor_agent.py +327 -0
- droidrun/agent/executor/prompts.py +136 -0
- droidrun/agent/manager/__init__.py +18 -0
- droidrun/agent/manager/events.py +20 -0
- droidrun/agent/manager/manager_agent.py +459 -0
- droidrun/agent/manager/prompts.py +223 -0
- droidrun/agent/oneflows/app_starter_workflow.py +118 -0
- droidrun/agent/oneflows/text_manipulator.py +204 -0
- droidrun/agent/planner/__init__.py +3 -3
- droidrun/agent/planner/events.py +6 -3
- droidrun/agent/planner/planner_agent.py +27 -42
- droidrun/agent/planner/prompts.py +2 -2
- droidrun/agent/usage.py +11 -11
- droidrun/agent/utils/__init__.py +11 -1
- droidrun/agent/utils/async_utils.py +2 -1
- droidrun/agent/utils/chat_utils.py +48 -60
- droidrun/agent/utils/device_state_formatter.py +177 -0
- droidrun/agent/utils/executer.py +12 -11
- droidrun/agent/utils/inference.py +114 -0
- droidrun/agent/utils/llm_picker.py +2 -0
- droidrun/agent/utils/message_utils.py +85 -0
- droidrun/agent/utils/tools.py +220 -0
- droidrun/agent/utils/trajectory.py +8 -7
- droidrun/cli/__init__.py +1 -1
- droidrun/cli/logs.py +29 -28
- droidrun/cli/main.py +279 -143
- droidrun/config_manager/__init__.py +25 -0
- droidrun/config_manager/config_manager.py +583 -0
- droidrun/macro/__init__.py +2 -2
- droidrun/macro/__main__.py +1 -1
- droidrun/macro/cli.py +36 -34
- droidrun/macro/replay.py +7 -9
- droidrun/portal.py +1 -1
- droidrun/telemetry/__init__.py +2 -2
- droidrun/telemetry/events.py +3 -4
- droidrun/telemetry/phoenix.py +173 -0
- droidrun/telemetry/tracker.py +7 -5
- droidrun/tools/__init__.py +1 -1
- droidrun/tools/adb.py +210 -82
- droidrun/tools/ios.py +7 -5
- droidrun/tools/tools.py +25 -8
- {droidrun-0.3.9.dist-info → droidrun-0.3.10.dev2.dist-info}/METADATA +6 -3
- droidrun-0.3.10.dev2.dist-info/RECORD +70 -0
- droidrun/agent/common/default.py +0 -5
- droidrun/agent/context/reflection.py +0 -20
- droidrun/agent/oneflows/reflector.py +0 -265
- droidrun-0.3.9.dist-info/RECORD +0 -56
- {droidrun-0.3.9.dist-info → droidrun-0.3.10.dev2.dist-info}/WHEEL +0 -0
- {droidrun-0.3.9.dist-info → droidrun-0.3.10.dev2.dist-info}/entry_points.txt +0 -0
- {droidrun-0.3.9.dist-info → droidrun-0.3.10.dev2.dist-info}/licenses/LICENSE +0 -0
droidrun/cli/main.py
CHANGED
@@ -3,29 +3,33 @@ DroidRun CLI - Command line interface for controlling Android devices through LL
|
|
3
3
|
"""
|
4
4
|
|
5
5
|
import asyncio
|
6
|
-
import click
|
7
|
-
import os
|
8
6
|
import logging
|
7
|
+
import os
|
9
8
|
import warnings
|
10
9
|
from contextlib import nullcontext
|
11
|
-
from
|
10
|
+
from functools import wraps
|
11
|
+
|
12
|
+
import click
|
12
13
|
from adbutils import adb
|
14
|
+
from rich.console import Console
|
15
|
+
|
16
|
+
from droidrun.agent.context.personas import BIG_AGENT, DEFAULT
|
13
17
|
from droidrun.agent.droid import DroidAgent
|
14
18
|
from droidrun.agent.utils.llm_picker import load_llm
|
15
|
-
from droidrun.tools import AdbTools, IOSTools
|
16
|
-
from droidrun.agent.context.personas import DEFAULT, BIG_AGENT
|
17
|
-
from functools import wraps
|
18
19
|
from droidrun.cli.logs import LogHandler
|
19
|
-
from droidrun.
|
20
|
+
from droidrun.macro.cli import macro_cli
|
20
21
|
from droidrun.portal import (
|
22
|
+
PORTAL_PACKAGE_NAME,
|
21
23
|
download_portal_apk,
|
22
24
|
enable_portal_accessibility,
|
23
|
-
PORTAL_PACKAGE_NAME,
|
24
25
|
ping_portal,
|
25
|
-
ping_portal_tcp,
|
26
26
|
ping_portal_content,
|
27
|
+
ping_portal_tcp,
|
27
28
|
)
|
28
|
-
from droidrun.
|
29
|
+
from droidrun.telemetry import print_telemetry_message
|
30
|
+
from droidrun.tools import AdbTools, IOSTools
|
31
|
+
from droidrun.config_manager import config
|
32
|
+
from droidrun.config_manager.config_manager import VisionConfig
|
29
33
|
|
30
34
|
# Suppress all warnings
|
31
35
|
warnings.filterwarnings("ignore")
|
@@ -71,101 +75,241 @@ def coro(f):
|
|
71
75
|
async def run_command(
|
72
76
|
command: str,
|
73
77
|
device: str | None,
|
74
|
-
provider: str,
|
75
|
-
model: str,
|
76
|
-
steps: int,
|
77
|
-
base_url: str,
|
78
|
-
api_base: str,
|
79
|
-
vision: bool,
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
78
|
+
provider: str | None,
|
79
|
+
model: str | None,
|
80
|
+
steps: int | None,
|
81
|
+
base_url: str | None,
|
82
|
+
api_base: str | None,
|
83
|
+
vision: bool | None,
|
84
|
+
manager_vision: bool | None,
|
85
|
+
executor_vision: bool | None,
|
86
|
+
codeact_vision: bool | None,
|
87
|
+
reasoning: bool | None,
|
88
|
+
tracing: bool | None,
|
89
|
+
debug: bool | None,
|
90
|
+
use_tcp: bool | None,
|
91
|
+
save_trajectory: str | None = None,
|
86
92
|
ios: bool = False,
|
87
|
-
allow_drag: bool =
|
93
|
+
allow_drag: bool | None = None,
|
94
|
+
temperature: float | None = None,
|
88
95
|
**kwargs,
|
89
96
|
):
|
90
97
|
"""Run a command on your Android device using natural language."""
|
91
|
-
|
98
|
+
# Initialize logging first (use config default if debug not specified)
|
99
|
+
debug_mode = debug if debug is not None else config.logging.debug
|
100
|
+
log_handler = configure_logging(command, debug_mode)
|
92
101
|
logger = logging.getLogger("droidrun")
|
93
102
|
|
94
103
|
log_handler.update_step("Initializing...")
|
95
104
|
|
96
|
-
with log_handler.render()
|
105
|
+
with log_handler.render():
|
97
106
|
try:
|
98
107
|
logger.info(f"🚀 Starting: {command}")
|
99
108
|
print_telemetry_message()
|
100
109
|
|
101
|
-
|
102
|
-
|
103
|
-
|
110
|
+
# ================================================================
|
111
|
+
# STEP 1: Load base configuration from config.yaml
|
112
|
+
# ================================================================
|
113
|
+
|
114
|
+
max_steps = config.agent.max_steps
|
115
|
+
reasoning_mode = config.agent.reasoning
|
116
|
+
vision_config = config.agent.vision
|
117
|
+
device_serial = config.device.serial
|
118
|
+
use_tcp_mode = config.device.use_tcp
|
119
|
+
debug_mode = config.logging.debug
|
120
|
+
save_traj = config.logging.save_trajectory
|
121
|
+
tracing_enabled = config.tracing.enabled
|
122
|
+
allow_drag_tool = config.tools.allow_drag
|
123
|
+
|
124
|
+
# ================================================================
|
125
|
+
# STEP 2: Apply CLI overrides if explicitly specified
|
126
|
+
# ================================================================
|
127
|
+
|
128
|
+
if steps is not None:
|
129
|
+
max_steps = steps
|
130
|
+
logger.debug(f"CLI override: max_steps={max_steps}")
|
131
|
+
|
132
|
+
if reasoning is not None:
|
133
|
+
reasoning_mode = reasoning
|
134
|
+
logger.debug(f"CLI override: reasoning={reasoning_mode}")
|
135
|
+
|
136
|
+
if debug is not None:
|
137
|
+
debug_mode = debug
|
138
|
+
logger.debug(f"CLI override: debug={debug_mode}")
|
139
|
+
|
140
|
+
if tracing is not None:
|
141
|
+
tracing_enabled = tracing
|
142
|
+
logger.debug(f"CLI override: tracing={tracing_enabled}")
|
143
|
+
|
144
|
+
if save_trajectory is not None:
|
145
|
+
save_traj = save_trajectory
|
146
|
+
logger.debug(f"CLI override: save_trajectory={save_traj}")
|
147
|
+
|
148
|
+
if use_tcp is not None:
|
149
|
+
use_tcp_mode = use_tcp
|
150
|
+
logger.debug(f"CLI override: use_tcp={use_tcp_mode}")
|
151
|
+
|
152
|
+
if device is not None:
|
153
|
+
device_serial = device
|
154
|
+
logger.debug(f"CLI override: device={device_serial}")
|
155
|
+
|
156
|
+
if allow_drag is not None:
|
157
|
+
allow_drag_tool = allow_drag
|
158
|
+
logger.debug(f"CLI override: allow_drag={allow_drag_tool}")
|
159
|
+
|
160
|
+
# Override vision settings
|
161
|
+
if vision is not None:
|
162
|
+
# User specified --vision, apply to all agents
|
163
|
+
vision_config = VisionConfig(manager=vision, executor=vision, codeact=vision)
|
164
|
+
logger.debug(f"CLI override: vision={vision} (all agents)")
|
165
|
+
else:
|
166
|
+
# Check for per-agent vision overrides
|
167
|
+
vision_config = VisionConfig(
|
168
|
+
manager=vision_config.manager,
|
169
|
+
executor=vision_config.executor,
|
170
|
+
codeact=vision_config.codeact
|
171
|
+
)
|
172
|
+
if manager_vision is not None:
|
173
|
+
vision_config.manager = manager_vision
|
174
|
+
logger.debug(f"CLI override: manager_vision={manager_vision}")
|
175
|
+
|
176
|
+
if executor_vision is not None:
|
177
|
+
vision_config.executor = executor_vision
|
178
|
+
logger.debug(f"CLI override: executor_vision={executor_vision}")
|
179
|
+
|
180
|
+
if codeact_vision is not None:
|
181
|
+
vision_config.codeact = codeact_vision
|
182
|
+
logger.debug(f"CLI override: codeact_vision={codeact_vision}")
|
183
|
+
|
184
|
+
# ================================================================
|
185
|
+
# STEP 3: Load LLMs
|
186
|
+
# ================================================================
|
187
|
+
|
188
|
+
log_handler.update_step("Loading LLMs...")
|
189
|
+
|
190
|
+
# Check if user wants custom LLM for all agents
|
191
|
+
if provider is not None or model is not None:
|
192
|
+
# User specified custom provider/model - use for all agents
|
193
|
+
logger.info("🔧 Using custom LLM for all agents")
|
194
|
+
|
195
|
+
# Use provided values or fall back to first profile's defaults
|
196
|
+
if provider is None:
|
197
|
+
provider = list(config.llm_profiles.values())[0].provider
|
198
|
+
if model is None:
|
199
|
+
model = list(config.llm_profiles.values())[0].model
|
200
|
+
|
201
|
+
# Build kwargs
|
202
|
+
llm_kwargs = {}
|
203
|
+
if temperature is not None:
|
204
|
+
llm_kwargs['temperature'] = temperature
|
205
|
+
else:
|
206
|
+
llm_kwargs['temperature'] = kwargs.get('temperature', 1)
|
207
|
+
if base_url is not None:
|
208
|
+
llm_kwargs['base_url'] = base_url
|
209
|
+
if api_base is not None:
|
210
|
+
llm_kwargs['api_base'] = api_base
|
211
|
+
llm_kwargs.update(kwargs)
|
212
|
+
|
213
|
+
# Load single LLM for all agents
|
214
|
+
custom_llm = load_llm(
|
215
|
+
provider_name=provider,
|
216
|
+
model=model,
|
217
|
+
**llm_kwargs
|
218
|
+
)
|
219
|
+
|
220
|
+
# Use same LLM for all agents
|
221
|
+
llms = {
|
222
|
+
'manager': custom_llm,
|
223
|
+
'executor': custom_llm,
|
224
|
+
'codeact': custom_llm,
|
225
|
+
'text_manipulator': custom_llm,
|
226
|
+
'app_opener': custom_llm,
|
227
|
+
}
|
228
|
+
logger.info(f"🧠 Custom LLM ready: {provider}/{model}")
|
229
|
+
else:
|
230
|
+
# No custom provider/model - use profiles from config
|
231
|
+
logger.info("📋 Loading LLMs from config profiles...")
|
232
|
+
|
233
|
+
profile_names = ['manager', 'executor', 'codeact', 'text_manipulator', 'app_opener']
|
234
|
+
|
235
|
+
# Apply temperature override to all profiles if specified
|
236
|
+
overrides = {}
|
237
|
+
if temperature is not None:
|
238
|
+
overrides = {name: {'temperature': temperature} for name in profile_names}
|
239
|
+
|
240
|
+
llms = config.load_all_llms(profile_names=profile_names, **overrides)
|
241
|
+
logger.info(f"🧠 Loaded {len(llms)} agent-specific LLMs from profiles")
|
242
|
+
|
243
|
+
# ================================================================
|
244
|
+
# STEP 4: Setup device and tools
|
245
|
+
# ================================================================
|
246
|
+
|
104
247
|
log_handler.update_step("Setting up tools...")
|
105
|
-
|
106
|
-
|
107
|
-
if device is None and not ios:
|
248
|
+
|
249
|
+
if device_serial is None and not ios:
|
108
250
|
logger.info("🔍 Finding connected device...")
|
109
|
-
|
110
251
|
devices = adb.list()
|
111
252
|
if not devices:
|
112
253
|
raise ValueError("No connected devices found.")
|
113
|
-
|
114
|
-
logger.info(f"📱 Using device: {
|
115
|
-
elif
|
254
|
+
device_serial = devices[0].serial
|
255
|
+
logger.info(f"📱 Using device: {device_serial}")
|
256
|
+
elif device_serial is None and ios:
|
116
257
|
raise ValueError(
|
117
|
-
"iOS device not specified. Please specify
|
258
|
+
"iOS device not specified. Please specify device base url via --device"
|
118
259
|
)
|
119
260
|
else:
|
120
|
-
logger.info(f"📱 Using device: {
|
121
|
-
|
261
|
+
logger.info(f"📱 Using device: {device_serial}")
|
262
|
+
|
122
263
|
tools = (
|
123
|
-
AdbTools(
|
264
|
+
AdbTools(
|
265
|
+
serial=device_serial,
|
266
|
+
use_tcp=use_tcp_mode,
|
267
|
+
app_opener_llm=llms.get('app_opener'),
|
268
|
+
text_manipulator_llm=llms.get('text_manipulator')
|
269
|
+
)
|
124
270
|
if not ios
|
125
|
-
else IOSTools(url=
|
126
|
-
)
|
127
|
-
# Set excluded tools based on CLI flags
|
128
|
-
excluded_tools = [] if allow_drag else ["drag"]
|
129
|
-
|
130
|
-
# Select personas based on --drag flag
|
131
|
-
personas = [BIG_AGENT] if allow_drag else [DEFAULT]
|
132
|
-
|
133
|
-
# LLM setup
|
134
|
-
log_handler.update_step("Initializing LLM...")
|
135
|
-
llm = load_llm(
|
136
|
-
provider_name=provider,
|
137
|
-
model=model,
|
138
|
-
base_url=base_url,
|
139
|
-
api_base=api_base,
|
140
|
-
**kwargs,
|
271
|
+
else IOSTools(url=device_serial)
|
141
272
|
)
|
142
|
-
|
143
|
-
|
144
|
-
|
273
|
+
|
274
|
+
# Set excluded tools based on config/CLI
|
275
|
+
excluded_tools = [] if allow_drag_tool else ["drag"]
|
276
|
+
|
277
|
+
# Select personas based on drag flag
|
278
|
+
personas = [BIG_AGENT] if allow_drag_tool else [DEFAULT]
|
279
|
+
|
280
|
+
# ================================================================
|
281
|
+
# STEP 5: Initialize DroidAgent with all settings
|
282
|
+
# ================================================================
|
283
|
+
|
145
284
|
log_handler.update_step("Initializing DroidAgent...")
|
146
|
-
|
147
|
-
mode = "planning with reasoning" if
|
285
|
+
|
286
|
+
mode = "planning with reasoning" if reasoning_mode else "direct execution"
|
148
287
|
logger.info(f"🤖 Agent mode: {mode}")
|
149
|
-
|
150
|
-
|
288
|
+
logger.info(f"👁️ Vision settings: Manager={vision_config.manager}, "
|
289
|
+
f"Executor={vision_config.executor}, CodeAct={vision_config.codeact}")
|
290
|
+
|
291
|
+
if tracing_enabled:
|
151
292
|
logger.info("🔍 Tracing enabled")
|
152
|
-
|
293
|
+
|
153
294
|
droid_agent = DroidAgent(
|
154
295
|
goal=command,
|
155
|
-
|
296
|
+
llms=llms,
|
297
|
+
vision=vision_config,
|
156
298
|
tools=tools,
|
157
299
|
personas=personas,
|
158
300
|
excluded_tools=excluded_tools,
|
159
|
-
max_steps=
|
301
|
+
max_steps=max_steps,
|
160
302
|
timeout=1000,
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
debug=debug,
|
166
|
-
save_trajectories=save_trajectory,
|
303
|
+
reasoning=reasoning_mode,
|
304
|
+
enable_tracing=tracing_enabled,
|
305
|
+
debug=debug_mode,
|
306
|
+
save_trajectories=save_traj,
|
167
307
|
)
|
168
|
-
|
308
|
+
|
309
|
+
# ================================================================
|
310
|
+
# STEP 6: Run agent
|
311
|
+
# ================================================================
|
312
|
+
|
169
313
|
logger.info("▶️ Starting agent execution...")
|
170
314
|
logger.info("Press Ctrl+C to stop")
|
171
315
|
log_handler.update_step("Running agent...")
|
@@ -175,7 +319,7 @@ async def run_command(
|
|
175
319
|
|
176
320
|
async for event in handler.stream_events():
|
177
321
|
log_handler.handle_event(event)
|
178
|
-
result = await handler
|
322
|
+
result = await handler # noqa: F841
|
179
323
|
|
180
324
|
except KeyboardInterrupt:
|
181
325
|
log_handler.is_completed = True
|
@@ -188,7 +332,7 @@ async def run_command(
|
|
188
332
|
log_handler.is_success = False
|
189
333
|
log_handler.current_step = f"Error: {e}"
|
190
334
|
logger.error(f"💥 Error: {e}")
|
191
|
-
if
|
335
|
+
if debug_mode:
|
192
336
|
import traceback
|
193
337
|
|
194
338
|
logger.debug(traceback.format_exc())
|
@@ -196,7 +340,7 @@ async def run_command(
|
|
196
340
|
except Exception as e:
|
197
341
|
log_handler.current_step = f"Error: {e}"
|
198
342
|
logger.error(f"💥 Setup error: {e}")
|
199
|
-
if
|
343
|
+
if debug_mode:
|
200
344
|
import traceback
|
201
345
|
|
202
346
|
logger.debug(traceback.format_exc())
|
@@ -246,12 +390,7 @@ class DroidRunCLI(click.Group):
|
|
246
390
|
@click.option(
|
247
391
|
"--reasoning", is_flag=True, help="Enable planning with reasoning", default=False
|
248
392
|
)
|
249
|
-
|
250
|
-
"--reflection",
|
251
|
-
is_flag=True,
|
252
|
-
help="Enable reflection step for higher reasoning",
|
253
|
-
default=False,
|
254
|
-
)
|
393
|
+
|
255
394
|
@click.option(
|
256
395
|
"--tracing", is_flag=True, help="Enable Arize Phoenix tracing", default=False
|
257
396
|
)
|
@@ -281,7 +420,6 @@ def cli(
|
|
281
420
|
temperature: float,
|
282
421
|
vision: bool,
|
283
422
|
reasoning: bool,
|
284
|
-
reflection: bool,
|
285
423
|
tracing: bool,
|
286
424
|
debug: bool,
|
287
425
|
use_tcp: bool,
|
@@ -298,16 +436,16 @@ def cli(
|
|
298
436
|
"--provider",
|
299
437
|
"-p",
|
300
438
|
help="LLM provider (OpenAI, Ollama, Anthropic, GoogleGenAI, DeepSeek)",
|
301
|
-
default=
|
439
|
+
default=None,
|
302
440
|
)
|
303
441
|
@click.option(
|
304
442
|
"--model",
|
305
443
|
"-m",
|
306
444
|
help="LLM model name",
|
307
|
-
default=
|
445
|
+
default=None,
|
308
446
|
)
|
309
|
-
@click.option("--temperature", type=float, help="Temperature for LLM", default=
|
310
|
-
@click.option("--steps", type=int, help="Maximum number of steps", default=
|
447
|
+
@click.option("--temperature", type=float, help="Temperature for LLM", default=None)
|
448
|
+
@click.option("--steps", type=int, help="Maximum number of steps", default=None)
|
311
449
|
@click.option(
|
312
450
|
"--base_url",
|
313
451
|
"-u",
|
@@ -321,63 +459,77 @@ def cli(
|
|
321
459
|
)
|
322
460
|
@click.option(
|
323
461
|
"--vision",
|
324
|
-
|
325
|
-
|
326
|
-
|
462
|
+
type=bool,
|
463
|
+
default=None,
|
464
|
+
help="Enable vision capabilites by using screenshots for all agents.",
|
327
465
|
)
|
328
466
|
@click.option(
|
329
|
-
"--
|
467
|
+
"--manager-vision",
|
468
|
+
type=bool,
|
469
|
+
default=None,
|
470
|
+
help="Enable vision for Manager agent only",
|
330
471
|
)
|
331
472
|
@click.option(
|
332
|
-
"--
|
333
|
-
|
334
|
-
|
335
|
-
|
473
|
+
"--executor-vision",
|
474
|
+
type=bool,
|
475
|
+
default=None,
|
476
|
+
help="Enable vision for Executor agent only",
|
336
477
|
)
|
337
478
|
@click.option(
|
338
|
-
"--
|
479
|
+
"--codeact-vision",
|
480
|
+
type=bool,
|
481
|
+
default=None,
|
482
|
+
help="Enable vision for CodeAct agent only",
|
339
483
|
)
|
340
484
|
@click.option(
|
341
|
-
"--
|
485
|
+
"--reasoning", type=bool, default=None, help="Enable planning with reasoning"
|
486
|
+
)
|
487
|
+
@click.option(
|
488
|
+
"--tracing", type=bool, default=None, help="Enable Arize Phoenix tracing"
|
489
|
+
)
|
490
|
+
@click.option(
|
491
|
+
"--debug", type=bool, default=None, help="Enable verbose debug logging"
|
342
492
|
)
|
343
493
|
@click.option(
|
344
494
|
"--use-tcp",
|
345
|
-
|
495
|
+
type=bool,
|
496
|
+
default=None,
|
346
497
|
help="Use TCP communication for device control",
|
347
|
-
default=False,
|
348
498
|
)
|
349
499
|
@click.option(
|
350
500
|
"--save-trajectory",
|
351
501
|
type=click.Choice(["none", "step", "action"]),
|
352
502
|
help="Trajectory saving level: none (no saving), step (save per step), action (save per action)",
|
353
|
-
default=
|
503
|
+
default=None,
|
354
504
|
)
|
355
505
|
@click.option(
|
356
506
|
"--drag",
|
357
507
|
"allow_drag",
|
358
|
-
|
508
|
+
type=bool,
|
509
|
+
default=None,
|
359
510
|
help="Enable drag tool",
|
360
|
-
default=False,
|
361
511
|
)
|
362
|
-
@click.option("--ios",
|
512
|
+
@click.option("--ios", type=bool, default=None, help="Run on iOS device")
|
363
513
|
def run(
|
364
514
|
command: str,
|
365
515
|
device: str | None,
|
366
|
-
provider: str,
|
367
|
-
model: str,
|
368
|
-
steps: int,
|
369
|
-
base_url: str,
|
370
|
-
api_base: str,
|
371
|
-
temperature: float,
|
372
|
-
vision: bool,
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
516
|
+
provider: str | None,
|
517
|
+
model: str | None,
|
518
|
+
steps: int | None,
|
519
|
+
base_url: str | None,
|
520
|
+
api_base: str | None,
|
521
|
+
temperature: float | None,
|
522
|
+
vision: bool | None,
|
523
|
+
manager_vision: bool | None,
|
524
|
+
executor_vision: bool | None,
|
525
|
+
codeact_vision: bool | None,
|
526
|
+
reasoning: bool | None,
|
527
|
+
tracing: bool | None,
|
528
|
+
debug: bool | None,
|
529
|
+
use_tcp: bool | None,
|
530
|
+
save_trajectory: str | None,
|
531
|
+
allow_drag: bool | None,
|
532
|
+
ios: bool | None,
|
381
533
|
):
|
382
534
|
"""Run a command on your Android device using natural language."""
|
383
535
|
# Call our standalone function
|
@@ -390,15 +542,17 @@ def run(
|
|
390
542
|
base_url,
|
391
543
|
api_base,
|
392
544
|
vision,
|
545
|
+
manager_vision,
|
546
|
+
executor_vision,
|
547
|
+
codeact_vision,
|
393
548
|
reasoning,
|
394
|
-
reflection,
|
395
549
|
tracing,
|
396
550
|
debug,
|
397
551
|
use_tcp,
|
398
552
|
temperature=temperature,
|
399
553
|
save_trajectory=save_trajectory,
|
400
554
|
allow_drag=allow_drag,
|
401
|
-
ios=ios,
|
555
|
+
ios=ios if ios is not None else False,
|
402
556
|
)
|
403
557
|
|
404
558
|
|
@@ -496,9 +650,9 @@ def setup(path: str | None, device: str | None, debug: bool):
|
|
496
650
|
console.print(f"[bold red]Installation failed:[/] {e}")
|
497
651
|
return
|
498
652
|
|
499
|
-
console.print(
|
653
|
+
console.print("[bold green]Installation successful![/]")
|
500
654
|
|
501
|
-
console.print(
|
655
|
+
console.print("[bold blue]Step 2/2: Enabling accessibility service[/]")
|
502
656
|
|
503
657
|
try:
|
504
658
|
enable_portal_accessibility(device_obj)
|
@@ -585,7 +739,7 @@ cli.add_command(macro_cli, name="macro")
|
|
585
739
|
|
586
740
|
|
587
741
|
if __name__ == "__main__":
|
588
|
-
command = "
|
742
|
+
command = "Download clash royale app"
|
589
743
|
device = None
|
590
744
|
provider = "GoogleGenAI"
|
591
745
|
model = "models/gemini-2.5-flash"
|
@@ -594,32 +748,14 @@ if __name__ == "__main__":
|
|
594
748
|
steps = 15
|
595
749
|
vision = True
|
596
750
|
reasoning = True
|
597
|
-
reflection = False
|
598
751
|
tracing = True
|
599
752
|
debug = True
|
600
|
-
use_tcp =
|
753
|
+
use_tcp = False
|
601
754
|
base_url = None
|
602
755
|
api_base = None
|
603
756
|
ios = False
|
604
|
-
save_trajectory = "
|
757
|
+
save_trajectory = "none"
|
605
758
|
allow_drag = False
|
606
759
|
run_command(
|
607
|
-
command=command
|
608
|
-
device=device,
|
609
|
-
provider=provider,
|
610
|
-
model=model,
|
611
|
-
steps=steps,
|
612
|
-
temperature=temperature,
|
613
|
-
vision=vision,
|
614
|
-
reasoning=reasoning,
|
615
|
-
reflection=reflection,
|
616
|
-
tracing=tracing,
|
617
|
-
debug=debug,
|
618
|
-
use_tcp=use_tcp,
|
619
|
-
base_url=base_url,
|
620
|
-
api_base=api_base,
|
621
|
-
api_key=api_key,
|
622
|
-
allow_drag=allow_drag,
|
623
|
-
ios=ios,
|
624
|
-
save_trajectory=save_trajectory,
|
760
|
+
command=command
|
625
761
|
)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
from droidrun.config_manager.config_manager import (
|
2
|
+
ConfigManager,
|
3
|
+
config,
|
4
|
+
DroidRunConfig,
|
5
|
+
LLMProfile,
|
6
|
+
AgentConfig,
|
7
|
+
DeviceConfig,
|
8
|
+
TelemetryConfig,
|
9
|
+
TracingConfig,
|
10
|
+
LoggingConfig,
|
11
|
+
ToolsConfig,
|
12
|
+
)
|
13
|
+
|
14
|
+
__all__ = [
|
15
|
+
"ConfigManager",
|
16
|
+
"config",
|
17
|
+
"DroidRunConfig",
|
18
|
+
"LLMProfile",
|
19
|
+
"AgentConfig",
|
20
|
+
"DeviceConfig",
|
21
|
+
"TelemetryConfig",
|
22
|
+
"TracingConfig",
|
23
|
+
"LoggingConfig",
|
24
|
+
"ToolsConfig",
|
25
|
+
]
|