oagi-core 0.9.0__py3-none-any.whl → 0.9.2__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 (38) hide show
  1. oagi/__init__.py +13 -16
  2. oagi/agent/default.py +26 -10
  3. oagi/agent/factories.py +5 -0
  4. oagi/agent/tasker/planner.py +11 -2
  5. oagi/agent/tasker/taskee_agent.py +45 -20
  6. oagi/agent/tasker/tasker_agent.py +11 -7
  7. oagi/cli/agent.py +39 -21
  8. oagi/cli/display.py +56 -0
  9. oagi/cli/tracking.py +45 -0
  10. oagi/cli/utils.py +11 -4
  11. oagi/client/base.py +3 -7
  12. oagi/handler/__init__.py +24 -0
  13. oagi/handler/_macos.py +55 -0
  14. oagi/{async_pyautogui_action_handler.py → handler/async_pyautogui_action_handler.py} +1 -1
  15. oagi/{async_screenshot_maker.py → handler/async_screenshot_maker.py} +1 -1
  16. oagi/{pil_image.py → handler/pil_image.py} +2 -2
  17. oagi/{pyautogui_action_handler.py → handler/pyautogui_action_handler.py} +14 -4
  18. oagi/{screenshot_maker.py → handler/screenshot_maker.py} +2 -2
  19. oagi/logging.py +8 -0
  20. oagi/server/config.py +3 -3
  21. oagi/server/models.py +1 -1
  22. oagi/server/socketio_server.py +1 -1
  23. oagi/task/__init__.py +10 -3
  24. oagi/task/async_.py +27 -2
  25. oagi/task/async_short.py +16 -4
  26. oagi/task/base.py +2 -0
  27. oagi/task/short.py +16 -4
  28. oagi/task/sync.py +27 -2
  29. oagi/types/__init__.py +2 -0
  30. oagi/types/step_observer.py +34 -0
  31. {oagi_core-0.9.0.dist-info → oagi_core-0.9.2.dist-info}/METADATA +4 -29
  32. oagi_core-0.9.2.dist-info/RECORD +63 -0
  33. oagi/async_single_step.py +0 -85
  34. oagi/single_step.py +0 -87
  35. oagi_core-0.9.0.dist-info/RECORD +0 -60
  36. {oagi_core-0.9.0.dist-info → oagi_core-0.9.2.dist-info}/WHEEL +0 -0
  37. {oagi_core-0.9.0.dist-info → oagi_core-0.9.2.dist-info}/entry_points.txt +0 -0
  38. {oagi_core-0.9.0.dist-info → oagi_core-0.9.2.dist-info}/licenses/LICENSE +0 -0
oagi/async_single_step.py DELETED
@@ -1,85 +0,0 @@
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
- from pathlib import Path
10
-
11
- from .task import AsyncTask
12
- from .types import Image, Step
13
-
14
-
15
- async def async_single_step(
16
- task_description: str,
17
- screenshot: str | bytes | Path | Image,
18
- instruction: str | None = None,
19
- api_key: str | None = None,
20
- base_url: str | None = None,
21
- temperature: float | None = None,
22
- ) -> Step:
23
- """
24
- Perform a single-step inference asynchronously without maintaining task state.
25
-
26
- This is useful for one-off analyses where you don't need to maintain
27
- a conversation or task context across multiple steps.
28
-
29
- Args:
30
- task_description: Description of the task to perform
31
- screenshot: Screenshot as Image, bytes, or file path
32
- instruction: Optional additional instruction for the task
33
- api_key: OAGI API key (uses environment variable if not provided)
34
- base_url: OAGI base URL (uses environment variable if not provided)
35
- temperature: Sampling temperature (0.0-2.0) for LLM inference
36
-
37
- Returns:
38
- Step: Object containing reasoning, actions, and completion status
39
-
40
- Example:
41
- >>> # Using with bytes
42
- >>> import asyncio
43
- >>> async def main():
44
- ... with open("screenshot.png", "rb") as f:
45
- ... screenshot_bytes = f.read()
46
- ... step = await async_single_step(
47
- ... "Click the submit button",
48
- ... screenshot=screenshot_bytes
49
- ... )
50
- ... print(f"Actions: {step.actions}")
51
- >>> asyncio.run(main())
52
-
53
- >>> # Using with file path
54
- >>> step = await async_single_step(
55
- ... "Find the search box",
56
- ... screenshot="screenshot.png"
57
- ... )
58
-
59
- >>> # Using with PILImage
60
- >>> image = PILImage.from_file("screenshot.png")
61
- >>> step = await async_single_step(
62
- ... "Click next page",
63
- ... screenshot=image
64
- ... )
65
- """
66
- # Lazy import PILImage only when needed
67
- from .pil_image import PILImage # noqa: PLC0415
68
-
69
- # Handle different screenshot input types
70
- if isinstance(screenshot, (str, Path)):
71
- screenshot = PILImage.from_file(str(screenshot))
72
- elif isinstance(screenshot, bytes):
73
- screenshot = PILImage.from_bytes(screenshot)
74
-
75
- # Create a temporary task instance
76
- task = AsyncTask(api_key=api_key, base_url=base_url, temperature=temperature)
77
-
78
- try:
79
- # Initialize task and perform single step
80
- await task.init_task(task_description)
81
- result = await task.step(screenshot, instruction=instruction)
82
- return result
83
- finally:
84
- # Clean up resources
85
- await task.close()
oagi/single_step.py DELETED
@@ -1,87 +0,0 @@
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
- from pathlib import Path
10
-
11
- from .task import Task
12
- from .types import Image, Step
13
-
14
-
15
- def single_step(
16
- task_description: str,
17
- screenshot: str | bytes | Path | Image,
18
- instruction: str | None = None,
19
- api_key: str | None = None,
20
- base_url: str | None = None,
21
- temperature: float | None = None,
22
- ) -> Step:
23
- """
24
- Perform a single-step inference without maintaining task state.
25
-
26
- This is useful for one-off analyses where you don't need to maintain
27
- a conversation or task context across multiple steps.
28
-
29
- Args:
30
- task_description: Description of the task to perform
31
- screenshot: Screenshot as Image, bytes, or file path
32
- instruction: Optional additional instruction for the task
33
- api_key: OAGI API key (uses environment variable if not provided)
34
- base_url: OAGI base URL (uses environment variable if not provided)
35
- temperature: Sampling temperature (0.0-2.0) for LLM inference
36
-
37
- Returns:
38
- Step: Object containing reasoning, actions, and completion status
39
-
40
- Example:
41
- >>> # Using with bytes
42
- >>> with open("screenshot.png", "rb") as f:
43
- ... image_bytes = f.read()
44
- >>> step = single_step(
45
- ... task_description="Click the submit button",
46
- ... screenshot=image_bytes
47
- ... )
48
-
49
- >>> # Using with file path
50
- >>> step = single_step(
51
- ... task_description="Fill in the form",
52
- ... screenshot=Path("screenshot.png"),
53
- ... instruction="Use test@example.com for email"
54
- ... )
55
-
56
- >>> # Using with Image object
57
- >>> from oagi.types import Image
58
- >>> image = Image(...)
59
- >>> step = single_step(
60
- ... task_description="Navigate to settings",
61
- ... screenshot=image
62
- ... )
63
- """
64
- # Lazy import PILImage only when needed
65
- from .pil_image import PILImage # noqa: PLC0415
66
-
67
- # Convert file paths to bytes using PILImage
68
- if isinstance(screenshot, (str, Path)):
69
- path = Path(screenshot) if isinstance(screenshot, str) else screenshot
70
- if path.exists():
71
- pil_image = PILImage.from_file(str(path))
72
- screenshot_bytes = pil_image.read()
73
- else:
74
- raise FileNotFoundError(f"Screenshot file not found: {path}")
75
- elif isinstance(screenshot, bytes):
76
- screenshot_bytes = screenshot
77
- elif isinstance(screenshot, Image):
78
- screenshot_bytes = screenshot.read()
79
- else:
80
- raise ValueError(
81
- f"screenshot must be Image, bytes, str, or Path, got {type(screenshot)}"
82
- )
83
-
84
- # Use Task to perform single step
85
- with Task(api_key=api_key, base_url=base_url, temperature=temperature) as task:
86
- task.init_task(task_description)
87
- return task.step(screenshot_bytes, instruction=instruction)
@@ -1,60 +0,0 @@
1
- oagi/__init__.py,sha256=2yFfGqF5Ve2ZmQHYNHvlTQJIENUV2j5AV_fROsUrbyU,2998
2
- oagi/async_pyautogui_action_handler.py,sha256=F-lKyePCONWI03WnSxpX_QwxONbvnfdQu51wTod6mdw,1614
3
- oagi/async_screenshot_maker.py,sha256=pI-dbLcYOzcO1ffgTmozAdbYJQNBPKA7hmqj1RxEmIY,1688
4
- oagi/async_single_step.py,sha256=FxOSoZKKegHx0by41a4qrJDPoYZV0qZKtdTNMU8Uqz4,2955
5
- oagi/exceptions.py,sha256=Rco37GQTPYUfc2vRO3hozxPF_s8mKFDpFvBg2UKWo3Y,3066
6
- oagi/logging.py,sha256=YaG-UQWjqXJTfk6MsxcX_xfPVeVCq2ryIH1zwgR2_fQ,1455
7
- oagi/pil_image.py,sha256=xs6nDRyjTCaoeIMb3GV5d4U6dbG5M5jr2TdMc57eJMo,4078
8
- oagi/pyautogui_action_handler.py,sha256=N-4XcCV8f92ViuwXnpgk3ILGrlhR_8L1CKkGq_ub5gQ,9952
9
- oagi/screenshot_maker.py,sha256=sVuW7jn-K4FmLhmYI-akdNI-UVcTeBzh9P1_qJhoq1s,1282
10
- oagi/single_step.py,sha256=62Zip4Uql6E-ZIX6vAlrBoveKqrnABzGqHdLCzju4ag,3138
11
- oagi/agent/__init__.py,sha256=JU9zuWuDzpzitsVJB4z5ddvx8RMm5nbP-bjUCL1Sfvo,834
12
- oagi/agent/default.py,sha256=XJXbltDOak3Wer92MXiocLgD9_y0OWJ88isWNOFhaLk,2397
13
- oagi/agent/factories.py,sha256=JsOqzUWY2_MlL16XznLR8MrWUqgOQTmAyDOvtsA1zvY,1386
14
- oagi/agent/protocol.py,sha256=IQJGiMN4yZIacrh5e9JQsoM9TyHb8wJRQR4LAk8dSA0,1615
15
- oagi/agent/registry.py,sha256=4oG65E_bV47Xl6F-HX9KaVoV0pcoC1uRRDU4RT_m3uU,4841
16
- oagi/agent/tasker/__init__.py,sha256=faOC5ONY8ZKr4CjofC6HYg1WKWc1UiaGB9VHy8W280M,800
17
- oagi/agent/tasker/memory.py,sha256=JsJjUMpnJoKW4VFzd8FI4M-FhnEihTecL61KVgO_YBI,6051
18
- oagi/agent/tasker/models.py,sha256=VzvHB5hLv6qyYcyNiojVIEDlTzeGE4Quswk4EVIbzoI,2180
19
- oagi/agent/tasker/planner.py,sha256=j0Zhk6kw0LFtxkpjFhmeaTBxZfKLf3qqCNpGAuMuODw,13650
20
- oagi/agent/tasker/taskee_agent.py,sha256=L_5JvWQLVeqY35Xclv7YBOb0gHnGMZ4tJdbskGLc-_o,12966
21
- oagi/agent/tasker/tasker_agent.py,sha256=PzfsBZvMCH1QMRXDMPQtezw4rX_PfOj7sXSsDAH0U6g,10705
22
- oagi/cli/__init__.py,sha256=aDnJViTseShpo5fdGPTj-ELysZhmdvB6Z8mEj2D-_N4,359
23
- oagi/cli/agent.py,sha256=U7Yjmfi7aGt--iisuylg0C2-17bVB3tTBq2sXYU0Gtg,4020
24
- oagi/cli/main.py,sha256=faHns0HaQCGyylDn2YZLpjQESuEiMYjoQVoMkt8FsH4,2292
25
- oagi/cli/server.py,sha256=Z1ic8r55yaeQBFRCsMNZStC1jRiJdnDGqe9On9LmFzQ,3031
26
- oagi/cli/utils.py,sha256=QvDyoP0nU9aq4ORjnvJJAGRECmjh9WAmilKuk6zOGM8,2615
27
- oagi/client/__init__.py,sha256=F9DShPUdb6vZYmN1fpM1VYzp4MWqUao_e_R1KYmM4Q4,410
28
- oagi/client/async_.py,sha256=t-GPHcz6xbHx_RPFv1V_hwZ1_f-O9ONH-Ahr0w-Nz8M,11046
29
- oagi/client/base.py,sha256=TlZk4LaYFlOQFmTTgTDzZ1XRAixqNO0pCwgJ7VhZOSU,17101
30
- oagi/client/sync.py,sha256=QKd6nTUXtyn1Am8YlFcpsoLh1KuHhQgbMemIkb7r39g,10882
31
- oagi/server/__init__.py,sha256=uZx8u3vJUb87kkNzwmmVrgAgbqRu0WxyMIQCLSx56kk,452
32
- oagi/server/agent_wrappers.py,sha256=4f6ZKvqy9TDA57QRHGjAQVhpHmPE5QNeewmmURg5Ajo,3288
33
- oagi/server/config.py,sha256=RstTWbPwWCfW9ZRJcns3uCbdhXxuUnerKjxR1pCGbqY,1602
34
- oagi/server/main.py,sha256=jnTxk7Prc5CzlsUnkBNJp4MOoYN-7HN_Be_m1d3COa8,4829
35
- oagi/server/models.py,sha256=E0R80zIz-YLpwx4VQyADQEnM89ZY9bXmjuswfhCuqMc,2595
36
- oagi/server/session_store.py,sha256=UI14NiApAwvZWmMOG4SvPE2WkbGkNTHToZhTXQjN2_U,3624
37
- oagi/server/socketio_server.py,sha256=UeNm9bemYMZqtYWp3i09BLUyEWW6t8yTkl2pjpSeT_M,14359
38
- oagi/task/__init__.py,sha256=kvB8ENQ3iII9Uzqa9SSIxBv5JFKv44j2T6J-_Qc8A-4,494
39
- oagi/task/async_.py,sha256=QDXaw3wAI8Utbph_kB1a3Elv2aeZwPnv2R7wT16LDXo,3242
40
- oagi/task/async_short.py,sha256=h7Kchl4opUjyKQd_0Vd7DHWoBOTcYqN1lPdGeyTjoq8,2324
41
- oagi/task/base.py,sha256=gUpWWhgbkrN17pmZNISmyzxLedhWZ39wVt7fRhH6JDM,4378
42
- oagi/task/short.py,sha256=pjhoYN_a5KS_cGKfXbB575wdw-nx9ZdzJTplMr3sgqs,2148
43
- oagi/task/sync.py,sha256=_tMjw4Gjyk3wKCD_q7Pwvug0-DMD7DalXZocrREZogc,3135
44
- oagi/types/__init__.py,sha256=j-ShAARBbz-fGgkaQj5j_xyhFGM4XWnUTp-h3xhm9Bo,814
45
- oagi/types/action_handler.py,sha256=NH8E-m5qpGqWcXzTSWfF7W0Xdp8SkzJsbhCmQ0B96cg,1075
46
- oagi/types/async_action_handler.py,sha256=k1AaqSkFcXlxwW8sn-w0WFHGsIqHFLbcOPrkknmSVug,1116
47
- oagi/types/async_image_provider.py,sha256=wnhRyPtTmuALt45Qore74-RCkP5yxU9sZGjvOzFqzOk,1170
48
- oagi/types/image.py,sha256=KgPCCTJ6D5vHIaGZdbTE7eQEa1WlT6G9tf59ZuUCV2U,537
49
- oagi/types/image_provider.py,sha256=oYFdOYznrK_VOR9egzOjw5wFM5w8EY2sY01pH0ANAgU,1112
50
- oagi/types/url_image.py,sha256=iOwtXj2uwY6dVtDP7uvQLPvK-aTxkdrzhw_R4C6GwBw,1334
51
- oagi/types/models/__init__.py,sha256=I86Z2moM8hCog_1K1FG_uATcBmWFv_UFetLAjzPzWAY,742
52
- oagi/types/models/action.py,sha256=hh6mRRSSWgrW4jpZo71zGMCOcZpV5_COu4148uG6G48,967
53
- oagi/types/models/client.py,sha256=fCN18DBq5XDjNyYB8w-2dFeQ_K9ywwdyh-rXa0GToU4,1357
54
- oagi/types/models/image_config.py,sha256=tl6abVg_-IAPLwpaWprgknXu7wRWriMg-AEVyUX73v0,1567
55
- oagi/types/models/step.py,sha256=RSI4H_2rrUBq_xyCoWKaq7JHdJWNobtQppaKC1l0aWU,471
56
- oagi_core-0.9.0.dist-info/METADATA,sha256=4GekQr0XrNc9sDArtojzQTS6SYXNJz9ax8jQtDW-hMY,8187
57
- oagi_core-0.9.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
58
- oagi_core-0.9.0.dist-info/entry_points.txt,sha256=zzgsOSWX6aN3KUB0Z1it8DMxFFBJBqmZVqMVAJRjYuw,44
59
- oagi_core-0.9.0.dist-info/licenses/LICENSE,sha256=sy5DLA2M29jFT4UfWsuBF9BAr3FnRkYtnAu6oDZiIf8,1075
60
- oagi_core-0.9.0.dist-info/RECORD,,