droidrun 0.2.0__py3-none-any.whl → 0.3.0__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 +16 -11
- droidrun/__main__.py +1 -1
- droidrun/adb/__init__.py +3 -3
- droidrun/adb/device.py +1 -1
- droidrun/adb/manager.py +2 -2
- droidrun/agent/__init__.py +6 -0
- droidrun/agent/codeact/__init__.py +2 -4
- droidrun/agent/codeact/codeact_agent.py +321 -235
- droidrun/agent/codeact/events.py +12 -20
- droidrun/agent/codeact/prompts.py +0 -52
- droidrun/agent/common/default.py +5 -0
- droidrun/agent/common/events.py +4 -0
- droidrun/agent/context/__init__.py +23 -0
- droidrun/agent/context/agent_persona.py +15 -0
- droidrun/agent/context/context_injection_manager.py +66 -0
- droidrun/agent/context/episodic_memory.py +15 -0
- droidrun/agent/context/personas/__init__.py +11 -0
- droidrun/agent/context/personas/app_starter.py +44 -0
- droidrun/agent/context/personas/default.py +95 -0
- droidrun/agent/context/personas/extractor.py +52 -0
- droidrun/agent/context/personas/ui_expert.py +107 -0
- droidrun/agent/context/reflection.py +20 -0
- droidrun/agent/context/task_manager.py +124 -0
- droidrun/agent/context/todo.txt +4 -0
- droidrun/agent/droid/__init__.py +2 -2
- droidrun/agent/droid/droid_agent.py +264 -325
- droidrun/agent/droid/events.py +28 -0
- droidrun/agent/oneflows/reflector.py +265 -0
- droidrun/agent/planner/__init__.py +2 -4
- droidrun/agent/planner/events.py +9 -13
- droidrun/agent/planner/planner_agent.py +268 -0
- droidrun/agent/planner/prompts.py +33 -53
- droidrun/agent/utils/__init__.py +3 -0
- droidrun/agent/utils/async_utils.py +1 -40
- droidrun/agent/utils/chat_utils.py +268 -48
- droidrun/agent/utils/executer.py +49 -14
- droidrun/agent/utils/llm_picker.py +14 -10
- droidrun/agent/utils/trajectory.py +184 -0
- droidrun/cli/__init__.py +1 -1
- droidrun/cli/logs.py +283 -0
- droidrun/cli/main.py +333 -439
- droidrun/run.py +105 -0
- droidrun/tools/__init__.py +5 -10
- droidrun/tools/{actions.py → adb.py} +279 -238
- droidrun/tools/ios.py +594 -0
- droidrun/tools/tools.py +99 -0
- droidrun-0.3.0.dist-info/METADATA +149 -0
- droidrun-0.3.0.dist-info/RECORD +52 -0
- droidrun/agent/planner/task_manager.py +0 -355
- droidrun/agent/planner/workflow.py +0 -371
- droidrun/tools/device.py +0 -29
- droidrun/tools/loader.py +0 -60
- droidrun-0.2.0.dist-info/METADATA +0 -373
- droidrun-0.2.0.dist-info/RECORD +0 -32
- {droidrun-0.2.0.dist-info → droidrun-0.3.0.dist-info}/WHEEL +0 -0
- {droidrun-0.2.0.dist-info → droidrun-0.3.0.dist-info}/entry_points.txt +0 -0
- {droidrun-0.2.0.dist-info → droidrun-0.3.0.dist-info}/licenses/LICENSE +0 -0
droidrun/run.py
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
Minimal script to create and run a DroidAgent
|
4
|
+
"""
|
5
|
+
|
6
|
+
import asyncio
|
7
|
+
import os
|
8
|
+
import sys
|
9
|
+
|
10
|
+
# Add the current directory to Python path so we can import droidrun
|
11
|
+
sys.path.insert(0, '/home/sleyn/projects/droidrun')
|
12
|
+
|
13
|
+
async def main():
|
14
|
+
try:
|
15
|
+
# Import required modules
|
16
|
+
from droidrun.agent.droid import DroidAgent
|
17
|
+
from droidrun.agent.utils.llm_picker import load_llm
|
18
|
+
from droidrun.tools.adb import DeviceManager, AdbTools
|
19
|
+
from droidrun.agent.context.personas import DEFAULT, APP_STARTER_EXPERT
|
20
|
+
|
21
|
+
# Configuration
|
22
|
+
goal = """Open the notes app and create a new note"""
|
23
|
+
provider = "Gemini" # Change this to your preferred provider
|
24
|
+
model = "models/gemini-2.5-flash-preview-05-20"
|
25
|
+
|
26
|
+
# Check for API key
|
27
|
+
api_key = os.getenv("GEMINI_API_KEY") #os.getenv("GEMINI_API_KEY")
|
28
|
+
if not api_key:
|
29
|
+
print("❌ Please set GEMINI_API_KEY environment variable")
|
30
|
+
print(" Example: export GEMINI_API_KEY='your-api-key-here'")
|
31
|
+
return
|
32
|
+
|
33
|
+
print(f"🎯 Goal: {goal}")
|
34
|
+
print(f"🤖 Using {provider} with model {model}")
|
35
|
+
|
36
|
+
# Find a connected device
|
37
|
+
device_manager = DeviceManager()
|
38
|
+
devices = await device_manager.list_devices()
|
39
|
+
|
40
|
+
#if not devices:
|
41
|
+
# print("❌ No Android devices found. Please connect a device via ADB.")
|
42
|
+
# print(" Try: adb devices")
|
43
|
+
# return
|
44
|
+
|
45
|
+
device_serial = devices[0].serial
|
46
|
+
#"http://localhost:6643"using the CLI and
|
47
|
+
#device_serial = "http://192.168.100.91:6643"
|
48
|
+
print(f"📱 Using device: {device_serial}")
|
49
|
+
|
50
|
+
# Initialize LLM
|
51
|
+
print("🧠 Initializing LLM...")
|
52
|
+
llm = load_llm(
|
53
|
+
provider_name=provider,
|
54
|
+
model=model,
|
55
|
+
api_key=api_key,
|
56
|
+
temperature=0.2
|
57
|
+
)
|
58
|
+
|
59
|
+
tools = AdbTools(serial=device_serial)
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
# Create DroidAgent
|
64
|
+
print("🤖 Creating DroidAgent...")
|
65
|
+
agent = DroidAgent(
|
66
|
+
goal=goal,
|
67
|
+
llm=llm,
|
68
|
+
tools=tools,
|
69
|
+
max_steps=100,
|
70
|
+
timeout=3000,
|
71
|
+
reasoning=False,
|
72
|
+
debug=True,
|
73
|
+
save_trajectories=True,
|
74
|
+
enable_tracing=False
|
75
|
+
)
|
76
|
+
|
77
|
+
# Run the agent
|
78
|
+
print("🚀 Running agent...")
|
79
|
+
handler = agent.run()
|
80
|
+
async for nested_ev in handler.stream_events():
|
81
|
+
print(f"EXTERNAL EVENT: {nested_ev.__class__.__name__}")
|
82
|
+
|
83
|
+
result = await handler
|
84
|
+
|
85
|
+
# Print results
|
86
|
+
if result.get("success"):
|
87
|
+
print(f"✅ Success: {result.get('reason', 'Goal completed')}")
|
88
|
+
else:
|
89
|
+
print(f"❌ Failed: {result.get('reason', 'Unknown error')}")
|
90
|
+
|
91
|
+
print(f"📊 Steps taken: {result.get('steps', 0)}")
|
92
|
+
|
93
|
+
if result.get("trajectory"):
|
94
|
+
print(f"📝 Trajectory has {len(result['trajectory'])} steps")
|
95
|
+
|
96
|
+
except ImportError as e:
|
97
|
+
print(f"❌ Import error: {e}")
|
98
|
+
print(" Make sure you're in the droidrun project directory")
|
99
|
+
except Exception as e:
|
100
|
+
print(f"❌ Error: {e}")
|
101
|
+
import traceback
|
102
|
+
traceback.print_exc()
|
103
|
+
|
104
|
+
if __name__ == "__main__":
|
105
|
+
asyncio.run(main())
|
droidrun/tools/__init__.py
CHANGED
@@ -2,13 +2,8 @@
|
|
2
2
|
DroidRun Tools - Core functionality for Android device control.
|
3
3
|
"""
|
4
4
|
|
5
|
-
from .
|
6
|
-
from .
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
__all__ = [
|
11
|
-
'DeviceManager',
|
12
|
-
'Tools',
|
13
|
-
'load_tools'
|
14
|
-
]
|
5
|
+
from droidrun.tools.tools import Tools, describe_tools
|
6
|
+
from droidrun.tools.adb import AdbTools
|
7
|
+
from droidrun.tools.ios import IOSTools
|
8
|
+
|
9
|
+
__all__ = ["Tools", "describe_tools", "AdbTools", "IOSTools"]
|