oagi-core 0.9.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.0/.github/workflows/ci.yml +45 -0
- oagi_core-0.9.0/.github/workflows/release.yml +59 -0
- oagi_core-0.9.0/.gitignore +212 -0
- oagi_core-0.9.0/.python-version +1 -0
- oagi_core-0.9.0/CONTRIBUTING.md +1 -0
- oagi_core-0.9.0/LICENSE +21 -0
- oagi_core-0.9.0/Makefile +57 -0
- oagi_core-0.9.0/PKG-INFO +257 -0
- oagi_core-0.9.0/README.md +217 -0
- oagi_core-0.9.0/examples/async_google_weather.py +23 -0
- oagi_core-0.9.0/examples/continued_session.py +53 -0
- oagi_core-0.9.0/examples/execute_task_auto.py +42 -0
- oagi_core-0.9.0/examples/execute_task_manual.py +98 -0
- oagi_core-0.9.0/examples/google_weather.py +15 -0
- oagi_core-0.9.0/examples/hotel_booking.py +52 -0
- oagi_core-0.9.0/examples/screenshot_with_config.py +94 -0
- oagi_core-0.9.0/examples/single_step.py +19 -0
- oagi_core-0.9.0/metapackage/pyproject.toml +31 -0
- oagi_core-0.9.0/pyproject.toml +52 -0
- oagi_core-0.9.0/src/oagi/__init__.py +108 -0
- oagi_core-0.9.0/src/oagi/agent/__init__.py +31 -0
- oagi_core-0.9.0/src/oagi/agent/default.py +75 -0
- oagi_core-0.9.0/src/oagi/agent/factories.py +50 -0
- oagi_core-0.9.0/src/oagi/agent/protocol.py +55 -0
- oagi_core-0.9.0/src/oagi/agent/registry.py +155 -0
- oagi_core-0.9.0/src/oagi/agent/tasker/__init__.py +35 -0
- oagi_core-0.9.0/src/oagi/agent/tasker/memory.py +184 -0
- oagi_core-0.9.0/src/oagi/agent/tasker/models.py +83 -0
- oagi_core-0.9.0/src/oagi/agent/tasker/planner.py +385 -0
- oagi_core-0.9.0/src/oagi/agent/tasker/taskee_agent.py +395 -0
- oagi_core-0.9.0/src/oagi/agent/tasker/tasker_agent.py +323 -0
- oagi_core-0.9.0/src/oagi/async_pyautogui_action_handler.py +44 -0
- oagi_core-0.9.0/src/oagi/async_screenshot_maker.py +47 -0
- oagi_core-0.9.0/src/oagi/async_single_step.py +85 -0
- oagi_core-0.9.0/src/oagi/cli/__init__.py +11 -0
- oagi_core-0.9.0/src/oagi/cli/agent.py +125 -0
- oagi_core-0.9.0/src/oagi/cli/main.py +77 -0
- oagi_core-0.9.0/src/oagi/cli/server.py +94 -0
- oagi_core-0.9.0/src/oagi/cli/utils.py +82 -0
- oagi_core-0.9.0/src/oagi/client/__init__.py +12 -0
- oagi_core-0.9.0/src/oagi/client/async_.py +293 -0
- oagi_core-0.9.0/src/oagi/client/base.py +465 -0
- oagi_core-0.9.0/src/oagi/client/sync.py +296 -0
- oagi_core-0.9.0/src/oagi/exceptions.py +118 -0
- oagi_core-0.9.0/src/oagi/logging.py +47 -0
- oagi_core-0.9.0/src/oagi/pil_image.py +102 -0
- oagi_core-0.9.0/src/oagi/pyautogui_action_handler.py +268 -0
- oagi_core-0.9.0/src/oagi/screenshot_maker.py +41 -0
- oagi_core-0.9.0/src/oagi/server/__init__.py +13 -0
- oagi_core-0.9.0/src/oagi/server/agent_wrappers.py +98 -0
- oagi_core-0.9.0/src/oagi/server/config.py +46 -0
- oagi_core-0.9.0/src/oagi/server/main.py +157 -0
- oagi_core-0.9.0/src/oagi/server/models.py +98 -0
- oagi_core-0.9.0/src/oagi/server/session_store.py +116 -0
- oagi_core-0.9.0/src/oagi/server/socketio_server.py +405 -0
- oagi_core-0.9.0/src/oagi/single_step.py +87 -0
- oagi_core-0.9.0/src/oagi/task/__init__.py +14 -0
- oagi_core-0.9.0/src/oagi/task/async_.py +97 -0
- oagi_core-0.9.0/src/oagi/task/async_short.py +64 -0
- oagi_core-0.9.0/src/oagi/task/base.py +121 -0
- oagi_core-0.9.0/src/oagi/task/short.py +64 -0
- oagi_core-0.9.0/src/oagi/task/sync.py +97 -0
- oagi_core-0.9.0/src/oagi/types/__init__.py +28 -0
- oagi_core-0.9.0/src/oagi/types/action_handler.py +30 -0
- oagi_core-0.9.0/src/oagi/types/async_action_handler.py +30 -0
- oagi_core-0.9.0/src/oagi/types/async_image_provider.py +37 -0
- oagi_core-0.9.0/src/oagi/types/image.py +17 -0
- oagi_core-0.9.0/src/oagi/types/image_provider.py +34 -0
- oagi_core-0.9.0/src/oagi/types/models/__init__.py +32 -0
- oagi_core-0.9.0/src/oagi/types/models/action.py +33 -0
- oagi_core-0.9.0/src/oagi/types/models/client.py +64 -0
- oagi_core-0.9.0/src/oagi/types/models/image_config.py +47 -0
- oagi_core-0.9.0/src/oagi/types/models/step.py +17 -0
- oagi_core-0.9.0/src/oagi/types/url_image.py +47 -0
- oagi_core-0.9.0/tests/__init__.py +9 -0
- oagi_core-0.9.0/tests/conftest.py +285 -0
- oagi_core-0.9.0/tests/test_agent/test_agent_wrappers.py +137 -0
- oagi_core-0.9.0/tests/test_agent/test_default_agent.py +99 -0
- oagi_core-0.9.0/tests/test_agent_registry.py +222 -0
- oagi_core-0.9.0/tests/test_async_client.py +359 -0
- oagi_core-0.9.0/tests/test_async_handlers.py +222 -0
- oagi_core-0.9.0/tests/test_async_task.py +239 -0
- oagi_core-0.9.0/tests/test_cli.py +133 -0
- oagi_core-0.9.0/tests/test_logging.py +363 -0
- oagi_core-0.9.0/tests/test_pil_image.py +236 -0
- oagi_core-0.9.0/tests/test_planner.py +233 -0
- oagi_core-0.9.0/tests/test_planner_memory.py +142 -0
- oagi_core-0.9.0/tests/test_pyautogui_action_handler.py +321 -0
- oagi_core-0.9.0/tests/test_screenshot_maker.py +175 -0
- oagi_core-0.9.0/tests/test_server/__init__.py +1 -0
- oagi_core-0.9.0/tests/test_server/test_config.py +20 -0
- oagi_core-0.9.0/tests/test_server/test_session_store.py +128 -0
- oagi_core-0.9.0/tests/test_server/test_socketio_integration.py +93 -0
- oagi_core-0.9.0/tests/test_short_task.py +150 -0
- oagi_core-0.9.0/tests/test_single_step.py +216 -0
- oagi_core-0.9.0/tests/test_sync_client.py +573 -0
- oagi_core-0.9.0/tests/test_task.py +423 -0
- oagi_core-0.9.0/tests/test_taskee_agent.py +394 -0
- oagi_core-0.9.0/tests/test_tasker_agent.py +220 -0
- oagi_core-0.9.0/tests/test_url_image.py +41 -0
- oagi_core-0.9.0/uv.lock +1545 -0
|
@@ -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-all
|
|
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,59 @@
|
|
|
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 both packages
|
|
27
|
+
run: make build-all
|
|
28
|
+
|
|
29
|
+
- name: Publish oagi-core to PyPI
|
|
30
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
31
|
+
with:
|
|
32
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
33
|
+
packages-dir: dist/
|
|
34
|
+
# Another option: Use Trusted Publishing (recommended, no token needed)
|
|
35
|
+
# Configure at: https://pypi.org/manage/project/oagi-core/settings/publishing/
|
|
36
|
+
|
|
37
|
+
- name: Publish oagi metapackage to PyPI
|
|
38
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
39
|
+
with:
|
|
40
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
41
|
+
packages-dir: metapackage/dist/
|
|
42
|
+
# Another option: Use Trusted Publishing (recommended, no token needed)
|
|
43
|
+
# Configure at: https://pypi.org/manage/project/oagi/settings/publishing/
|
|
44
|
+
|
|
45
|
+
- name: Get commit message
|
|
46
|
+
id: commit_message
|
|
47
|
+
run: |
|
|
48
|
+
# Get the commit message for the tagged commit
|
|
49
|
+
echo "message<<EOF" >> $GITHUB_OUTPUT
|
|
50
|
+
git log -1 --pretty=%B >> $GITHUB_OUTPUT
|
|
51
|
+
echo "EOF" >> $GITHUB_OUTPUT
|
|
52
|
+
|
|
53
|
+
- name: Create GitHub Release
|
|
54
|
+
uses: softprops/action-gh-release@v1
|
|
55
|
+
with:
|
|
56
|
+
body: ${{ steps.commit_message.outputs.message }}
|
|
57
|
+
files: |
|
|
58
|
+
dist/*
|
|
59
|
+
metapackage/dist/*
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
.DS_Store
|
|
6
|
+
|
|
7
|
+
# C extensions
|
|
8
|
+
*.so
|
|
9
|
+
|
|
10
|
+
# Distribution / packaging
|
|
11
|
+
.Python
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py.cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
#Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# UV
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
#uv.lock
|
|
103
|
+
|
|
104
|
+
# poetry
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
106
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
107
|
+
# commonly ignored for libraries.
|
|
108
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
109
|
+
#poetry.lock
|
|
110
|
+
#poetry.toml
|
|
111
|
+
|
|
112
|
+
# pdm
|
|
113
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
114
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
115
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
116
|
+
#pdm.lock
|
|
117
|
+
#pdm.toml
|
|
118
|
+
.pdm-python
|
|
119
|
+
.pdm-build/
|
|
120
|
+
|
|
121
|
+
# pixi
|
|
122
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
123
|
+
#pixi.lock
|
|
124
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
125
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
126
|
+
.pixi
|
|
127
|
+
|
|
128
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
129
|
+
__pypackages__/
|
|
130
|
+
|
|
131
|
+
# Celery stuff
|
|
132
|
+
celerybeat-schedule
|
|
133
|
+
celerybeat.pid
|
|
134
|
+
|
|
135
|
+
# SageMath parsed files
|
|
136
|
+
*.sage.py
|
|
137
|
+
|
|
138
|
+
# Environments
|
|
139
|
+
.env
|
|
140
|
+
.envrc
|
|
141
|
+
.venv
|
|
142
|
+
env/
|
|
143
|
+
venv/
|
|
144
|
+
ENV/
|
|
145
|
+
env.bak/
|
|
146
|
+
venv.bak/
|
|
147
|
+
|
|
148
|
+
# Spyder project settings
|
|
149
|
+
.spyderproject
|
|
150
|
+
.spyproject
|
|
151
|
+
|
|
152
|
+
# Rope project settings
|
|
153
|
+
.ropeproject
|
|
154
|
+
|
|
155
|
+
# mkdocs documentation
|
|
156
|
+
/site
|
|
157
|
+
|
|
158
|
+
# mypy
|
|
159
|
+
.mypy_cache/
|
|
160
|
+
.dmypy.json
|
|
161
|
+
dmypy.json
|
|
162
|
+
|
|
163
|
+
# Pyre type checker
|
|
164
|
+
.pyre/
|
|
165
|
+
|
|
166
|
+
# pytype static type analyzer
|
|
167
|
+
.pytype/
|
|
168
|
+
|
|
169
|
+
# Cython debug symbols
|
|
170
|
+
cython_debug/
|
|
171
|
+
|
|
172
|
+
# PyCharm
|
|
173
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
174
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
175
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
176
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
177
|
+
.idea/
|
|
178
|
+
|
|
179
|
+
# Abstra
|
|
180
|
+
# Abstra is an AI-powered process automation framework.
|
|
181
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
182
|
+
# Learn more at https://abstra.io/docs
|
|
183
|
+
.abstra/
|
|
184
|
+
|
|
185
|
+
# Visual Studio Code
|
|
186
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
187
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
188
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
189
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
190
|
+
# .vscode/
|
|
191
|
+
|
|
192
|
+
# Ruff stuff:
|
|
193
|
+
.ruff_cache/
|
|
194
|
+
|
|
195
|
+
# PyPI configuration file
|
|
196
|
+
.pypirc
|
|
197
|
+
|
|
198
|
+
# Cursor
|
|
199
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
200
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
201
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
202
|
+
.cursorignore
|
|
203
|
+
.cursorindexingignore
|
|
204
|
+
|
|
205
|
+
# Marimo
|
|
206
|
+
marimo/_static/
|
|
207
|
+
marimo/_lsp/
|
|
208
|
+
__marimo__/
|
|
209
|
+
|
|
210
|
+
# Metapackage synced files (copied from root)
|
|
211
|
+
metapackage/README.md
|
|
212
|
+
metapackage/LICENSE
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.10.18
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
## Development
|
oagi_core-0.9.0/LICENSE
ADDED
|
@@ -0,0 +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.
|
oagi_core-0.9.0/Makefile
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
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 --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
|
+
.PHONY: build
|
|
23
|
+
build: .uv
|
|
24
|
+
uv build
|
|
25
|
+
|
|
26
|
+
.PHONY: sync-metapackage-files
|
|
27
|
+
sync-metapackage-files:
|
|
28
|
+
@echo "Syncing README.md and LICENSE to metapackage..."
|
|
29
|
+
@cp README.md metapackage/README.md
|
|
30
|
+
@cp LICENSE metapackage/LICENSE
|
|
31
|
+
|
|
32
|
+
.PHONY: build-metapackage
|
|
33
|
+
build-metapackage: .uv sync-metapackage-files
|
|
34
|
+
cd metapackage && uv build
|
|
35
|
+
|
|
36
|
+
.PHONY: build-all
|
|
37
|
+
build-all: build build-metapackage
|
|
38
|
+
|
|
39
|
+
.PHONY: test
|
|
40
|
+
test: .uv install-dev
|
|
41
|
+
uv run pytest
|
|
42
|
+
|
|
43
|
+
.PHONY: test-verbose
|
|
44
|
+
test-verbose: .uv install-dev
|
|
45
|
+
uv run pytest -v
|
|
46
|
+
|
|
47
|
+
.PHONY: version
|
|
48
|
+
version:
|
|
49
|
+
@if [ -z "$(VERSION)" ]; then \
|
|
50
|
+
echo "Usage: make version VERSION=x.y.z"; \
|
|
51
|
+
echo "Current version: $$(grep '^version = ' pyproject.toml | head -1 | cut -d'"' -f2)"; \
|
|
52
|
+
exit 1; \
|
|
53
|
+
fi
|
|
54
|
+
@echo "Updating version to $(VERSION) in all files..."
|
|
55
|
+
@sed -i '' 's/^version = ".*"/version = "$(VERSION)"/' pyproject.toml
|
|
56
|
+
@sed -i '' 's/^version = ".*"/version = "$(VERSION)"/' metapackage/pyproject.toml
|
|
57
|
+
@sed -i '' 's/oagi-core\[desktop,server\]==.*/oagi-core[desktop,server]==$(VERSION)",/' metapackage/pyproject.toml
|
oagi_core-0.9.0/PKG-INFO
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: oagi-core
|
|
3
|
+
Version: 0.9.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: pydantic>=2.0.0
|
|
31
|
+
Provides-Extra: desktop
|
|
32
|
+
Requires-Dist: pillow>=11.3.0; extra == 'desktop'
|
|
33
|
+
Requires-Dist: pyautogui>=0.9.54; extra == 'desktop'
|
|
34
|
+
Provides-Extra: server
|
|
35
|
+
Requires-Dist: fastapi[standard]>=0.115.0; extra == 'server'
|
|
36
|
+
Requires-Dist: pydantic-settings>=2.0.0; extra == 'server'
|
|
37
|
+
Requires-Dist: python-socketio>=5.11.0; extra == 'server'
|
|
38
|
+
Requires-Dist: uvicorn[standard]>=0.32.0; extra == 'server'
|
|
39
|
+
Description-Content-Type: text/markdown
|
|
40
|
+
|
|
41
|
+
# OAGI Python SDK
|
|
42
|
+
|
|
43
|
+
Python SDK for the OAGI API - vision-based task automation.
|
|
44
|
+
|
|
45
|
+
## Installation
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Recommended: All features (desktop automation + server)
|
|
49
|
+
pip install oagi
|
|
50
|
+
|
|
51
|
+
# Or install core only (minimal dependencies)
|
|
52
|
+
pip install oagi-core
|
|
53
|
+
|
|
54
|
+
# Or install with specific features
|
|
55
|
+
pip install oagi-core[desktop] # Desktop automation support
|
|
56
|
+
pip install oagi-core[server] # Server support
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Requires Python >= 3.10**
|
|
60
|
+
|
|
61
|
+
### Installation Options
|
|
62
|
+
|
|
63
|
+
- **`oagi`** (Recommended): Metapackage that includes all features (desktop + server). Equivalent to `oagi-core[desktop,server]`.
|
|
64
|
+
- **`oagi-core`**: Core SDK with minimal dependencies (httpx, pydantic). Suitable for server deployments or custom automation setups.
|
|
65
|
+
- **`oagi-core[desktop]`**: Adds `pyautogui` and `pillow` for desktop automation features like screenshot capture and GUI control.
|
|
66
|
+
- **`oagi-core[server]`**: Adds FastAPI and Socket.IO dependencies for running the real-time server for browser extensions.
|
|
67
|
+
|
|
68
|
+
**Note**: Features requiring desktop dependencies (like `PILImage.from_screenshot()`, `PyautoguiActionHandler`, `ScreenshotMaker`) will show helpful error messages if you try to use them without installing the `desktop` extra.
|
|
69
|
+
|
|
70
|
+
## Quick Start
|
|
71
|
+
|
|
72
|
+
Set your API credentials:
|
|
73
|
+
```bash
|
|
74
|
+
export OAGI_API_KEY="your-api-key"
|
|
75
|
+
export OAGI_BASE_URL="https://api.oagi.com" # or your server URL
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Single-Step Analysis
|
|
79
|
+
|
|
80
|
+
Analyze a screenshot and get recommended actions:
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from oagi import single_step
|
|
84
|
+
|
|
85
|
+
step = single_step(
|
|
86
|
+
task_description="Click the submit button",
|
|
87
|
+
screenshot="screenshot.png" # or bytes, or Image object
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
print(f"Actions: {step.actions}")
|
|
91
|
+
print(f"Complete: {step.is_complete}")
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Automated Task Execution
|
|
95
|
+
|
|
96
|
+
Run tasks automatically with screenshot capture and action execution:
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
from oagi import ShortTask, ScreenshotMaker, PyautoguiActionHandler
|
|
100
|
+
|
|
101
|
+
task = ShortTask()
|
|
102
|
+
completed = task.auto_mode(
|
|
103
|
+
"Search weather on Google",
|
|
104
|
+
max_steps=10,
|
|
105
|
+
executor=PyautoguiActionHandler(), # Executes mouse/keyboard actions
|
|
106
|
+
image_provider=ScreenshotMaker(), # Captures screenshots
|
|
107
|
+
)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Configure PyAutoGUI behavior with custom settings:
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
from oagi import PyautoguiActionHandler, PyautoguiConfig
|
|
114
|
+
|
|
115
|
+
# Customize action behavior
|
|
116
|
+
config = PyautoguiConfig(
|
|
117
|
+
drag_duration=1.0, # Slower drags for precision (default: 0.5)
|
|
118
|
+
scroll_amount=50, # Larger scroll steps (default: 30)
|
|
119
|
+
wait_duration=2.0, # Longer waits (default: 1.0)
|
|
120
|
+
action_pause=0.2, # More pause between actions (default: 0.1)
|
|
121
|
+
hotkey_interval=0.1, # Interval between keys in hotkey combinations (default: 0.1)
|
|
122
|
+
capslock_mode="session" # Caps lock mode: 'session' or 'system' (default: 'session')
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
executor = PyautoguiActionHandler(config=config)
|
|
126
|
+
task.auto_mode("Complete form", executor=executor, image_provider=ScreenshotMaker())
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Image Processing
|
|
130
|
+
|
|
131
|
+
Process and optimize images before sending to API:
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
from oagi import PILImage, ImageConfig
|
|
135
|
+
|
|
136
|
+
# Load and compress an image
|
|
137
|
+
image = PILImage.from_file("large_screenshot.png")
|
|
138
|
+
config = ImageConfig(
|
|
139
|
+
format="JPEG",
|
|
140
|
+
quality=85,
|
|
141
|
+
width=1260,
|
|
142
|
+
height=700
|
|
143
|
+
)
|
|
144
|
+
compressed = image.transform(config)
|
|
145
|
+
|
|
146
|
+
# Use with single_step
|
|
147
|
+
step = single_step("Click button", screenshot=compressed)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Async Support
|
|
151
|
+
|
|
152
|
+
Use async client for non-blocking operations and better concurrency:
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
import asyncio
|
|
156
|
+
from oagi import async_single_step, AsyncShortTask
|
|
157
|
+
|
|
158
|
+
async def main():
|
|
159
|
+
# Single-step async analysis
|
|
160
|
+
step = await async_single_step(
|
|
161
|
+
"Find the search bar",
|
|
162
|
+
screenshot="screenshot.png"
|
|
163
|
+
)
|
|
164
|
+
print(f"Found {len(step.actions)} actions")
|
|
165
|
+
|
|
166
|
+
# Async task automation
|
|
167
|
+
task = AsyncShortTask()
|
|
168
|
+
async with task:
|
|
169
|
+
await task.init_task("Complete the form")
|
|
170
|
+
# ... continue with async operations
|
|
171
|
+
|
|
172
|
+
asyncio.run(main())
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Examples
|
|
176
|
+
|
|
177
|
+
See the [`examples/`](examples/) directory for more usage patterns:
|
|
178
|
+
- `google_weather.py` - Basic task execution with `ShortTask`
|
|
179
|
+
- `single_step.py` - Basic single-step inference
|
|
180
|
+
- `screenshot_with_config.py` - Image compression and optimization
|
|
181
|
+
- `execute_task_auto.py` - Automated task execution
|
|
182
|
+
- `socketio_server_basic.py` - Socket.IO server example
|
|
183
|
+
- `socketio_client_example.py` - Socket.IO client implementation
|
|
184
|
+
|
|
185
|
+
## Socket.IO Server (Optional)
|
|
186
|
+
|
|
187
|
+
The SDK includes an optional Socket.IO server for real-time bidirectional communication with browser extensions or custom clients.
|
|
188
|
+
|
|
189
|
+
### Installation
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
# Install with server support
|
|
193
|
+
pip install oagi # Includes server features
|
|
194
|
+
# Or
|
|
195
|
+
pip install oagi-core[server] # Core + server only
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Running the Server
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
import uvicorn
|
|
202
|
+
from oagi.server import create_app, ServerConfig
|
|
203
|
+
|
|
204
|
+
# Create FastAPI app with Socket.IO
|
|
205
|
+
app = create_app()
|
|
206
|
+
|
|
207
|
+
# Run server
|
|
208
|
+
uvicorn.run(app, host="0.0.0.0", port=8000)
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Or use the example script:
|
|
212
|
+
```bash
|
|
213
|
+
export OAGI_API_KEY="your-api-key"
|
|
214
|
+
python examples/socketio_server_basic.py
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Server Features
|
|
218
|
+
|
|
219
|
+
- **Dynamic namespaces**: Each session gets its own namespace (`/session/{session_id}`)
|
|
220
|
+
- **Simplified events**: Single `init` event from client with instruction
|
|
221
|
+
- **Action execution**: Emit individual actions (click, type, scroll, etc.) to client
|
|
222
|
+
- **S3 integration**: Server sends presigned URLs for direct screenshot uploads
|
|
223
|
+
- **Session management**: In-memory session storage with timeout cleanup
|
|
224
|
+
- **REST API**: Health checks and session management endpoints
|
|
225
|
+
|
|
226
|
+
### Client Integration
|
|
227
|
+
|
|
228
|
+
Clients connect to a session namespace and handle action events:
|
|
229
|
+
|
|
230
|
+
```python
|
|
231
|
+
import socketio
|
|
232
|
+
|
|
233
|
+
sio = socketio.AsyncClient()
|
|
234
|
+
namespace = "/session/my_session_id"
|
|
235
|
+
|
|
236
|
+
@sio.on("request_screenshot", namespace=namespace)
|
|
237
|
+
async def on_screenshot(data):
|
|
238
|
+
# Upload screenshot to S3 using presigned URL
|
|
239
|
+
return {"success": True}
|
|
240
|
+
|
|
241
|
+
@sio.on("click", namespace=namespace)
|
|
242
|
+
async def on_click(data):
|
|
243
|
+
# Execute click at coordinates
|
|
244
|
+
return {"success": True}
|
|
245
|
+
|
|
246
|
+
await sio.connect("http://localhost:8000", namespaces=[namespace])
|
|
247
|
+
await sio.emit("init", {"instruction": "Click the button"}, namespace=namespace)
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
See [`examples/socketio_client_example.py`](examples/socketio_client_example.py) for a complete implementation.
|
|
251
|
+
|
|
252
|
+
## Documentation
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
## License
|
|
256
|
+
|
|
257
|
+
MIT
|