oagi-core 0.9.1__tar.gz → 0.10.0__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 (116) hide show
  1. {oagi_core-0.9.1 → oagi_core-0.10.0}/Makefile +13 -9
  2. {oagi_core-0.9.1 → oagi_core-0.10.0}/PKG-INFO +38 -25
  3. {oagi_core-0.9.1 → oagi_core-0.10.0}/README.md +36 -24
  4. oagi_core-0.10.0/examples/execute_task_auto.py +37 -0
  5. {oagi_core-0.9.1 → oagi_core-0.10.0}/examples/google_weather.py +1 -1
  6. oagi_core-0.10.0/examples/tasker_agent_example.py +79 -0
  7. {oagi_core-0.9.1 → oagi_core-0.10.0}/metapackage/pyproject.toml +2 -2
  8. oagi_core-0.10.0/metapackage/uv.lock +1472 -0
  9. {oagi_core-0.9.1 → oagi_core-0.10.0}/pyproject.toml +2 -1
  10. oagi_core-0.10.0/src/oagi/__init__.py +148 -0
  11. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/__init__.py +2 -0
  12. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/default.py +45 -12
  13. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/factories.py +22 -3
  14. oagi_core-0.10.0/src/oagi/agent/observer/__init__.py +38 -0
  15. oagi_core-0.10.0/src/oagi/agent/observer/agent_observer.py +99 -0
  16. oagi_core-0.10.0/src/oagi/agent/observer/events.py +28 -0
  17. oagi_core-0.10.0/src/oagi/agent/observer/exporters.py +445 -0
  18. oagi_core-0.10.0/src/oagi/agent/observer/protocol.py +12 -0
  19. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/registry.py +2 -2
  20. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/tasker/models.py +1 -0
  21. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/tasker/planner.py +41 -9
  22. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/tasker/taskee_agent.py +178 -86
  23. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/tasker/tasker_agent.py +25 -14
  24. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/cli/agent.py +50 -9
  25. oagi_core-0.10.0/src/oagi/cli/tracking.py +55 -0
  26. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/cli/utils.py +11 -4
  27. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/client/base.py +3 -7
  28. oagi_core-0.10.0/src/oagi/handler/_macos.py +55 -0
  29. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/handler/pyautogui_action_handler.py +19 -2
  30. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/server/agent_wrappers.py +5 -5
  31. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/server/config.py +3 -3
  32. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/server/models.py +2 -2
  33. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/server/session_store.py +2 -2
  34. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/server/socketio_server.py +1 -1
  35. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/task/async_.py +13 -34
  36. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/task/async_short.py +2 -2
  37. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/task/base.py +41 -7
  38. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/task/short.py +2 -2
  39. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/task/sync.py +11 -34
  40. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/__init__.py +24 -4
  41. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/async_image_provider.py +3 -2
  42. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/image_provider.py +3 -2
  43. oagi_core-0.10.0/src/oagi/types/step_observer.py +93 -0
  44. oagi_core-0.10.0/src/oagi/types/url.py +3 -0
  45. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/conftest.py +5 -5
  46. oagi_core-0.9.1/tests/test_task.py → oagi_core-0.10.0/tests/test_actor.py +17 -5
  47. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_agent/test_agent_wrappers.py +7 -7
  48. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_agent/test_default_agent.py +39 -1
  49. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_agent_registry.py +5 -5
  50. oagi_core-0.9.1/tests/test_async_task.py → oagi_core-0.10.0/tests/test_async_actor.py +24 -85
  51. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_async_client.py +3 -2
  52. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_cli.py +1 -1
  53. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_logging.py +2 -2
  54. oagi_core-0.10.0/tests/test_mac_double_click.py +105 -0
  55. oagi_core-0.10.0/tests/test_observer.py +378 -0
  56. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_planner.py +1 -1
  57. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_pyautogui_action_handler.py +73 -11
  58. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_server/test_session_store.py +3 -3
  59. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_sync_client.py +14 -6
  60. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_taskee_agent.py +29 -18
  61. {oagi_core-0.9.1 → oagi_core-0.10.0}/uv.lock +4 -2
  62. oagi_core-0.9.1/examples/continued_session.py +0 -53
  63. oagi_core-0.9.1/examples/execute_task_auto.py +0 -42
  64. oagi_core-0.9.1/examples/hotel_booking.py +0 -52
  65. oagi_core-0.9.1/src/oagi/__init__.py +0 -105
  66. oagi_core-0.9.1/src/oagi/cli/tracking.py +0 -45
  67. oagi_core-0.9.1/src/oagi/types/step_observer.py +0 -34
  68. oagi_core-0.9.1/src/oagi/types/url_image.py +0 -47
  69. oagi_core-0.9.1/tests/test_short_task.py +0 -150
  70. oagi_core-0.9.1/tests/test_url_image.py +0 -41
  71. {oagi_core-0.9.1 → oagi_core-0.10.0}/.github/workflows/ci.yml +0 -0
  72. {oagi_core-0.9.1 → oagi_core-0.10.0}/.github/workflows/release.yml +0 -0
  73. {oagi_core-0.9.1 → oagi_core-0.10.0}/.gitignore +0 -0
  74. {oagi_core-0.9.1 → oagi_core-0.10.0}/.python-version +0 -0
  75. {oagi_core-0.9.1 → oagi_core-0.10.0}/CONTRIBUTING.md +0 -0
  76. {oagi_core-0.9.1 → oagi_core-0.10.0}/LICENSE +0 -0
  77. {oagi_core-0.9.1 → oagi_core-0.10.0}/examples/async_google_weather.py +0 -0
  78. {oagi_core-0.9.1 → oagi_core-0.10.0}/examples/execute_task_manual.py +0 -0
  79. {oagi_core-0.9.1 → oagi_core-0.10.0}/examples/screenshot_with_config.py +0 -0
  80. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/protocol.py +0 -0
  81. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/tasker/__init__.py +0 -0
  82. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/tasker/memory.py +0 -0
  83. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/cli/__init__.py +0 -0
  84. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/cli/display.py +0 -0
  85. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/cli/main.py +0 -0
  86. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/cli/server.py +0 -0
  87. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/client/__init__.py +0 -0
  88. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/client/async_.py +0 -0
  89. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/client/sync.py +0 -0
  90. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/exceptions.py +0 -0
  91. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/handler/__init__.py +0 -0
  92. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/handler/async_pyautogui_action_handler.py +0 -0
  93. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/handler/async_screenshot_maker.py +0 -0
  94. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/handler/pil_image.py +0 -0
  95. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/handler/screenshot_maker.py +0 -0
  96. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/logging.py +0 -0
  97. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/server/__init__.py +0 -0
  98. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/server/main.py +0 -0
  99. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/task/__init__.py +0 -0
  100. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/action_handler.py +0 -0
  101. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/async_action_handler.py +0 -0
  102. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/image.py +0 -0
  103. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/models/__init__.py +0 -0
  104. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/models/action.py +0 -0
  105. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/models/client.py +0 -0
  106. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/models/image_config.py +0 -0
  107. {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/models/step.py +0 -0
  108. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/__init__.py +0 -0
  109. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_async_handlers.py +0 -0
  110. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_pil_image.py +0 -0
  111. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_planner_memory.py +0 -0
  112. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_screenshot_maker.py +0 -0
  113. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_server/__init__.py +0 -0
  114. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_server/test_config.py +0 -0
  115. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_server/test_socketio_integration.py +0 -0
  116. {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_tasker_agent.py +0 -0
@@ -46,13 +46,17 @@ test-verbose: .uv install-dev
46
46
 
47
47
  .PHONY: version
48
48
  version:
49
- @if [ -z "$(VERSION)" ]; then \
50
- echo "Usage: make version VERSION=x.y.z"; \
51
- echo "Current version: $$(grep '^version = ' pyproject.toml | head -1 | cut -d'"' -f2)"; \
49
+ @if [ -n "$(filter-out $@,$(MAKECMDGOALS))" ]; then \
50
+ VERSION=$(filter-out $@,$(MAKECMDGOALS)); \
51
+ else \
52
+ echo "Usage: make version <version>"; \
52
53
  exit 1; \
53
- fi
54
- @echo "Updating version to $(VERSION) in all files..."
55
- @sed -i '' 's/^version = ".*"/version = "$(VERSION)"/' pyproject.toml
56
- @sed -i '' 's/^version = ".*"/version = "$(VERSION)"/' metapackage/pyproject.toml
57
- @sed -i '' 's/oagi-core\[desktop,server\]==.*/oagi-core[desktop,server]==$(VERSION)",/' metapackage/pyproject.toml
58
- make build-all
54
+ fi; \
55
+ echo "Updating version to $$VERSION..."; \
56
+ uv version $$VERSION; \
57
+ (cd metapackage && uv version $$VERSION); \
58
+ sed -i '' 's/oagi-core\[desktop,server\]==.*/oagi-core[desktop,server]=='$$VERSION'",/' metapackage/pyproject.toml; \
59
+ make build-all
60
+
61
+ %:
62
+ @:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: oagi-core
3
- Version: 0.9.1
3
+ Version: 0.10.0
4
4
  Summary: Official API of OpenAGI Foundation
5
5
  Project-URL: Homepage, https://github.com/agiopen-org/oagi
6
6
  Author-email: OpenAGI Foundation <contact@agiopen.org>
@@ -32,6 +32,7 @@ Requires-Dist: rich>=13.0.0
32
32
  Provides-Extra: desktop
33
33
  Requires-Dist: pillow>=11.3.0; extra == 'desktop'
34
34
  Requires-Dist: pyautogui>=0.9.54; extra == 'desktop'
35
+ Requires-Dist: pyobjc-framework-quartz>=9.0; (sys_platform == 'darwin') and extra == 'desktop'
35
36
  Provides-Extra: server
36
37
  Requires-Dist: fastapi[standard]>=0.115.0; extra == 'server'
37
38
  Requires-Dist: pydantic-settings>=2.0.0; extra == 'server'
@@ -72,8 +73,8 @@ pip install oagi-core[server] # Server support
72
73
 
73
74
  Set your API credentials:
74
75
  ```bash
75
- export OAGI_API_KEY="your-api-key"
76
- export OAGI_BASE_URL="https://api.oagi.com" # or your server URL
76
+ export OAGI_API_KEY="your-api-key" # get your API key from https://developer.openagi.org/
77
+ # export OAGI_BASE_URL="https://api.agiopen.org/", # optional, defaults to production endpoint
77
78
  ```
78
79
 
79
80
  ### Automated Task Execution
@@ -81,21 +82,25 @@ export OAGI_BASE_URL="https://api.oagi.com" # or your server URL
81
82
  Run tasks automatically with screenshot capture and action execution:
82
83
 
83
84
  ```python
84
- from oagi import ShortTask, ScreenshotMaker, PyautoguiActionHandler
85
-
86
- task = ShortTask()
87
- completed = task.auto_mode(
88
- "Search weather on Google",
89
- max_steps=10,
90
- executor=PyautoguiActionHandler(), # Executes mouse/keyboard actions
91
- image_provider=ScreenshotMaker(), # Captures screenshots
92
- )
85
+ import asyncio
86
+ from oagi import AsyncDefaultAgent, AsyncPyautoguiActionHandler, AsyncScreenshotMaker
87
+
88
+ async def main():
89
+ agent = AsyncDefaultAgent(max_steps=10)
90
+ completed = await agent.execute(
91
+ "Search weather on Google",
92
+ action_handler=AsyncPyautoguiActionHandler(), # Executes mouse/keyboard actions
93
+ image_provider=AsyncScreenshotMaker(), # Captures screenshots
94
+ )
95
+ return completed
96
+
97
+ asyncio.run(main())
93
98
  ```
94
99
 
95
100
  Configure PyAutoGUI behavior with custom settings:
96
101
 
97
102
  ```python
98
- from oagi import PyautoguiActionHandler, PyautoguiConfig
103
+ from oagi import AsyncPyautoguiActionHandler, PyautoguiConfig
99
104
 
100
105
  # Customize action behavior
101
106
  config = PyautoguiConfig(
@@ -107,8 +112,7 @@ config = PyautoguiConfig(
107
112
  capslock_mode="session" # Caps lock mode: 'session' or 'system' (default: 'session')
108
113
  )
109
114
 
110
- executor = PyautoguiActionHandler(config=config)
111
- task.auto_mode("Complete form", executor=executor, image_provider=ScreenshotMaker())
115
+ action_handler = AsyncPyautoguiActionHandler(config=config)
112
116
  ```
113
117
 
114
118
  ### Image Processing
@@ -129,20 +133,28 @@ config = ImageConfig(
129
133
  compressed = image.transform(config)
130
134
  ```
131
135
 
132
- ### Async Support
136
+ ### Manual Control with Actor
133
137
 
134
- Use async client for non-blocking operations and better concurrency:
138
+ For step-by-step control over task execution:
135
139
 
136
140
  ```python
137
141
  import asyncio
138
- from oagi import AsyncShortTask
142
+ from oagi import AsyncActor, AsyncPyautoguiActionHandler, AsyncScreenshotMaker
139
143
 
140
144
  async def main():
141
- # Async task automation
142
- task = AsyncShortTask()
143
- async with task:
144
- await task.init_task("Complete the form")
145
- # ... continue with async operations
145
+ async with AsyncActor() as actor:
146
+ await actor.init_task("Complete the form")
147
+ image_provider = AsyncScreenshotMaker()
148
+ action_handler = AsyncPyautoguiActionHandler()
149
+
150
+ for _ in range(10):
151
+ image = await image_provider()
152
+ step = await actor.step(image)
153
+
154
+ if step.stop:
155
+ break
156
+
157
+ await action_handler(step.actions)
146
158
 
147
159
  asyncio.run(main())
148
160
  ```
@@ -150,9 +162,10 @@ asyncio.run(main())
150
162
  ## Examples
151
163
 
152
164
  See the [`examples/`](examples/) directory for more usage patterns:
153
- - `google_weather.py` - Basic task execution with `ShortTask`
165
+ - `execute_task_auto.py` - Automated task execution with `AsyncDefaultAgent`
166
+ - `execute_task_manual.py` - Manual step-by-step control with `Actor`
167
+ - `continued_session.py` - Continuing tasks across sessions
154
168
  - `screenshot_with_config.py` - Image compression and optimization
155
- - `execute_task_auto.py` - Automated task execution
156
169
  - `socketio_server_basic.py` - Socket.IO server example
157
170
  - `socketio_client_example.py` - Socket.IO client implementation
158
171
 
@@ -31,8 +31,8 @@ pip install oagi-core[server] # Server support
31
31
 
32
32
  Set your API credentials:
33
33
  ```bash
34
- export OAGI_API_KEY="your-api-key"
35
- export OAGI_BASE_URL="https://api.oagi.com" # or your server URL
34
+ export OAGI_API_KEY="your-api-key" # get your API key from https://developer.openagi.org/
35
+ # export OAGI_BASE_URL="https://api.agiopen.org/", # optional, defaults to production endpoint
36
36
  ```
37
37
 
38
38
  ### Automated Task Execution
@@ -40,21 +40,25 @@ export OAGI_BASE_URL="https://api.oagi.com" # or your server URL
40
40
  Run tasks automatically with screenshot capture and action execution:
41
41
 
42
42
  ```python
43
- from oagi import ShortTask, ScreenshotMaker, PyautoguiActionHandler
44
-
45
- task = ShortTask()
46
- completed = task.auto_mode(
47
- "Search weather on Google",
48
- max_steps=10,
49
- executor=PyautoguiActionHandler(), # Executes mouse/keyboard actions
50
- image_provider=ScreenshotMaker(), # Captures screenshots
51
- )
43
+ import asyncio
44
+ from oagi import AsyncDefaultAgent, AsyncPyautoguiActionHandler, AsyncScreenshotMaker
45
+
46
+ async def main():
47
+ agent = AsyncDefaultAgent(max_steps=10)
48
+ completed = await agent.execute(
49
+ "Search weather on Google",
50
+ action_handler=AsyncPyautoguiActionHandler(), # Executes mouse/keyboard actions
51
+ image_provider=AsyncScreenshotMaker(), # Captures screenshots
52
+ )
53
+ return completed
54
+
55
+ asyncio.run(main())
52
56
  ```
53
57
 
54
58
  Configure PyAutoGUI behavior with custom settings:
55
59
 
56
60
  ```python
57
- from oagi import PyautoguiActionHandler, PyautoguiConfig
61
+ from oagi import AsyncPyautoguiActionHandler, PyautoguiConfig
58
62
 
59
63
  # Customize action behavior
60
64
  config = PyautoguiConfig(
@@ -66,8 +70,7 @@ config = PyautoguiConfig(
66
70
  capslock_mode="session" # Caps lock mode: 'session' or 'system' (default: 'session')
67
71
  )
68
72
 
69
- executor = PyautoguiActionHandler(config=config)
70
- task.auto_mode("Complete form", executor=executor, image_provider=ScreenshotMaker())
73
+ action_handler = AsyncPyautoguiActionHandler(config=config)
71
74
  ```
72
75
 
73
76
  ### Image Processing
@@ -88,20 +91,28 @@ config = ImageConfig(
88
91
  compressed = image.transform(config)
89
92
  ```
90
93
 
91
- ### Async Support
94
+ ### Manual Control with Actor
92
95
 
93
- Use async client for non-blocking operations and better concurrency:
96
+ For step-by-step control over task execution:
94
97
 
95
98
  ```python
96
99
  import asyncio
97
- from oagi import AsyncShortTask
100
+ from oagi import AsyncActor, AsyncPyautoguiActionHandler, AsyncScreenshotMaker
98
101
 
99
102
  async def main():
100
- # Async task automation
101
- task = AsyncShortTask()
102
- async with task:
103
- await task.init_task("Complete the form")
104
- # ... continue with async operations
103
+ async with AsyncActor() as actor:
104
+ await actor.init_task("Complete the form")
105
+ image_provider = AsyncScreenshotMaker()
106
+ action_handler = AsyncPyautoguiActionHandler()
107
+
108
+ for _ in range(10):
109
+ image = await image_provider()
110
+ step = await actor.step(image)
111
+
112
+ if step.stop:
113
+ break
114
+
115
+ await action_handler(step.actions)
105
116
 
106
117
  asyncio.run(main())
107
118
  ```
@@ -109,9 +120,10 @@ asyncio.run(main())
109
120
  ## Examples
110
121
 
111
122
  See the [`examples/`](examples/) directory for more usage patterns:
112
- - `google_weather.py` - Basic task execution with `ShortTask`
123
+ - `execute_task_auto.py` - Automated task execution with `AsyncDefaultAgent`
124
+ - `execute_task_manual.py` - Manual step-by-step control with `Actor`
125
+ - `continued_session.py` - Continuing tasks across sessions
113
126
  - `screenshot_with_config.py` - Image compression and optimization
114
- - `execute_task_auto.py` - Automated task execution
115
127
  - `socketio_server_basic.py` - Socket.IO server example
116
128
  - `socketio_client_example.py` - Socket.IO client implementation
117
129
 
@@ -0,0 +1,37 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Copyright (c) OpenAGI Foundation
3
+ # All rights reserved.
4
+ #
5
+ # This file is part of the official API project.
6
+ # Licensed under the MIT License.
7
+ # -----------------------------------------------------------------------------
8
+ import asyncio
9
+
10
+ from oagi import (
11
+ AsyncDefaultAgent,
12
+ AsyncPyautoguiActionHandler,
13
+ AsyncScreenshotMaker,
14
+ )
15
+
16
+
17
+ def execute_task_auto(task_desc, max_steps=5):
18
+ """Synchronous wrapper for async task execution."""
19
+ return asyncio.run(async_execute_task_auto(task_desc, max_steps))
20
+
21
+
22
+ async def async_execute_task_auto(task_desc, max_steps=5):
23
+ # set OAGI_API_KEY and OAGI_BASE_URL
24
+ # or AsyncDefaultAgent(api_key="your_api_key", base_url="your_base_url")
25
+ agent = AsyncDefaultAgent(max_steps=max_steps)
26
+
27
+ # executor = lambda actions: print(actions) for debugging
28
+ action_handler = AsyncPyautoguiActionHandler()
29
+ image_provider = AsyncScreenshotMaker()
30
+
31
+ is_completed = await agent.execute(
32
+ task_desc,
33
+ action_handler=action_handler,
34
+ image_provider=image_provider,
35
+ )
36
+
37
+ return is_completed, await image_provider.last_image()
@@ -9,7 +9,7 @@
9
9
  from examples.execute_task_manual import execute_task_manual
10
10
 
11
11
  is_completed, screenshot = execute_task_manual(
12
- desc := "Search weather with Google", max_steps=5
12
+ desc := "Search weather with Google", max_steps=10
13
13
  )
14
14
 
15
15
  print(f"is_completed: {is_completed}, desc: {desc}")
@@ -0,0 +1,79 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Copyright (c) OpenAGI Foundation
3
+ # All rights reserved.
4
+ #
5
+ # This file is part of the official API project.
6
+ # Licensed under the MIT License.
7
+ # -----------------------------------------------------------------------------
8
+
9
+ import asyncio
10
+ import os
11
+ import traceback
12
+
13
+ from oagi import (
14
+ AsyncAgentObserver,
15
+ AsyncPyautoguiActionHandler,
16
+ AsyncScreenshotMaker,
17
+ TaskerAgent,
18
+ )
19
+
20
+
21
+ async def main():
22
+ # Create observer for recording execution history
23
+ observer = AsyncAgentObserver()
24
+
25
+ # Initialize the tasker agent
26
+ # Note: Ensure OAGI_API_KEY and OAGI_BASE_URL environment variables are set
27
+ tasker = TaskerAgent(
28
+ api_key=os.getenv("OAGI_API_KEY"),
29
+ base_url=os.getenv("OAGI_BASE_URL", "https://api.agiopen.org"),
30
+ model="lux-actor-1",
31
+ max_steps=30,
32
+ temperature=0.5,
33
+ step_observer=observer,
34
+ )
35
+
36
+ # Define the task with multiple todos
37
+ task_description = "Open a web browser and search for information about Python"
38
+
39
+ # Break down into specific todos
40
+ todos = [
41
+ "Search for 'Python programming language'",
42
+ "Click on the official Python.org website link",
43
+ ]
44
+
45
+ # Define deliverables to achieve
46
+ deliverables = [
47
+ "Python.org website is opened",
48
+ ]
49
+
50
+ # Set the task
51
+ tasker.set_task(
52
+ task=task_description,
53
+ todos=todos,
54
+ deliverables=deliverables,
55
+ )
56
+
57
+ image_provider = AsyncScreenshotMaker()
58
+ action_handler = AsyncPyautoguiActionHandler()
59
+
60
+ try:
61
+ # Execute the task
62
+ success = await tasker.execute(
63
+ instruction="",
64
+ action_handler=action_handler,
65
+ image_provider=image_provider,
66
+ )
67
+ print(f"Tasker success: {success}")
68
+
69
+ except Exception as e:
70
+ print(f"\nError during execution: {e}")
71
+ traceback.print_exc()
72
+
73
+ observer.export("html", export_file := "export.html")
74
+ print(f"\nExecution history exported: {export_file}")
75
+
76
+
77
+ if __name__ == "__main__":
78
+ # Run the async main function
79
+ asyncio.run(main())
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "oagi"
7
- version = "0.9.1"
7
+ version = "0.10.0"
8
8
  description = "Official API of OpenAGI Foundation (metapackage with all features)"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -16,7 +16,7 @@ authors = [
16
16
  requires-python = ">= 3.10"
17
17
 
18
18
  dependencies = [
19
- "oagi-core[desktop,server]==0.9.1",
19
+ "oagi-core[desktop,server]==0.10.0",
20
20
  ]
21
21
 
22
22
  [project.urls]