oagi-core 0.14.0__py3-none-any.whl → 0.14.1__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.
- oagi/agent/default.py +4 -6
- oagi/agent/tasker/taskee_agent.py +4 -6
- oagi/handler/async_pyautogui_action_handler.py +2 -1
- oagi/handler/pyautogui_action_handler.py +11 -0
- oagi/handler/utils.py +14 -0
- oagi/handler/ydotool_action_handler.py +11 -0
- {oagi_core-0.14.0.dist-info → oagi_core-0.14.1.dist-info}/METADATA +14 -10
- {oagi_core-0.14.0.dist-info → oagi_core-0.14.1.dist-info}/RECORD +11 -11
- {oagi_core-0.14.0.dist-info → oagi_core-0.14.1.dist-info}/WHEEL +0 -0
- {oagi_core-0.14.0.dist-info → oagi_core-0.14.1.dist-info}/entry_points.txt +0 -0
- {oagi_core-0.14.0.dist-info → oagi_core-0.14.1.dist-info}/licenses/LICENSE +0 -0
oagi/agent/default.py
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
# Licensed under the MIT License.
|
|
7
7
|
# -----------------------------------------------------------------------------
|
|
8
8
|
|
|
9
|
-
import asyncio
|
|
10
9
|
import logging
|
|
11
10
|
|
|
12
11
|
from .. import AsyncActor
|
|
@@ -16,7 +15,7 @@ from ..constants import (
|
|
|
16
15
|
DEFAULT_TEMPERATURE,
|
|
17
16
|
MODEL_ACTOR,
|
|
18
17
|
)
|
|
19
|
-
from ..handler.utils import reset_handler
|
|
18
|
+
from ..handler.utils import configure_handler_delay, reset_handler
|
|
20
19
|
from ..types import (
|
|
21
20
|
ActionEvent,
|
|
22
21
|
AsyncActionHandler,
|
|
@@ -72,6 +71,9 @@ class AsyncDefaultAgent:
|
|
|
72
71
|
# Reset handler state at automation start
|
|
73
72
|
reset_handler(action_handler)
|
|
74
73
|
|
|
74
|
+
# Configure handler's post_batch_delay from agent's step_delay
|
|
75
|
+
configure_handler_delay(action_handler, self.step_delay)
|
|
76
|
+
|
|
75
77
|
for i in range(self.max_steps):
|
|
76
78
|
step_num = i + 1
|
|
77
79
|
logger.debug(f"Executing step {step_num}/{self.max_steps}")
|
|
@@ -127,10 +129,6 @@ class AsyncDefaultAgent:
|
|
|
127
129
|
)
|
|
128
130
|
)
|
|
129
131
|
|
|
130
|
-
# Wait after actions before next screenshot
|
|
131
|
-
if self.step_delay > 0:
|
|
132
|
-
await asyncio.sleep(self.step_delay)
|
|
133
|
-
|
|
134
132
|
# Check if task is complete
|
|
135
133
|
if step.stop:
|
|
136
134
|
logger.info(f"Task completed successfully after {step_num} steps")
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
# Licensed under the MIT License.
|
|
7
7
|
# -----------------------------------------------------------------------------
|
|
8
8
|
|
|
9
|
-
import asyncio
|
|
10
9
|
import logging
|
|
11
10
|
from datetime import datetime
|
|
12
11
|
from typing import Any
|
|
@@ -19,7 +18,7 @@ from oagi.constants import (
|
|
|
19
18
|
DEFAULT_TEMPERATURE,
|
|
20
19
|
MODEL_ACTOR,
|
|
21
20
|
)
|
|
22
|
-
from oagi.handler.utils import reset_handler
|
|
21
|
+
from oagi.handler.utils import configure_handler_delay, reset_handler
|
|
23
22
|
from oagi.types import (
|
|
24
23
|
URL,
|
|
25
24
|
ActionEvent,
|
|
@@ -126,6 +125,9 @@ class TaskeeAgent(AsyncAgent):
|
|
|
126
125
|
# Reset handler state at todo execution start
|
|
127
126
|
reset_handler(action_handler)
|
|
128
127
|
|
|
128
|
+
# Configure handler's post_batch_delay from agent's step_delay
|
|
129
|
+
configure_handler_delay(action_handler, self.step_delay)
|
|
130
|
+
|
|
129
131
|
self.current_todo = instruction
|
|
130
132
|
self.actions = []
|
|
131
133
|
self.total_actions = 0
|
|
@@ -355,10 +357,6 @@ class TaskeeAgent(AsyncAgent):
|
|
|
355
357
|
self.total_actions += len(step.actions)
|
|
356
358
|
self.since_reflection += len(step.actions)
|
|
357
359
|
|
|
358
|
-
# Wait after actions before next screenshot
|
|
359
|
-
if self.step_delay > 0:
|
|
360
|
-
await asyncio.sleep(self.step_delay)
|
|
361
|
-
|
|
362
360
|
steps_taken += 1
|
|
363
361
|
|
|
364
362
|
# Check if task is complete
|
|
@@ -29,7 +29,8 @@ class AsyncPyautoguiActionHandler:
|
|
|
29
29
|
config: PyautoguiConfig instance for customizing behavior
|
|
30
30
|
"""
|
|
31
31
|
self.sync_handler = PyautoguiActionHandler(config=config)
|
|
32
|
-
|
|
32
|
+
# Share the same config object so configure_handler_delay() works
|
|
33
|
+
self.config = self.sync_handler.config
|
|
33
34
|
|
|
34
35
|
def set_target_screen(self, screen: Screen) -> None:
|
|
35
36
|
"""Set the target screen for the action handler.
|
|
@@ -13,6 +13,7 @@ from pydantic import BaseModel, Field
|
|
|
13
13
|
|
|
14
14
|
from oagi.handler.screen_manager import Screen
|
|
15
15
|
|
|
16
|
+
from ..constants import DEFAULT_STEP_DELAY
|
|
16
17
|
from ..exceptions import check_optional_dependency
|
|
17
18
|
from ..types import Action, ActionType, parse_coords, parse_drag_coords, parse_scroll
|
|
18
19
|
from .capslock_manager import CapsLockManager
|
|
@@ -57,6 +58,12 @@ class PyautoguiConfig(BaseModel):
|
|
|
57
58
|
default=0.1,
|
|
58
59
|
description="Delay in seconds after moving to position before clicking",
|
|
59
60
|
)
|
|
61
|
+
post_batch_delay: float = Field(
|
|
62
|
+
default=DEFAULT_STEP_DELAY,
|
|
63
|
+
ge=0,
|
|
64
|
+
description="Delay after executing all actions in a batch (seconds). "
|
|
65
|
+
"Allows UI to settle before next screenshot.",
|
|
66
|
+
)
|
|
60
67
|
|
|
61
68
|
|
|
62
69
|
class PyautoguiActionHandler:
|
|
@@ -292,3 +299,7 @@ class PyautoguiActionHandler:
|
|
|
292
299
|
except Exception as e:
|
|
293
300
|
print(f"Error executing action {action.type}: {e}")
|
|
294
301
|
raise
|
|
302
|
+
|
|
303
|
+
# Wait after batch for UI to settle before next screenshot
|
|
304
|
+
if self.config.post_batch_delay > 0:
|
|
305
|
+
time.sleep(self.config.post_batch_delay)
|
oagi/handler/utils.py
CHANGED
|
@@ -19,3 +19,17 @@ def reset_handler(handler) -> None:
|
|
|
19
19
|
"""
|
|
20
20
|
if hasattr(handler, "reset"):
|
|
21
21
|
handler.reset()
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def configure_handler_delay(handler, step_delay: float) -> None:
|
|
25
|
+
"""Configure handler's post_batch_delay from agent's step_delay.
|
|
26
|
+
|
|
27
|
+
Uses duck-typing to check if the handler has a config with post_batch_delay.
|
|
28
|
+
This allows agents to control the delay after action execution.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
handler: The action handler to configure
|
|
32
|
+
step_delay: The delay in seconds to set
|
|
33
|
+
"""
|
|
34
|
+
if hasattr(handler, "config") and hasattr(handler.config, "post_batch_delay"):
|
|
35
|
+
handler.config.post_batch_delay = step_delay
|
|
@@ -12,6 +12,7 @@ from pydantic import BaseModel, Field
|
|
|
12
12
|
|
|
13
13
|
from oagi.handler.screen_manager import Screen
|
|
14
14
|
|
|
15
|
+
from ..constants import DEFAULT_STEP_DELAY
|
|
15
16
|
from ..types import Action, ActionType, parse_coords, parse_drag_coords, parse_scroll
|
|
16
17
|
from .capslock_manager import CapsLockManager
|
|
17
18
|
from .wayland_support import Ydotool, get_screen_size
|
|
@@ -38,6 +39,12 @@ class YdotoolConfig(BaseModel):
|
|
|
38
39
|
default="",
|
|
39
40
|
description="Custom socket address for ydotool (e.g., '/tmp/ydotool.sock')",
|
|
40
41
|
)
|
|
42
|
+
post_batch_delay: float = Field(
|
|
43
|
+
default=DEFAULT_STEP_DELAY,
|
|
44
|
+
ge=0,
|
|
45
|
+
description="Delay after executing all actions in a batch (seconds). "
|
|
46
|
+
"Allows UI to settle before next screenshot.",
|
|
47
|
+
)
|
|
41
48
|
|
|
42
49
|
|
|
43
50
|
class YdotoolActionHandler(Ydotool):
|
|
@@ -241,3 +248,7 @@ class YdotoolActionHandler(Ydotool):
|
|
|
241
248
|
except Exception as e:
|
|
242
249
|
print(f"Error executing action {action.type}: {e}")
|
|
243
250
|
raise
|
|
251
|
+
|
|
252
|
+
# Wait after batch for UI to settle before next screenshot
|
|
253
|
+
if self.config.post_batch_delay > 0:
|
|
254
|
+
time.sleep(self.config.post_batch_delay)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: oagi-core
|
|
3
|
-
Version: 0.14.
|
|
3
|
+
Version: 0.14.1
|
|
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>
|
|
@@ -154,12 +154,15 @@ from oagi import AsyncPyautoguiActionHandler, PyautoguiConfig
|
|
|
154
154
|
|
|
155
155
|
# Customize action behavior
|
|
156
156
|
config = PyautoguiConfig(
|
|
157
|
-
drag_duration=1.0,
|
|
158
|
-
scroll_amount=50,
|
|
159
|
-
wait_duration=2.0,
|
|
160
|
-
action_pause=0.2,
|
|
161
|
-
hotkey_interval=0.1,
|
|
162
|
-
capslock_mode="session" # Caps lock mode: 'session' or 'system' (default: 'session')
|
|
157
|
+
drag_duration=1.0, # Slower drags for precision (default: 0.5)
|
|
158
|
+
scroll_amount=50, # Larger scroll steps (default: 2 on macOS, 100 on others)
|
|
159
|
+
wait_duration=2.0, # Longer waits for WAIT action (default: 1.0)
|
|
160
|
+
action_pause=0.2, # Pause between PyAutoGUI calls (default: 0.1)
|
|
161
|
+
hotkey_interval=0.1, # Interval between keys in hotkey combos (default: 0.1)
|
|
162
|
+
capslock_mode="session", # Caps lock mode: 'session' or 'system' (default: 'session')
|
|
163
|
+
macos_ctrl_to_cmd=True, # Replace ctrl with cmd on macOS (default: True)
|
|
164
|
+
click_pre_delay=0.1, # Delay after move before click (default: 0.1)
|
|
165
|
+
post_batch_delay=1.0, # Delay after actions before next screenshot (default: 1.0)
|
|
163
166
|
)
|
|
164
167
|
|
|
165
168
|
action_handler = AsyncPyautoguiActionHandler(config=config)
|
|
@@ -279,10 +282,11 @@ from oagi import AsyncYdotoolActionHandler, YdotoolConfig
|
|
|
279
282
|
# Customize action behavior
|
|
280
283
|
config = YdotoolConfig(
|
|
281
284
|
scroll_amount=50, # Larger scroll steps (default: 20)
|
|
282
|
-
wait_duration=2.0, # Longer waits (default: 1.0)
|
|
283
|
-
action_pause=1.0, #
|
|
285
|
+
wait_duration=2.0, # Longer waits for WAIT action (default: 1.0)
|
|
286
|
+
action_pause=1.0, # Pause between Ydotool calls (default: 0.5)
|
|
284
287
|
capslock_mode="session", # Caps lock mode: 'session' or 'system' (default: 'session')
|
|
285
|
-
socket_address="/tmp/ydotool.sock" #
|
|
288
|
+
socket_address="/tmp/ydotool.sock", # Custom socket address (default: YDOTOOL_SOCKET env var)
|
|
289
|
+
post_batch_delay=1.0, # Delay after actions before next screenshot (default: 1.0)
|
|
286
290
|
)
|
|
287
291
|
|
|
288
292
|
action_handler = AsyncYdotoolActionHandler(config=config)
|
|
@@ -10,7 +10,7 @@ oagi/actor/base.py,sha256=-ecocyZ9-NQ4C4jjsHLUcs3ixZ99rFbzqwFsiVKZVR0,8001
|
|
|
10
10
|
oagi/actor/short.py,sha256=wKLCxvf7Ys6rYxXpHe4zbZdbf_1q1qcmm5WyWubwj3E,2630
|
|
11
11
|
oagi/actor/sync.py,sha256=QTY1WNTI75jwkWBghdVViHIp5rYkbm3kumlLedU8YeQ,3588
|
|
12
12
|
oagi/agent/__init__.py,sha256=KTVLUMhbjgpTJoOWMUZkkiqwhgumvbOZV2tJ9XCLfao,901
|
|
13
|
-
oagi/agent/default.py,sha256=
|
|
13
|
+
oagi/agent/default.py,sha256=mP4Gdld5I0sP0ANyn1CLkFvgk9qPkzYbwJeZUGhlsew,4712
|
|
14
14
|
oagi/agent/factories.py,sha256=syi_EOlU4SUjo-0CKaML8eIPu3ToUEKua2VHp9lvNF0,5839
|
|
15
15
|
oagi/agent/protocol.py,sha256=IQJGiMN4yZIacrh5e9JQsoM9TyHb8wJRQR4LAk8dSA0,1615
|
|
16
16
|
oagi/agent/registry.py,sha256=7bMA2-pH3xQ9ZavrHB_mnc2fOGSMeICPbOGtHoM7It0,4851
|
|
@@ -24,7 +24,7 @@ oagi/agent/tasker/__init__.py,sha256=1iTEFe7lzcqh96TL9R0QADPpLJLrUP0shtZ4DlZSv_8
|
|
|
24
24
|
oagi/agent/tasker/memory.py,sha256=NR13l5yxRA8GUE-oupAP4W1n80ZNG0SxpUfxsNltkUY,5033
|
|
25
25
|
oagi/agent/tasker/models.py,sha256=sMQgwIMKhT1tvVF2yoc1hh8GwEiJ6i6qPMy9WoiA8JM,2137
|
|
26
26
|
oagi/agent/tasker/planner.py,sha256=q6IvH6sfU2kYX1NcC9VHjGaQ0X9jF18yjuAYXisNCg0,15489
|
|
27
|
-
oagi/agent/tasker/taskee_agent.py,sha256=
|
|
27
|
+
oagi/agent/tasker/taskee_agent.py,sha256=IfRg_YixHkxHuiGCqok5cPDLD7PXUqlsoRAfWnWswMI,18091
|
|
28
28
|
oagi/agent/tasker/tasker_agent.py,sha256=yb0BdQzJyAPpK3njHPWgQruV8zpUGBXn1WjOGEMIO-g,11291
|
|
29
29
|
oagi/cli/__init__.py,sha256=aDnJViTseShpo5fdGPTj-ELysZhmdvB6Z8mEj2D-_N4,359
|
|
30
30
|
oagi/cli/agent.py,sha256=CWvwwbo4eiq-USYmDHnKafEX8Nk6zsGsUmNzB4QftkQ,13186
|
|
@@ -41,17 +41,17 @@ oagi/handler/__init__.py,sha256=ZMQIeN_uJKUK_dn0w7ggsPfdRzzwts7G-Sppsrt22Lg,2528
|
|
|
41
41
|
oagi/handler/_macos.py,sha256=Gs8GrhA_WAyv9Yw0D41duliP32Xk6vouyMeWjWJJT90,5187
|
|
42
42
|
oagi/handler/_windows.py,sha256=MSgPDYEOetSjbn9eJDSrdzBVlUGgGsTlegaTDc4C4Ss,2828
|
|
43
43
|
oagi/handler/_ydotool.py,sha256=WjvE6RGRm8j3SEWpgfMw31aow3z3qkiMupuUHYt-QAM,2948
|
|
44
|
-
oagi/handler/async_pyautogui_action_handler.py,sha256=
|
|
44
|
+
oagi/handler/async_pyautogui_action_handler.py,sha256=vZLf6LyRUzPAr8hGmKQDDyXMmc3ZAhlCCN4dIfi3vnY,2245
|
|
45
45
|
oagi/handler/async_screenshot_maker.py,sha256=_myV4Rq6X_evCOuatalFSW5nsUDXi_0ej0GQ7V4n3JE,1856
|
|
46
46
|
oagi/handler/async_ydotool_action_handler.py,sha256=HB4QQk3OaG08g37eLb3EwsnkWKWPrpDei0ZsnBxrGZY,2159
|
|
47
47
|
oagi/handler/capslock_manager.py,sha256=40LzWt1_1wbncF5koUTdbd9V3eo5Ex_mEWwjtEmHAf4,1878
|
|
48
48
|
oagi/handler/pil_image.py,sha256=s8UGZ6ALbmOxRO2GL1EUFN7_6ZEFseSE9OHABCe7wek,5380
|
|
49
|
-
oagi/handler/pyautogui_action_handler.py,sha256=
|
|
49
|
+
oagi/handler/pyautogui_action_handler.py,sha256=vjCtv6VaW0NNrId7PZR0-Y2VWe701t6KptQmun57aFo,11737
|
|
50
50
|
oagi/handler/screen_manager.py,sha256=FV0-6ZyTVv9yZlAg4Krga0xW9O_LDsk1iaCJjWgET-g,6565
|
|
51
51
|
oagi/handler/screenshot_maker.py,sha256=740k7NjDRKW6KwVqy_nVoczgVuw9_yTKM0gLFKB1iNs,1600
|
|
52
|
-
oagi/handler/utils.py,sha256=
|
|
52
|
+
oagi/handler/utils.py,sha256=vfOe5H6kb50WhzxVc9Gv3i1rVXTkmv2L8fQ3mb5ECb4,1235
|
|
53
53
|
oagi/handler/wayland_support.py,sha256=qUIAQMqc3wp1VIypVmZjFDYT8t0yH0QvikTTV8pD-XA,7905
|
|
54
|
-
oagi/handler/ydotool_action_handler.py,sha256=
|
|
54
|
+
oagi/handler/ydotool_action_handler.py,sha256=28aUeu6F4r8oWSiZNHLdKPGQYTMJS6sOzLphQSmi7-4,9698
|
|
55
55
|
oagi/server/__init__.py,sha256=uZx8u3vJUb87kkNzwmmVrgAgbqRu0WxyMIQCLSx56kk,452
|
|
56
56
|
oagi/server/agent_wrappers.py,sha256=j8va0A7u80bzOM82nndAplK1uaO_T3kufHWScK6kfWM,3263
|
|
57
57
|
oagi/server/config.py,sha256=AJ1PLKuxrc6pRuur1hm5DwG2g2otxPwOCfKgzIACkSk,1691
|
|
@@ -76,8 +76,8 @@ oagi/types/models/step.py,sha256=RSI4H_2rrUBq_xyCoWKaq7JHdJWNobtQppaKC1l0aWU,471
|
|
|
76
76
|
oagi/utils/__init__.py,sha256=vHXyX66hEsf33OJJkmZSUjaTYU0UngfbtjcZgxfOj3A,441
|
|
77
77
|
oagi/utils/output_parser.py,sha256=U7vzmoD8pyzDg23z3vy-L9a_jKPsAlr3x8lIdPszrY8,5322
|
|
78
78
|
oagi/utils/prompt_builder.py,sha256=_Q1HY82YUrq3jSCTZ3Rszu3qmI3Wn_fmq8hf14NuwQM,2180
|
|
79
|
-
oagi_core-0.14.
|
|
80
|
-
oagi_core-0.14.
|
|
81
|
-
oagi_core-0.14.
|
|
82
|
-
oagi_core-0.14.
|
|
83
|
-
oagi_core-0.14.
|
|
79
|
+
oagi_core-0.14.1.dist-info/METADATA,sha256=r-RhbjurIDIEWOnL7rKM_nmGb5A7pSs4QH9h0HtsRZo,16854
|
|
80
|
+
oagi_core-0.14.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
81
|
+
oagi_core-0.14.1.dist-info/entry_points.txt,sha256=zzgsOSWX6aN3KUB0Z1it8DMxFFBJBqmZVqMVAJRjYuw,44
|
|
82
|
+
oagi_core-0.14.1.dist-info/licenses/LICENSE,sha256=sy5DLA2M29jFT4UfWsuBF9BAr3FnRkYtnAu6oDZiIf8,1075
|
|
83
|
+
oagi_core-0.14.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|