oagi 0.0.0__tar.gz → 0.2.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.
Potentially problematic release.
This version of oagi might be problematic. Click here for more details.
- oagi-0.2.0/.github/workflows/ci.yml +45 -0
- oagi-0.2.0/.github/workflows/release.yml +41 -0
- oagi-0.2.0/.gitignore +207 -0
- oagi-0.2.0/.python-version +1 -0
- oagi-0.2.0/CONTRIBUTING.md +1 -0
- {oagi-0.0.0 → oagi-0.2.0}/LICENSE +21 -21
- oagi-0.2.0/Makefile +31 -0
- {oagi-0.0.0 → oagi-0.2.0}/PKG-INFO +55 -31
- oagi-0.2.0/README.md +21 -0
- oagi-0.2.0/examples/execute_task_auto.py +23 -0
- oagi-0.2.0/examples/execute_task_manual.py +48 -0
- oagi-0.2.0/examples/google_weather.py +15 -0
- oagi-0.2.0/examples/hotel_booking.py +52 -0
- oagi-0.2.0/examples/single_step.py +19 -0
- oagi-0.2.0/pyproject.toml +35 -0
- oagi-0.2.0/src/oagi/__init__.py +53 -0
- oagi-0.2.0/src/oagi/exceptions.py +75 -0
- oagi-0.2.0/src/oagi/logging.py +45 -0
- oagi-0.2.0/src/oagi/pyautogui_action_handler.py +146 -0
- oagi-0.2.0/src/oagi/screenshot_maker.py +73 -0
- oagi-0.2.0/src/oagi/short_task.py +44 -0
- oagi-0.2.0/src/oagi/single_step.py +82 -0
- oagi-0.2.0/src/oagi/sync_client.py +265 -0
- oagi-0.2.0/src/oagi/task.py +109 -0
- oagi-0.2.0/src/oagi/types/__init__.py +14 -0
- oagi-0.2.0/src/oagi/types/action_handler.py +30 -0
- oagi-0.2.0/src/oagi/types/image.py +17 -0
- oagi-0.2.0/src/oagi/types/image_provider.py +34 -0
- oagi-0.2.0/src/oagi/types/models/__init__.py +12 -0
- oagi-0.2.0/src/oagi/types/models/action.py +32 -0
- oagi-0.2.0/src/oagi/types/models/step.py +17 -0
- oagi-0.2.0/tests/__init__.py +9 -0
- oagi-0.2.0/tests/conftest.py +236 -0
- oagi-0.2.0/tests/test_logging.py +318 -0
- oagi-0.2.0/tests/test_pyautogui_action_handler.py +147 -0
- oagi-0.2.0/tests/test_screenshot_maker.py +149 -0
- oagi-0.2.0/tests/test_short_task.py +148 -0
- oagi-0.2.0/tests/test_single_step.py +193 -0
- oagi-0.2.0/tests/test_sync_client.py +326 -0
- oagi-0.2.0/tests/test_task.py +275 -0
- oagi-0.2.0/uv.lock +642 -0
- oagi-0.0.0/oagi/__init__.py +0 -1
- oagi-0.0.0/oagi/core.py +0 -2
- oagi-0.0.0/oagi.egg-info/PKG-INFO +0 -31
- oagi-0.0.0/oagi.egg-info/SOURCES.txt +0 -8
- oagi-0.0.0/oagi.egg-info/dependency_links.txt +0 -1
- oagi-0.0.0/oagi.egg-info/top_level.txt +0 -1
- oagi-0.0.0/pyproject.toml +0 -17
- oagi-0.0.0/setup.cfg +0 -4
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
branches: ["main"]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
lint:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- name: Install uv
|
|
15
|
+
uses: astral-sh/setup-uv@v3
|
|
16
|
+
|
|
17
|
+
- name: Install dependencies
|
|
18
|
+
run: make install
|
|
19
|
+
|
|
20
|
+
- name: Run lint
|
|
21
|
+
run: make lint
|
|
22
|
+
|
|
23
|
+
build:
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
- uses: astral-sh/setup-uv@v3
|
|
28
|
+
- run: make install
|
|
29
|
+
- run: make build
|
|
30
|
+
|
|
31
|
+
test:
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@v4
|
|
35
|
+
- uses: astral-sh/setup-uv@v3
|
|
36
|
+
|
|
37
|
+
- name: Install system dependencies
|
|
38
|
+
run: |
|
|
39
|
+
sudo apt-get update
|
|
40
|
+
sudo apt-get install -y xvfb
|
|
41
|
+
|
|
42
|
+
- run: make install
|
|
43
|
+
|
|
44
|
+
- name: Run tests with virtual display
|
|
45
|
+
run: xvfb-run -a make test-verbose
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
release:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write # For trusted publishing
|
|
13
|
+
contents: write # For GitHub release
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Install uv
|
|
19
|
+
uses: astral-sh/setup-uv@v3
|
|
20
|
+
with:
|
|
21
|
+
enable-cache: true
|
|
22
|
+
|
|
23
|
+
- name: Set up Python
|
|
24
|
+
run: uv python install 3.12
|
|
25
|
+
|
|
26
|
+
- name: Build package
|
|
27
|
+
run: uv build
|
|
28
|
+
|
|
29
|
+
- name: Publish to PyPI
|
|
30
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
31
|
+
with:
|
|
32
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
33
|
+
# Another option: Use Trusted Publishing (recommended, no token needed)
|
|
34
|
+
# Configure at: https://pypi.org/manage/project/oagi/settings/publishing/
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
- name: Create GitHub Release
|
|
38
|
+
uses: softprops/action-gh-release@v1
|
|
39
|
+
with:
|
|
40
|
+
files: dist/*
|
|
41
|
+
generate_release_notes: true
|
oagi-0.2.0/.gitignore
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Cursor
|
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
201
|
+
.cursorignore
|
|
202
|
+
.cursorindexingignore
|
|
203
|
+
|
|
204
|
+
# Marimo
|
|
205
|
+
marimo/_static/
|
|
206
|
+
marimo/_lsp/
|
|
207
|
+
__marimo__/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.10.18
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
## Development
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 OpenAGI Foundation
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 OpenAGI Foundation
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
oagi-0.2.0/Makefile
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.PHONY: .uv
|
|
2
|
+
.uv:
|
|
3
|
+
@uv -V || echo 'Please install uv: https://docs.astral.sh/uv/getting-started/installation/'
|
|
4
|
+
|
|
5
|
+
.PHONY: install-dev
|
|
6
|
+
install-dev: .uv
|
|
7
|
+
uv sync --frozen --all-groups --all-extras
|
|
8
|
+
|
|
9
|
+
.PHONY: install
|
|
10
|
+
install: install-dev
|
|
11
|
+
|
|
12
|
+
.PHONY: format
|
|
13
|
+
format: .uv
|
|
14
|
+
uv run ruff check --fix
|
|
15
|
+
uv run ruff format
|
|
16
|
+
|
|
17
|
+
.PHONY: lint
|
|
18
|
+
lint: .uv
|
|
19
|
+
uv run ruff check
|
|
20
|
+
uv run ruff format --check
|
|
21
|
+
|
|
22
|
+
build: .uv
|
|
23
|
+
uv build
|
|
24
|
+
|
|
25
|
+
.PHONY: test
|
|
26
|
+
test: .uv
|
|
27
|
+
uv run pytest
|
|
28
|
+
|
|
29
|
+
.PHONY: test-verbose
|
|
30
|
+
test-verbose: .uv
|
|
31
|
+
uv run pytest -v
|
|
@@ -1,31 +1,55 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
2
|
-
Name: oagi
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Official API of OpenAGI Foundation
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
SOFTWARE
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: oagi
|
|
3
|
+
Version: 0.2.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
|
+
## 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.0/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# OAGI Python SDK
|
|
2
|
+
|
|
3
|
+
## Basic Usage
|
|
4
|
+
```bash
|
|
5
|
+
pip install oagi # python >= 3.10
|
|
6
|
+
```
|
|
7
|
+
```bash
|
|
8
|
+
export OAGI_BASE_URL=""
|
|
9
|
+
export OAGI_API_KEY="sk-xxxx"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```python
|
|
13
|
+
from oagi import PyautoguiActionHandler, ScreenshotMaker, ShortTask
|
|
14
|
+
short_task = ShortTask()
|
|
15
|
+
is_completed = short_task.auto_mode(
|
|
16
|
+
"Search weather with Google",
|
|
17
|
+
max_steps=5,
|
|
18
|
+
executor=PyautoguiActionHandler(),
|
|
19
|
+
image_provider=(sm := ScreenshotMaker()),
|
|
20
|
+
)
|
|
21
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
from oagi import PyautoguiActionHandler, ScreenshotMaker, ShortTask
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def execute_task_auto(task_desc, max_steps=5):
|
|
12
|
+
# set OAGI_API_KEY and OAGI_BASE_URL
|
|
13
|
+
# or ShortTask(api_key="your_api_key", base_url="your_base_url")
|
|
14
|
+
short_task = ShortTask()
|
|
15
|
+
|
|
16
|
+
is_completed = short_task.auto_mode(
|
|
17
|
+
task_desc,
|
|
18
|
+
max_steps=max_steps,
|
|
19
|
+
executor=PyautoguiActionHandler(), # or executor = lambda actions: print(actions) for debugging
|
|
20
|
+
image_provider=(sm := ScreenshotMaker()),
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
return is_completed, sm.last_image()
|
|
@@ -0,0 +1,48 @@
|
|
|
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 oagi import PyautoguiActionHandler, ScreenshotMaker, Task
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def execute_task_manual(task_desc, max_steps=5):
|
|
13
|
+
# set OAGI_API_KEY and OAGI_BASE_URL
|
|
14
|
+
# or ShortTask(api_key="your_api_key", base_url="your_base_url")
|
|
15
|
+
task = Task()
|
|
16
|
+
task.init_task(task_desc, max_steps=max_steps)
|
|
17
|
+
executor = (
|
|
18
|
+
PyautoguiActionHandler()
|
|
19
|
+
) # executor = lambda actions: print(actions) for debugging
|
|
20
|
+
image_provider = ScreenshotMaker()
|
|
21
|
+
|
|
22
|
+
for i in range(max_steps):
|
|
23
|
+
# image can also be bytes
|
|
24
|
+
# with open("test_screenshot.png", "rb") as f:
|
|
25
|
+
# image = f.read()
|
|
26
|
+
image = image_provider()
|
|
27
|
+
|
|
28
|
+
# For additional instructions
|
|
29
|
+
# step = task.step(image, instruction="some instruction")
|
|
30
|
+
step = task.step(image)
|
|
31
|
+
|
|
32
|
+
# do something with step, maybe print to debug
|
|
33
|
+
print(f"Step {i}: {step.reason=}")
|
|
34
|
+
|
|
35
|
+
if step.stop:
|
|
36
|
+
print(f"Task completed after {i} steps.")
|
|
37
|
+
is_completed = True
|
|
38
|
+
screenshot = image_provider.last_image()
|
|
39
|
+
break
|
|
40
|
+
|
|
41
|
+
executor(step.actions)
|
|
42
|
+
else:
|
|
43
|
+
# If we didn't break out of the loop, we used up all our steps
|
|
44
|
+
is_completed = False
|
|
45
|
+
screenshot = image_provider()
|
|
46
|
+
|
|
47
|
+
print(f"manual execution completed: {is_completed=}, {task_desc=}\n")
|
|
48
|
+
return is_completed, screenshot
|
|
@@ -0,0 +1,15 @@
|
|
|
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 examples.execute_task_manual import execute_task_manual
|
|
10
|
+
|
|
11
|
+
is_completed, screenshot = execute_task_manual(
|
|
12
|
+
desc := "Search weather with Google", max_steps=5
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
print(f"is_completed: {is_completed}, desc: {desc}")
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
from datetime import date
|
|
9
|
+
|
|
10
|
+
from examples.execute_task_auto import execute_task_auto
|
|
11
|
+
from examples.execute_task_manual import execute_task_manual
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def get_date():
|
|
15
|
+
today = date.today()
|
|
16
|
+
# move to first day of this month
|
|
17
|
+
first_day_this_month = today.replace(day=1)
|
|
18
|
+
# move to first day of next month
|
|
19
|
+
if first_day_this_month.month == 12:
|
|
20
|
+
first_day_next_month = first_day_this_month.replace(
|
|
21
|
+
year=first_day_this_month.year + 1, month=1
|
|
22
|
+
)
|
|
23
|
+
else:
|
|
24
|
+
first_day_next_month = first_day_this_month.replace(
|
|
25
|
+
month=first_day_this_month.month + 1
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
start_date = str(first_day_this_month)
|
|
29
|
+
end_date = str(first_day_next_month.replace(day=3))
|
|
30
|
+
return start_date, end_date
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def main():
|
|
34
|
+
"""Task decomposition
|
|
35
|
+
1. Go to expedia.com
|
|
36
|
+
2. Click where to and enter Foster City
|
|
37
|
+
3. Click dates and click start date
|
|
38
|
+
4. Click end date and hit search
|
|
39
|
+
"""
|
|
40
|
+
start_date, end_date = get_date()
|
|
41
|
+
|
|
42
|
+
is_completed, screenshot = execute_task_auto(desc := "Go to expedia.com")
|
|
43
|
+
print(f"auto execution completed: {is_completed=}, {desc=}\n")
|
|
44
|
+
|
|
45
|
+
execute_task = execute_task_manual # or execute_task_auto
|
|
46
|
+
execute_task("Click where to and enter Foster City")
|
|
47
|
+
execute_task(f"Click dates and click {start_date}")
|
|
48
|
+
execute_task(f"Click {end_date} and hit search")
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
if __name__ == "__main__":
|
|
52
|
+
main()
|
|
@@ -0,0 +1,19 @@
|
|
|
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 oagi import single_step
|
|
10
|
+
|
|
11
|
+
step = single_step(
|
|
12
|
+
task_description="Search weather with Google",
|
|
13
|
+
screenshot="some/path/to/local/image", # bytes or Path object or Image object
|
|
14
|
+
instruction="The operating system is macos", # optional instruction
|
|
15
|
+
# api_key="your-api-key", if not set with OAGI_API_KEY env var
|
|
16
|
+
# base_url="https://api.example.com" if not set with OAGI_BASE_URL env var
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
print(step)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling==1.26.3", "hatch-fancy-pypi-readme"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "oagi"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Official API of OpenAGI Foundation"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { file = "LICENSE" }
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "OpenAGI Foundation", email = "contact@agiopen.org" }
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
requires-python = ">= 3.10"
|
|
16
|
+
|
|
17
|
+
dependencies = [
|
|
18
|
+
"httpx>=0.28.0",
|
|
19
|
+
"pillow>=11.3.0",
|
|
20
|
+
"pyautogui>=0.9.54",
|
|
21
|
+
"pydantic>=2.0.0",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.urls]
|
|
25
|
+
Homepage = "https://github.com/agiopen-org/oagi"
|
|
26
|
+
|
|
27
|
+
[dependency-groups]
|
|
28
|
+
dev = [
|
|
29
|
+
"ruff>=0.12.9",
|
|
30
|
+
"pytest>=8.0.0",
|
|
31
|
+
"pytest-mock>=3.12.0",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[tool.ruff.lint]
|
|
35
|
+
extend-select = ["I", "PLC0415"]
|