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.
- {oagi_core-0.9.1 → oagi_core-0.10.0}/Makefile +13 -9
- {oagi_core-0.9.1 → oagi_core-0.10.0}/PKG-INFO +38 -25
- {oagi_core-0.9.1 → oagi_core-0.10.0}/README.md +36 -24
- oagi_core-0.10.0/examples/execute_task_auto.py +37 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/examples/google_weather.py +1 -1
- oagi_core-0.10.0/examples/tasker_agent_example.py +79 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/metapackage/pyproject.toml +2 -2
- oagi_core-0.10.0/metapackage/uv.lock +1472 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/pyproject.toml +2 -1
- oagi_core-0.10.0/src/oagi/__init__.py +148 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/__init__.py +2 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/default.py +45 -12
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/factories.py +22 -3
- oagi_core-0.10.0/src/oagi/agent/observer/__init__.py +38 -0
- oagi_core-0.10.0/src/oagi/agent/observer/agent_observer.py +99 -0
- oagi_core-0.10.0/src/oagi/agent/observer/events.py +28 -0
- oagi_core-0.10.0/src/oagi/agent/observer/exporters.py +445 -0
- oagi_core-0.10.0/src/oagi/agent/observer/protocol.py +12 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/registry.py +2 -2
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/tasker/models.py +1 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/tasker/planner.py +41 -9
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/tasker/taskee_agent.py +178 -86
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/tasker/tasker_agent.py +25 -14
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/cli/agent.py +50 -9
- oagi_core-0.10.0/src/oagi/cli/tracking.py +55 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/cli/utils.py +11 -4
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/client/base.py +3 -7
- oagi_core-0.10.0/src/oagi/handler/_macos.py +55 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/handler/pyautogui_action_handler.py +19 -2
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/server/agent_wrappers.py +5 -5
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/server/config.py +3 -3
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/server/models.py +2 -2
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/server/session_store.py +2 -2
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/server/socketio_server.py +1 -1
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/task/async_.py +13 -34
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/task/async_short.py +2 -2
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/task/base.py +41 -7
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/task/short.py +2 -2
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/task/sync.py +11 -34
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/__init__.py +24 -4
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/async_image_provider.py +3 -2
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/image_provider.py +3 -2
- oagi_core-0.10.0/src/oagi/types/step_observer.py +93 -0
- oagi_core-0.10.0/src/oagi/types/url.py +3 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/conftest.py +5 -5
- oagi_core-0.9.1/tests/test_task.py → oagi_core-0.10.0/tests/test_actor.py +17 -5
- {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_agent/test_agent_wrappers.py +7 -7
- {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_agent/test_default_agent.py +39 -1
- {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_agent_registry.py +5 -5
- oagi_core-0.9.1/tests/test_async_task.py → oagi_core-0.10.0/tests/test_async_actor.py +24 -85
- {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_async_client.py +3 -2
- {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_cli.py +1 -1
- {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_logging.py +2 -2
- oagi_core-0.10.0/tests/test_mac_double_click.py +105 -0
- oagi_core-0.10.0/tests/test_observer.py +378 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_planner.py +1 -1
- {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_pyautogui_action_handler.py +73 -11
- {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_server/test_session_store.py +3 -3
- {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_sync_client.py +14 -6
- {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_taskee_agent.py +29 -18
- {oagi_core-0.9.1 → oagi_core-0.10.0}/uv.lock +4 -2
- oagi_core-0.9.1/examples/continued_session.py +0 -53
- oagi_core-0.9.1/examples/execute_task_auto.py +0 -42
- oagi_core-0.9.1/examples/hotel_booking.py +0 -52
- oagi_core-0.9.1/src/oagi/__init__.py +0 -105
- oagi_core-0.9.1/src/oagi/cli/tracking.py +0 -45
- oagi_core-0.9.1/src/oagi/types/step_observer.py +0 -34
- oagi_core-0.9.1/src/oagi/types/url_image.py +0 -47
- oagi_core-0.9.1/tests/test_short_task.py +0 -150
- oagi_core-0.9.1/tests/test_url_image.py +0 -41
- {oagi_core-0.9.1 → oagi_core-0.10.0}/.github/workflows/ci.yml +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/.github/workflows/release.yml +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/.gitignore +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/.python-version +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/CONTRIBUTING.md +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/LICENSE +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/examples/async_google_weather.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/examples/execute_task_manual.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/examples/screenshot_with_config.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/protocol.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/tasker/__init__.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/agent/tasker/memory.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/cli/__init__.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/cli/display.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/cli/main.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/cli/server.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/client/__init__.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/client/async_.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/client/sync.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/exceptions.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/handler/__init__.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/handler/async_pyautogui_action_handler.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/handler/async_screenshot_maker.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/handler/pil_image.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/handler/screenshot_maker.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/logging.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/server/__init__.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/server/main.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/task/__init__.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/action_handler.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/async_action_handler.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/image.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/models/__init__.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/models/action.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/models/client.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/models/image_config.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/src/oagi/types/models/step.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/__init__.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_async_handlers.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_pil_image.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_planner_memory.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_screenshot_maker.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_server/__init__.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_server/test_config.py +0 -0
- {oagi_core-0.9.1 → oagi_core-0.10.0}/tests/test_server/test_socketio_integration.py +0 -0
- {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 [ -
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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.
|
|
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.
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
###
|
|
136
|
+
### Manual Control with Actor
|
|
133
137
|
|
|
134
|
-
|
|
138
|
+
For step-by-step control over task execution:
|
|
135
139
|
|
|
136
140
|
```python
|
|
137
141
|
import asyncio
|
|
138
|
-
from oagi import
|
|
142
|
+
from oagi import AsyncActor, AsyncPyautoguiActionHandler, AsyncScreenshotMaker
|
|
139
143
|
|
|
140
144
|
async def main():
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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
|
-
- `
|
|
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.
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
###
|
|
94
|
+
### Manual Control with Actor
|
|
92
95
|
|
|
93
|
-
|
|
96
|
+
For step-by-step control over task execution:
|
|
94
97
|
|
|
95
98
|
```python
|
|
96
99
|
import asyncio
|
|
97
|
-
from oagi import
|
|
100
|
+
from oagi import AsyncActor, AsyncPyautoguiActionHandler, AsyncScreenshotMaker
|
|
98
101
|
|
|
99
102
|
async def main():
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
-
- `
|
|
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=
|
|
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.
|
|
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.
|
|
19
|
+
"oagi-core[desktop,server]==0.10.0",
|
|
20
20
|
]
|
|
21
21
|
|
|
22
22
|
[project.urls]
|