oagi 0.2.1__py3-none-any.whl → 0.4.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.
Potentially problematic release.
This version of oagi might be problematic. Click here for more details.
- oagi/__init__.py +30 -2
- oagi/async_client.py +239 -0
- oagi/async_pyautogui_action_handler.py +44 -0
- oagi/async_screenshot_maker.py +47 -0
- oagi/async_short_task.py +56 -0
- oagi/async_single_step.py +83 -0
- oagi/async_task.py +117 -0
- oagi/pil_image.py +98 -0
- oagi/pyautogui_action_handler.py +82 -51
- oagi/screenshot_maker.py +16 -48
- oagi/short_task.py +8 -0
- oagi/single_step.py +4 -3
- oagi/task.py +7 -2
- oagi/types/__init__.py +14 -2
- oagi/types/async_action_handler.py +30 -0
- oagi/types/async_image_provider.py +37 -0
- oagi/types/models/__init__.py +2 -1
- oagi/types/models/image_config.py +47 -0
- oagi-0.4.0.dist-info/METADATA +161 -0
- oagi-0.4.0.dist-info/RECORD +30 -0
- oagi-0.2.1.dist-info/METADATA +0 -55
- oagi-0.2.1.dist-info/RECORD +0 -20
- {oagi-0.2.1.dist-info → oagi-0.4.0.dist-info}/WHEEL +0 -0
- {oagi-0.2.1.dist-info → oagi-0.4.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: oagi
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Official API of OpenAGI Foundation
|
|
5
|
+
Project-URL: Homepage, https://github.com/agiopen-org/oagi
|
|
6
|
+
Author-email: OpenAGI Foundation <contact@agiopen.org>
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2025 OpenAGI Foundation
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
Requires-Python: >=3.10
|
|
29
|
+
Requires-Dist: httpx>=0.28.0
|
|
30
|
+
Requires-Dist: pillow>=11.3.0
|
|
31
|
+
Requires-Dist: pyautogui>=0.9.54
|
|
32
|
+
Requires-Dist: pydantic>=2.0.0
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# OAGI Python SDK
|
|
36
|
+
|
|
37
|
+
Python SDK for the OAGI API - vision-based task automation.
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install oagi # requires Python >= 3.10
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Quick Start
|
|
46
|
+
|
|
47
|
+
Set your API credentials:
|
|
48
|
+
```bash
|
|
49
|
+
export OAGI_API_KEY="your-api-key"
|
|
50
|
+
export OAGI_BASE_URL="https://api.oagi.com" # or your server URL
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Single-Step Analysis
|
|
54
|
+
|
|
55
|
+
Analyze a screenshot and get recommended actions:
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from oagi import single_step
|
|
59
|
+
|
|
60
|
+
step = single_step(
|
|
61
|
+
task_description="Click the submit button",
|
|
62
|
+
screenshot="screenshot.png" # or bytes, or Image object
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
print(f"Actions: {step.actions}")
|
|
66
|
+
print(f"Complete: {step.is_complete}")
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Automated Task Execution
|
|
70
|
+
|
|
71
|
+
Run tasks automatically with screenshot capture and action execution:
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from oagi import ShortTask, ScreenshotMaker, PyautoguiActionHandler
|
|
75
|
+
|
|
76
|
+
task = ShortTask()
|
|
77
|
+
completed = task.auto_mode(
|
|
78
|
+
"Search weather on Google",
|
|
79
|
+
max_steps=10,
|
|
80
|
+
executor=PyautoguiActionHandler(), # Executes mouse/keyboard actions
|
|
81
|
+
image_provider=ScreenshotMaker(), # Captures screenshots
|
|
82
|
+
)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Configure PyAutoGUI behavior with custom settings:
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from oagi import PyautoguiActionHandler, PyautoguiConfig
|
|
89
|
+
|
|
90
|
+
# Customize action behavior
|
|
91
|
+
config = PyautoguiConfig(
|
|
92
|
+
drag_duration=1.0, # Slower drags for precision (default: 0.5)
|
|
93
|
+
scroll_amount=50, # Larger scroll steps (default: 30)
|
|
94
|
+
wait_duration=2.0, # Longer waits (default: 1.0)
|
|
95
|
+
action_pause=0.2, # More pause between actions (default: 0.1)
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
executor = PyautoguiActionHandler(config=config)
|
|
99
|
+
task.auto_mode("Complete form", executor=executor, image_provider=ScreenshotMaker())
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Image Processing
|
|
103
|
+
|
|
104
|
+
Process and optimize images before sending to API:
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from oagi import PILImage, ImageConfig
|
|
108
|
+
|
|
109
|
+
# Load and compress an image
|
|
110
|
+
image = PILImage.from_file("large_screenshot.png")
|
|
111
|
+
config = ImageConfig(
|
|
112
|
+
format="JPEG",
|
|
113
|
+
quality=85,
|
|
114
|
+
width=1260,
|
|
115
|
+
height=700
|
|
116
|
+
)
|
|
117
|
+
compressed = image.transform(config)
|
|
118
|
+
|
|
119
|
+
# Use with single_step
|
|
120
|
+
step = single_step("Click button", screenshot=compressed)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Async Support
|
|
124
|
+
|
|
125
|
+
Use async client for non-blocking operations and better concurrency:
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
import asyncio
|
|
129
|
+
from oagi import async_single_step, AsyncShortTask
|
|
130
|
+
|
|
131
|
+
async def main():
|
|
132
|
+
# Single-step async analysis
|
|
133
|
+
step = await async_single_step(
|
|
134
|
+
"Find the search bar",
|
|
135
|
+
screenshot="screenshot.png"
|
|
136
|
+
)
|
|
137
|
+
print(f"Found {len(step.actions)} actions")
|
|
138
|
+
|
|
139
|
+
# Async task automation
|
|
140
|
+
task = AsyncShortTask()
|
|
141
|
+
async with task:
|
|
142
|
+
await task.init_task("Complete the form")
|
|
143
|
+
# ... continue with async operations
|
|
144
|
+
|
|
145
|
+
asyncio.run(main())
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Examples
|
|
149
|
+
|
|
150
|
+
See the [`examples/`](examples/) directory for more usage patterns:
|
|
151
|
+
- `google_weather.py` - Basic task execution with `ShortTask`
|
|
152
|
+
- `single_step.py` - Basic single-step inference
|
|
153
|
+
- `screenshot_with_config.py` - Image compression and optimization
|
|
154
|
+
- `execute_task_auto.py` - Automated task execution
|
|
155
|
+
|
|
156
|
+
## Documentation
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
## License
|
|
160
|
+
|
|
161
|
+
MIT
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
oagi/__init__.py,sha256=m-Z121YCIwQOPXpTC8kd_UIJizcX8QuHyrSSguQ0KE0,2187
|
|
2
|
+
oagi/async_client.py,sha256=oDj4kIdtaV37uopoAeClCFQTxrYRwHV2HwMAcMdVYwE,8455
|
|
3
|
+
oagi/async_pyautogui_action_handler.py,sha256=F-lKyePCONWI03WnSxpX_QwxONbvnfdQu51wTod6mdw,1614
|
|
4
|
+
oagi/async_screenshot_maker.py,sha256=pI-dbLcYOzcO1ffgTmozAdbYJQNBPKA7hmqj1RxEmIY,1688
|
|
5
|
+
oagi/async_short_task.py,sha256=Pn3ggSWfPaxBPuMLox-WnIeD0JdmupxMojXybA8SbtE,1961
|
|
6
|
+
oagi/async_single_step.py,sha256=QawXO4GyfMz6O9jV8QBC1vKxFuS9vjKQxxJ1nwgHBzI,2838
|
|
7
|
+
oagi/async_task.py,sha256=bclqtgg7mI2WAp-62jOz044tVk4wruycpn9NYDncnA8,4145
|
|
8
|
+
oagi/exceptions.py,sha256=VMwVS8ouE9nHhBpN3AZMYt5_U2kGcihWaTnBhoQLquo,1662
|
|
9
|
+
oagi/logging.py,sha256=CWe89mA5MKTipIvfrqSYkv2CAFNBSwHMDQMDkG_g64g,1350
|
|
10
|
+
oagi/pil_image.py,sha256=Zp7YNwyE_AT25ZEFsWKbzMxbO8JOQsJ1Espph5ye8k8,3804
|
|
11
|
+
oagi/pyautogui_action_handler.py,sha256=T6acM0ZVIOEC8TTI-Qeoxp-B7HHF9xZK7s0HWuGW564,6477
|
|
12
|
+
oagi/screenshot_maker.py,sha256=sVuW7jn-K4FmLhmYI-akdNI-UVcTeBzh9P1_qJhoq1s,1282
|
|
13
|
+
oagi/short_task.py,sha256=fJcirqD7X3_GyINTGdOoe6wi-VFHfP-C8m-zxCvgY5M,1779
|
|
14
|
+
oagi/single_step.py,sha256=djhGOHzA5Y3-9_ity9QiJr_ObZZ04blSmNZsLXXXfkg,2939
|
|
15
|
+
oagi/sync_client.py,sha256=E6EgFIe-H91rdsPhF1puwrBTpOnKaL6JA1WHR4R-CLY,9395
|
|
16
|
+
oagi/task.py,sha256=JfsugIhBrwDmi1xOEVQdqmXsGFK-H4p17-B4rM8kbWs,4001
|
|
17
|
+
oagi/types/__init__.py,sha256=YXxL-30f92qAf9U6LZuVCtKFG-Pi3xahKedaNxyrxFE,766
|
|
18
|
+
oagi/types/action_handler.py,sha256=NH8E-m5qpGqWcXzTSWfF7W0Xdp8SkzJsbhCmQ0B96cg,1075
|
|
19
|
+
oagi/types/async_action_handler.py,sha256=k1AaqSkFcXlxwW8sn-w0WFHGsIqHFLbcOPrkknmSVug,1116
|
|
20
|
+
oagi/types/async_image_provider.py,sha256=wnhRyPtTmuALt45Qore74-RCkP5yxU9sZGjvOzFqzOk,1170
|
|
21
|
+
oagi/types/image.py,sha256=KgPCCTJ6D5vHIaGZdbTE7eQEa1WlT6G9tf59ZuUCV2U,537
|
|
22
|
+
oagi/types/image_provider.py,sha256=oYFdOYznrK_VOR9egzOjw5wFM5w8EY2sY01pH0ANAgU,1112
|
|
23
|
+
oagi/types/models/__init__.py,sha256=bVzzGxb6lVxAQyJpy0Z1QknSe-xC3g4OIDr7t-p_3Ys,467
|
|
24
|
+
oagi/types/models/action.py,sha256=8Xd3IcH32ENq7uXczo-mbQ736yUOGxO_TaZTfHVRY7w,935
|
|
25
|
+
oagi/types/models/image_config.py,sha256=tl6abVg_-IAPLwpaWprgknXu7wRWriMg-AEVyUX73v0,1567
|
|
26
|
+
oagi/types/models/step.py,sha256=RSI4H_2rrUBq_xyCoWKaq7JHdJWNobtQppaKC1l0aWU,471
|
|
27
|
+
oagi-0.4.0.dist-info/METADATA,sha256=haW2dK-avlwzfyw6WjWEm0GwwAEfChy-dhdE2ksk2qk,4620
|
|
28
|
+
oagi-0.4.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
29
|
+
oagi-0.4.0.dist-info/licenses/LICENSE,sha256=sy5DLA2M29jFT4UfWsuBF9BAr3FnRkYtnAu6oDZiIf8,1075
|
|
30
|
+
oagi-0.4.0.dist-info/RECORD,,
|
oagi-0.2.1.dist-info/METADATA
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: oagi
|
|
3
|
-
Version: 0.2.1
|
|
4
|
-
Summary: Official API of OpenAGI Foundation
|
|
5
|
-
Project-URL: Homepage, https://github.com/agiopen-org/oagi
|
|
6
|
-
Author-email: OpenAGI Foundation <contact@agiopen.org>
|
|
7
|
-
License: MIT License
|
|
8
|
-
|
|
9
|
-
Copyright (c) 2025 OpenAGI Foundation
|
|
10
|
-
|
|
11
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
-
in the Software without restriction, including without limitation the rights
|
|
14
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
-
furnished to do so, subject to the following conditions:
|
|
17
|
-
|
|
18
|
-
The above copyright notice and this permission notice shall be included in all
|
|
19
|
-
copies or substantial portions of the Software.
|
|
20
|
-
|
|
21
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
-
SOFTWARE.
|
|
28
|
-
Requires-Python: >=3.10
|
|
29
|
-
Requires-Dist: httpx>=0.28.0
|
|
30
|
-
Requires-Dist: pillow>=11.3.0
|
|
31
|
-
Requires-Dist: pyautogui>=0.9.54
|
|
32
|
-
Requires-Dist: pydantic>=2.0.0
|
|
33
|
-
Description-Content-Type: text/markdown
|
|
34
|
-
|
|
35
|
-
# OAGI Python SDK
|
|
36
|
-
|
|
37
|
-
## Basic Usage
|
|
38
|
-
```bash
|
|
39
|
-
pip install oagi # python >= 3.10
|
|
40
|
-
```
|
|
41
|
-
```bash
|
|
42
|
-
export OAGI_BASE_URL=""
|
|
43
|
-
export OAGI_API_KEY="sk-xxxx"
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
```python
|
|
47
|
-
from oagi import PyautoguiActionHandler, ScreenshotMaker, ShortTask
|
|
48
|
-
short_task = ShortTask()
|
|
49
|
-
is_completed = short_task.auto_mode(
|
|
50
|
-
"Search weather with Google",
|
|
51
|
-
max_steps=5,
|
|
52
|
-
executor=PyautoguiActionHandler(),
|
|
53
|
-
image_provider=(sm := ScreenshotMaker()),
|
|
54
|
-
)
|
|
55
|
-
```
|
oagi-0.2.1.dist-info/RECORD
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
oagi/__init__.py,sha256=ms9ahLdHNrMWtiqX93q8Iv55ag__tO4Id0DQ3hA2TVM,1347
|
|
2
|
-
oagi/exceptions.py,sha256=VMwVS8ouE9nHhBpN3AZMYt5_U2kGcihWaTnBhoQLquo,1662
|
|
3
|
-
oagi/logging.py,sha256=CWe89mA5MKTipIvfrqSYkv2CAFNBSwHMDQMDkG_g64g,1350
|
|
4
|
-
oagi/pyautogui_action_handler.py,sha256=LBWmtqkXzZSJo07s3uOw-NWUE9rZZtbNAx0YI83pCbk,5482
|
|
5
|
-
oagi/screenshot_maker.py,sha256=lyJSMFagHeaqg59CQGMTqLvSzQN_pBbhbV2oIFG46vA,2077
|
|
6
|
-
oagi/short_task.py,sha256=ofcMi7vbu9W1MCSGOk_FNEHJcB02pfgNcx1-Y8UkpJY,1552
|
|
7
|
-
oagi/single_step.py,sha256=JEsF7ABa4wwW5Pi5AfjeKzyuKhC4kC4fcotnmnNye5o,2874
|
|
8
|
-
oagi/sync_client.py,sha256=E6EgFIe-H91rdsPhF1puwrBTpOnKaL6JA1WHR4R-CLY,9395
|
|
9
|
-
oagi/task.py,sha256=NmpNMu8CJll50zGsGtVie1kdpKeWnAAWudEa-aasBbU,3959
|
|
10
|
-
oagi/types/__init__.py,sha256=eh-1IEqMTY2hUrvQJeTg6vsvlE6F4Iz5C0_K86AnWn8,549
|
|
11
|
-
oagi/types/action_handler.py,sha256=NH8E-m5qpGqWcXzTSWfF7W0Xdp8SkzJsbhCmQ0B96cg,1075
|
|
12
|
-
oagi/types/image.py,sha256=KgPCCTJ6D5vHIaGZdbTE7eQEa1WlT6G9tf59ZuUCV2U,537
|
|
13
|
-
oagi/types/image_provider.py,sha256=oYFdOYznrK_VOR9egzOjw5wFM5w8EY2sY01pH0ANAgU,1112
|
|
14
|
-
oagi/types/models/__init__.py,sha256=4qhKxWXsXEVzD6U_RM6PXR45os765qigtZs1BsS4WHg,414
|
|
15
|
-
oagi/types/models/action.py,sha256=8Xd3IcH32ENq7uXczo-mbQ736yUOGxO_TaZTfHVRY7w,935
|
|
16
|
-
oagi/types/models/step.py,sha256=RSI4H_2rrUBq_xyCoWKaq7JHdJWNobtQppaKC1l0aWU,471
|
|
17
|
-
oagi-0.2.1.dist-info/METADATA,sha256=5W_aB_J2LUEyKAvE6G_iOcySv7tf0PWiGikOQe_K7l4,2066
|
|
18
|
-
oagi-0.2.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
19
|
-
oagi-0.2.1.dist-info/licenses/LICENSE,sha256=sy5DLA2M29jFT4UfWsuBF9BAr3FnRkYtnAu6oDZiIf8,1075
|
|
20
|
-
oagi-0.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|