droidrun 0.1.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.
Files changed (58) hide show
  1. droidrun/__init__.py +22 -10
  2. droidrun/__main__.py +1 -2
  3. droidrun/adb/__init__.py +3 -3
  4. droidrun/adb/device.py +2 -2
  5. droidrun/adb/manager.py +2 -2
  6. droidrun/agent/__init__.py +5 -15
  7. droidrun/agent/codeact/__init__.py +11 -0
  8. droidrun/agent/codeact/codeact_agent.py +420 -0
  9. droidrun/agent/codeact/events.py +28 -0
  10. droidrun/agent/codeact/prompts.py +26 -0
  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/context/todo.txt +4 -0
  25. droidrun/agent/droid/__init__.py +13 -0
  26. droidrun/agent/droid/droid_agent.py +357 -0
  27. droidrun/agent/droid/events.py +28 -0
  28. droidrun/agent/oneflows/reflector.py +265 -0
  29. droidrun/agent/planner/__init__.py +13 -0
  30. droidrun/agent/planner/events.py +16 -0
  31. droidrun/agent/planner/planner_agent.py +268 -0
  32. droidrun/agent/planner/prompts.py +124 -0
  33. droidrun/agent/utils/__init__.py +3 -0
  34. droidrun/agent/utils/async_utils.py +17 -0
  35. droidrun/agent/utils/chat_utils.py +312 -0
  36. droidrun/agent/utils/executer.py +132 -0
  37. droidrun/agent/utils/llm_picker.py +147 -0
  38. droidrun/agent/utils/trajectory.py +184 -0
  39. droidrun/cli/__init__.py +1 -1
  40. droidrun/cli/logs.py +283 -0
  41. droidrun/cli/main.py +358 -149
  42. droidrun/run.py +105 -0
  43. droidrun/tools/__init__.py +4 -30
  44. droidrun/tools/adb.py +879 -0
  45. droidrun/tools/ios.py +594 -0
  46. droidrun/tools/tools.py +99 -0
  47. droidrun-0.3.0.dist-info/METADATA +149 -0
  48. droidrun-0.3.0.dist-info/RECORD +52 -0
  49. droidrun/agent/llm_reasoning.py +0 -567
  50. droidrun/agent/react_agent.py +0 -556
  51. droidrun/llm/__init__.py +0 -24
  52. droidrun/tools/actions.py +0 -854
  53. droidrun/tools/device.py +0 -29
  54. droidrun-0.1.0.dist-info/METADATA +0 -276
  55. droidrun-0.1.0.dist-info/RECORD +0 -20
  56. {droidrun-0.1.0.dist-info → droidrun-0.3.0.dist-info}/WHEEL +0 -0
  57. {droidrun-0.1.0.dist-info → droidrun-0.3.0.dist-info}/entry_points.txt +0 -0
  58. {droidrun-0.1.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())
@@ -2,34 +2,8 @@
2
2
  DroidRun Tools - Core functionality for Android device control.
3
3
  """
4
4
 
5
- from .device import DeviceManager
6
- from .actions import (
7
- tap,
8
- swipe,
9
- input_text,
10
- press_key,
11
- start_app,
12
- install_app,
13
- uninstall_app,
14
- take_screenshot,
15
- list_packages,
16
- get_clickables,
17
- complete,
18
- extract,
19
- )
5
+ from droidrun.tools.tools import Tools, describe_tools
6
+ from droidrun.tools.adb import AdbTools
7
+ from droidrun.tools.ios import IOSTools
20
8
 
21
- __all__ = [
22
- 'DeviceManager',
23
- 'tap',
24
- 'swipe',
25
- 'input_text',
26
- 'press_key',
27
- 'start_app',
28
- 'install_app',
29
- 'uninstall_app',
30
- 'take_screenshot',
31
- 'list_packages',
32
- 'get_clickables',
33
- 'complete',
34
- 'extract',
35
- ]
9
+ __all__ = ["Tools", "describe_tools", "AdbTools", "IOSTools"]