gl-runner-sdk 0.1.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.
- gl_runner_sdk-0.1.0/.env.example +3 -0
- gl_runner_sdk-0.1.0/.env.test.example +3 -0
- gl_runner_sdk-0.1.0/.gitconfig +7 -0
- gl_runner_sdk-0.1.0/.gitignore +164 -0
- gl_runner_sdk-0.1.0/PKG-INFO +10 -0
- gl_runner_sdk-0.1.0/README.md +157 -0
- gl_runner_sdk-0.1.0/build.ci.github.sh +67 -0
- gl_runner_sdk-0.1.0/docs-planning/manual-publish-checklist-premium.md +126 -0
- gl_runner_sdk-0.1.0/examples/.env.example +7 -0
- gl_runner_sdk-0.1.0/examples/01_hello_world.py +38 -0
- gl_runner_sdk-0.1.0/examples/02_math_sum.py +38 -0
- gl_runner_sdk-0.1.0/examples/03_simple_de.py +44 -0
- gl_runner_sdk-0.1.0/examples/04_custom_de.py +42 -0
- gl_runner_sdk-0.1.0/examples/05_stateful_runnables.py +53 -0
- gl_runner_sdk-0.1.0/examples/06_streaming_response.py +48 -0
- gl_runner_sdk-0.1.0/examples/bundles/README.md +13 -0
- gl_runner_sdk-0.1.0/examples/bundles/custom_de/.env.example +15 -0
- gl_runner_sdk-0.1.0/examples/bundles/custom_de/__init__.py +3 -0
- gl_runner_sdk-0.1.0/examples/bundles/custom_de/entrypoint.py +22 -0
- gl_runner_sdk-0.1.0/examples/bundles/custom_de/runnables.yaml +7 -0
- gl_runner_sdk-0.1.0/examples/bundles/custom_de/src/__init__.py +5 -0
- gl_runner_sdk-0.1.0/examples/bundles/custom_de/src/main.py +100 -0
- gl_runner_sdk-0.1.0/examples/bundles/custom_de/tools/__init__.py +12 -0
- gl_runner_sdk-0.1.0/examples/bundles/custom_de/tools/weather.py +91 -0
- gl_runner_sdk-0.1.0/examples/bundles/hello-world/__init__.py +8 -0
- gl_runner_sdk-0.1.0/examples/bundles/hello-world/entrypoint.py +30 -0
- gl_runner_sdk-0.1.0/examples/bundles/hello-world/runnables.yaml +7 -0
- gl_runner_sdk-0.1.0/examples/bundles/math-sum/__init__.py +8 -0
- gl_runner_sdk-0.1.0/examples/bundles/math-sum/entrypoint.py +32 -0
- gl_runner_sdk-0.1.0/examples/bundles/math-sum/runnables.yaml +7 -0
- gl_runner_sdk-0.1.0/examples/bundles/simple-de/.env.example +15 -0
- gl_runner_sdk-0.1.0/examples/bundles/simple-de/__init__.py +4 -0
- gl_runner_sdk-0.1.0/examples/bundles/simple-de/entrypoint.py +110 -0
- gl_runner_sdk-0.1.0/examples/bundles/simple-de/runnables.yaml +7 -0
- gl_runner_sdk-0.1.0/examples/bundles/stateful-runnables/__init__.py +0 -0
- gl_runner_sdk-0.1.0/examples/bundles/stateful-runnables/entrypoint.py +134 -0
- gl_runner_sdk-0.1.0/examples/bundles/stateful-runnables/runnables.yaml +7 -0
- gl_runner_sdk-0.1.0/examples/bundles/streaming-response/__init__.py +0 -0
- gl_runner_sdk-0.1.0/examples/bundles/streaming-response/entrypoint.py +67 -0
- gl_runner_sdk-0.1.0/examples/bundles/streaming-response/runnables.yaml +7 -0
- gl_runner_sdk-0.1.0/examples/quickstart.md +66 -0
- gl_runner_sdk-0.1.0/examples/sdk_quickstart_notebook.ipynb +279 -0
- gl_runner_sdk-0.1.0/gitbook/getting-started/README.md +195 -0
- gl_runner_sdk-0.1.0/gitbook/gl-runner-cookbook.md +125 -0
- gl_runner_sdk-0.1.0/gitbook/guides/README.md +15 -0
- gl_runner_sdk-0.1.0/gitbook/guides/building-runnables.md +100 -0
- gl_runner_sdk-0.1.0/gitbook/guides/bundle-format.md +60 -0
- gl_runner_sdk-0.1.0/gitbook/guides/deploy-runnables.md +55 -0
- gl_runner_sdk-0.1.0/gitbook/guides/run-and-wait.md +41 -0
- gl_runner_sdk-0.1.0/gitbook/guides/streaming-and-history.md +105 -0
- gl_runner_sdk-0.1.0/gitbook/guides/update-runnables.md +55 -0
- gl_runner_sdk-0.1.0/gitbook/introduction-to-gl-runner.md +37 -0
- gl_runner_sdk-0.1.0/gitbook/prerequisites.md +26 -0
- gl_runner_sdk-0.1.0/gitbook/resources/README.md +10 -0
- gl_runner_sdk-0.1.0/gitbook/resources/glossary.md +6 -0
- gl_runner_sdk-0.1.0/gitbook/resources/reference/README.md +3 -0
- gl_runner_sdk-0.1.0/gitbook/resources/reference/python-sdk.md +127 -0
- gl_runner_sdk-0.1.0/gitbook/resources/reference/rest-api/README.md +4 -0
- gl_runner_sdk-0.1.0/gitbook/resources/reference/rest-api/runnables.md +9 -0
- gl_runner_sdk-0.1.0/gitbook/resources/reference/rest-api/runs.md +6 -0
- gl_runner_sdk-0.1.0/gitbook/resources/reference/rest-api/schemas.md +9 -0
- gl_runner_sdk-0.1.0/gitbook/resources/runtime-environment.md +160 -0
- gl_runner_sdk-0.1.0/gitbook/tutorials/README.md +14 -0
- gl_runner_sdk-0.1.0/gitbook/tutorials/custom-de.md +110 -0
- gl_runner_sdk-0.1.0/gitbook/tutorials/hello-world.md +74 -0
- gl_runner_sdk-0.1.0/gitbook/tutorials/math-sum.md +78 -0
- gl_runner_sdk-0.1.0/gitbook/tutorials/simple-de.md +92 -0
- gl_runner_sdk-0.1.0/gitbook/tutorials/stateful-runnables.md +114 -0
- gl_runner_sdk-0.1.0/gl_runner_sdk/__init__.py +26 -0
- gl_runner_sdk-0.1.0/gl_runner_sdk/client/__init__.py +12 -0
- gl_runner_sdk-0.1.0/gl_runner_sdk/client/clients.py +82 -0
- gl_runner_sdk-0.1.0/gl_runner_sdk/runnables/__init__.py +12 -0
- gl_runner_sdk-0.1.0/gl_runner_sdk/runnables/runnables.py +629 -0
- gl_runner_sdk-0.1.0/gl_runner_sdk/runs/__init__.py +12 -0
- gl_runner_sdk-0.1.0/gl_runner_sdk/runs/runs.py +304 -0
- gl_runner_sdk-0.1.0/gl_runner_sdk/types/__init__.py +18 -0
- gl_runner_sdk-0.1.0/gl_runner_sdk/types/runnables.py +29 -0
- gl_runner_sdk-0.1.0/gl_runner_sdk/types/runs.py +67 -0
- gl_runner_sdk-0.1.0/pyproject.toml +31 -0
- gl_runner_sdk-0.1.0/scripts/_utils.py +83 -0
- gl_runner_sdk-0.1.0/scripts/delete.py +57 -0
- gl_runner_sdk-0.1.0/scripts/deploy.py +83 -0
- gl_runner_sdk-0.1.0/scripts/history.py +69 -0
- gl_runner_sdk-0.1.0/scripts/list.py +97 -0
- gl_runner_sdk-0.1.0/scripts/run.py +146 -0
- gl_runner_sdk-0.1.0/scripts/update.py +89 -0
- gl_runner_sdk-0.1.0/sonar-project.properties +15 -0
- gl_runner_sdk-0.1.0/tests/conftest.py +41 -0
- gl_runner_sdk-0.1.0/tests/fakes.py +41 -0
- gl_runner_sdk-0.1.0/tests/integration/__init__.py +8 -0
- gl_runner_sdk-0.1.0/tests/integration/bundles/streaming-agent/__init__.py +0 -0
- gl_runner_sdk-0.1.0/tests/integration/bundles/streaming-agent/entrypoint.py +27 -0
- gl_runner_sdk-0.1.0/tests/integration/bundles/streaming-agent/runnables.yaml +1 -0
- gl_runner_sdk-0.1.0/tests/integration/bundles/streaming-slow-agent/__init__.py +0 -0
- gl_runner_sdk-0.1.0/tests/integration/bundles/streaming-slow-agent/entrypoint.py +30 -0
- gl_runner_sdk-0.1.0/tests/integration/bundles/streaming-slow-agent/runnables.yaml +1 -0
- gl_runner_sdk-0.1.0/tests/integration/test_sdk_integration.py +117 -0
- gl_runner_sdk-0.1.0/tests/integration/test_sdk_streaming.py +256 -0
- gl_runner_sdk-0.1.0/tests/unit/__init__.py +8 -0
- gl_runner_sdk-0.1.0/tests/unit/test_client.py +59 -0
- gl_runner_sdk-0.1.0/tests/unit/test_runnables.py +726 -0
- gl_runner_sdk-0.1.0/tests/unit/test_runs.py +411 -0
- gl_runner_sdk-0.1.0/tests/unit/test_script_utils.py +83 -0
- gl_runner_sdk-0.1.0/uv.lock +289 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
[user]
|
|
2
|
+
name = catapa-infra
|
|
3
|
+
email = sre@catapa.com
|
|
4
|
+
[url "https://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:x-oauth-basic@github.com/"]
|
|
5
|
+
insteadOf = https://github.com/
|
|
6
|
+
[url "https://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@github.com"]
|
|
7
|
+
insteadOf = ssh://git@github.com
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Created by https://www.gitignore.io/api/python
|
|
2
|
+
# Edit at https://www.gitignore.io/?templates=python
|
|
3
|
+
|
|
4
|
+
### Python ###
|
|
5
|
+
# Byte-compiled / optimized / DLL files
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*$py.class
|
|
9
|
+
|
|
10
|
+
# C extensions
|
|
11
|
+
*.so
|
|
12
|
+
|
|
13
|
+
# Distribution / packaging
|
|
14
|
+
.Python
|
|
15
|
+
build/
|
|
16
|
+
jars/
|
|
17
|
+
develop-eggs/
|
|
18
|
+
dist/
|
|
19
|
+
downloads/
|
|
20
|
+
eggs/
|
|
21
|
+
.eggs/
|
|
22
|
+
lib/
|
|
23
|
+
lib64/
|
|
24
|
+
parts/
|
|
25
|
+
sdist/
|
|
26
|
+
var/
|
|
27
|
+
wheels/
|
|
28
|
+
pip-wheel-metadata/
|
|
29
|
+
share/python-wheels/
|
|
30
|
+
*.egg-info/
|
|
31
|
+
.installed.cfg
|
|
32
|
+
*.egg
|
|
33
|
+
MANIFEST
|
|
34
|
+
|
|
35
|
+
# PyInstaller
|
|
36
|
+
# Usually these files are written by a python script from a template
|
|
37
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
38
|
+
*.manifest
|
|
39
|
+
*.spec
|
|
40
|
+
|
|
41
|
+
# Installer logs
|
|
42
|
+
pip-log.txt
|
|
43
|
+
pip-delete-this-directory.txt
|
|
44
|
+
|
|
45
|
+
# Unit test / coverage reports
|
|
46
|
+
htmlcov/
|
|
47
|
+
.tox/
|
|
48
|
+
.nox/
|
|
49
|
+
.coverage
|
|
50
|
+
.coverage.*
|
|
51
|
+
.cache
|
|
52
|
+
nosetests.xml
|
|
53
|
+
coverage.xml
|
|
54
|
+
*.cover
|
|
55
|
+
.hypothesis/
|
|
56
|
+
.pytest_cache/
|
|
57
|
+
|
|
58
|
+
# Translations
|
|
59
|
+
*.mo
|
|
60
|
+
*.pot
|
|
61
|
+
|
|
62
|
+
# Sphinx documentation
|
|
63
|
+
docs/_build/
|
|
64
|
+
|
|
65
|
+
# PyBuilder
|
|
66
|
+
target/
|
|
67
|
+
|
|
68
|
+
# Jupyter Notebook
|
|
69
|
+
.ipynb_checkpoints
|
|
70
|
+
|
|
71
|
+
# IPython
|
|
72
|
+
profile_default/
|
|
73
|
+
ipython_config.py
|
|
74
|
+
|
|
75
|
+
# pyenv
|
|
76
|
+
.python-version
|
|
77
|
+
|
|
78
|
+
# pipenv
|
|
79
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
80
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
81
|
+
# having no cross-platform support, pipenv may install dependencies that don’t work, or not
|
|
82
|
+
# install all needed dependencies.
|
|
83
|
+
#Pipfile.lock
|
|
84
|
+
|
|
85
|
+
# celery beat schedule file
|
|
86
|
+
celerybeat-schedule
|
|
87
|
+
|
|
88
|
+
# SageMath parsed files
|
|
89
|
+
*.sage.py
|
|
90
|
+
|
|
91
|
+
# Environments
|
|
92
|
+
.idea
|
|
93
|
+
.env
|
|
94
|
+
.venv
|
|
95
|
+
env/
|
|
96
|
+
venv/
|
|
97
|
+
ENV/
|
|
98
|
+
env.bak/
|
|
99
|
+
venv.bak/
|
|
100
|
+
|
|
101
|
+
# Spyder project settings
|
|
102
|
+
.spyderproject
|
|
103
|
+
.spyproject
|
|
104
|
+
|
|
105
|
+
# Rope project settings
|
|
106
|
+
.ropeproject
|
|
107
|
+
|
|
108
|
+
# mkdocs documentation
|
|
109
|
+
/site
|
|
110
|
+
|
|
111
|
+
# End of https://www.gitignore.io/api/python
|
|
112
|
+
|
|
113
|
+
build/*
|
|
114
|
+
test/data/demand_forecaster/save_model.model
|
|
115
|
+
condaenv.t1e302om.requirements.txt
|
|
116
|
+
|
|
117
|
+
*.env
|
|
118
|
+
!build.ci.env
|
|
119
|
+
*.aes
|
|
120
|
+
|
|
121
|
+
# local IDE stuffs
|
|
122
|
+
.idea/*
|
|
123
|
+
.DS_Store
|
|
124
|
+
data/
|
|
125
|
+
db/
|
|
126
|
+
embeddings_model/
|
|
127
|
+
logs/
|
|
128
|
+
tokenizer/
|
|
129
|
+
|
|
130
|
+
#vs code stuffs
|
|
131
|
+
.vscode/*
|
|
132
|
+
!.vscode/extensions.json
|
|
133
|
+
|
|
134
|
+
#specific files
|
|
135
|
+
libs/documentation/scripts/docs_generated/*
|
|
136
|
+
libs/documentation/docs/gllm*
|
|
137
|
+
libs/documentation/docs/index.rst
|
|
138
|
+
libs/documentation/docs/conf.py
|
|
139
|
+
libs/documentation/docs/_summary/
|
|
140
|
+
libs/documentation/docs/_build/
|
|
141
|
+
|
|
142
|
+
**/.local_files/*
|
|
143
|
+
**/.local/*
|
|
144
|
+
*.pyi
|
|
145
|
+
setup.cfg
|
|
146
|
+
setup.py
|
|
147
|
+
*.xml
|
|
148
|
+
*cache
|
|
149
|
+
*.key
|
|
150
|
+
!cache/
|
|
151
|
+
!hybrid_cache/
|
|
152
|
+
!vector_cache/
|
|
153
|
+
!data_store_cache/
|
|
154
|
+
|
|
155
|
+
/.playwright-mcp/
|
|
156
|
+
/reviews/
|
|
157
|
+
/.worktrees/
|
|
158
|
+
/.tmp/
|
|
159
|
+
/.agents/local/
|
|
160
|
+
fix_plan_*.md
|
|
161
|
+
|
|
162
|
+
deployment/helm-values/values.glchatdemo.secret.yaml
|
|
163
|
+
deployment/helm-values/values.glchatdev.secret.yaml
|
|
164
|
+
deployment/helm-values/values.glchatprod.secret.yaml
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gl-runner-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: GL Runner Python SDK
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Requires-Dist: httpx>=0.27
|
|
7
|
+
Provides-Extra: dev
|
|
8
|
+
Requires-Dist: coverage>=7.11.0; extra == 'dev'
|
|
9
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
10
|
+
Requires-Dist: ruff>=0.14.0; extra == 'dev'
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# GL Runner Python SDK
|
|
2
|
+
|
|
3
|
+
Lightweight Python SDK for interacting with GL Runner API.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install -e python/gl-runner-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from gl_runner_sdk import Runnable
|
|
15
|
+
|
|
16
|
+
runnable = Runnable(
|
|
17
|
+
base_url="https://runner.example.com",
|
|
18
|
+
api_key="glr_...",
|
|
19
|
+
key="hello-world",
|
|
20
|
+
bundle_path="./examples/bundles/hello-world",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
# Deploy a runnable
|
|
24
|
+
deployment = runnable.deploy()
|
|
25
|
+
print(deployment.id)
|
|
26
|
+
|
|
27
|
+
# Run waits by default and returns the completed result
|
|
28
|
+
result = runnable.run(payload={"question": "status"})
|
|
29
|
+
print(result)
|
|
30
|
+
|
|
31
|
+
# Trigger returns a run record without waiting
|
|
32
|
+
run = runnable.trigger(payload={"question": "status"})
|
|
33
|
+
print(run.id)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Blank Folder Quickstart
|
|
37
|
+
|
|
38
|
+
1. Create a new folder and install:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
mkdir lite-sdk-quickstart && cd lite-sdk-quickstart
|
|
42
|
+
python3 -m venv .venv
|
|
43
|
+
source .venv/bin/activate
|
|
44
|
+
pip install gl-runner-sdk python-dotenv
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
2. Set API variables:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
export GL_RUNNER_BASE_URL="http://localhost:4200"
|
|
51
|
+
export GL_RUNNER_API_KEY="glr_..."
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
3. Create files:
|
|
55
|
+
|
|
56
|
+
```text
|
|
57
|
+
lite-sdk-quickstart/
|
|
58
|
+
deploy_and_run.py
|
|
59
|
+
bundles/
|
|
60
|
+
hello-world/
|
|
61
|
+
runnables.yaml
|
|
62
|
+
entrypoint.py
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`bundles/hello-world/runnables.yaml`:
|
|
66
|
+
|
|
67
|
+
```yaml
|
|
68
|
+
entrypoint: entrypoint.py:handler
|
|
69
|
+
kind: code
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`bundles/hello-world/entrypoint.py`:
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
def handler(payload=None, context=None):
|
|
76
|
+
payload = payload or {}
|
|
77
|
+
return {"ok": True, "echo": payload}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`deploy_and_run.py`:
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from gl_runner_sdk import Runnable
|
|
84
|
+
|
|
85
|
+
runnable = Runnable(
|
|
86
|
+
key="hello-world",
|
|
87
|
+
bundle_path="./bundles/hello-world",
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
deployment = runnable.deploy()
|
|
91
|
+
result = runnable.run(payload={"message": "hello"})
|
|
92
|
+
print("deployment_id=", deployment.id)
|
|
93
|
+
print("result=", result)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
4. Run:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
python deploy_and_run.py
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Expected output includes a deployment id and a result similar to
|
|
103
|
+
`{"ok": True, "echo": {"message": "hello"}}`.
|
|
104
|
+
|
|
105
|
+
## Environment Variables
|
|
106
|
+
|
|
107
|
+
| Variable | Default | Description |
|
|
108
|
+
|----------|---------|-------------|
|
|
109
|
+
| `GL_RUNNER_API_KEY` | required | API key for authentication |
|
|
110
|
+
| `GL_RUNNER_BASE_URL` | `http://localhost:4200` | Base URL |
|
|
111
|
+
|
|
112
|
+
The SDK client reads `GL_RUNNER_BASE_URL` and `GL_RUNNER_API_KEY` from your
|
|
113
|
+
local environment for API access.
|
|
114
|
+
|
|
115
|
+
Bundle packaging excludes `.env`, `.env.*`, caches, virtualenvs, build outputs,
|
|
116
|
+
and VCS metadata by default. If a trusted local bundle must carry a runtime
|
|
117
|
+
`.env`, opt in explicitly with `include_sensitive_files=[".env"]` or
|
|
118
|
+
`gl-runner deploy --include-sensitive-file .env`.
|
|
119
|
+
|
|
120
|
+
Deployed runnable code only sees variables provided by the runner environment,
|
|
121
|
+
or files explicitly packaged into the bundle.
|
|
122
|
+
|
|
123
|
+
Troubleshooting:
|
|
124
|
+
- `401/403`: verify `GL_RUNNER_API_KEY`.
|
|
125
|
+
- connection errors: verify `GL_RUNNER_BASE_URL` and server availability.
|
|
126
|
+
- `Bundle manifest is required`: ensure `runnables.yaml` exists in bundle root.
|
|
127
|
+
- runnable cannot read `.env`: include it explicitly or set variables on runner.
|
|
128
|
+
|
|
129
|
+
## Tests
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
python -m pytest
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Integration tests auto-skip unless they can reach `GL_RUNNER_BASE_URL` and
|
|
136
|
+
`GL_RUNNER_API_KEY` is configured.
|
|
137
|
+
|
|
138
|
+
## Scripts
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Deploy
|
|
142
|
+
python ./scripts/deploy.py --bundle-path ./bundle --key hello
|
|
143
|
+
|
|
144
|
+
# Run
|
|
145
|
+
python ./scripts/run.py --runnable-id <id> --payload '{"key":"value"}'
|
|
146
|
+
|
|
147
|
+
# Wait
|
|
148
|
+
python ./scripts/run.py --runnable-id <id> --wait
|
|
149
|
+
|
|
150
|
+
# List
|
|
151
|
+
python ./scripts/list.py runnables
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Example Bundles
|
|
155
|
+
|
|
156
|
+
Deployable bundles from the original `python/gl-runner/examples` tree now live
|
|
157
|
+
under `examples/bundles/`.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
REPORT_PATH=build/reports
|
|
5
|
+
|
|
6
|
+
rm -rf dist build *.egg-info
|
|
7
|
+
mkdir -p "$REPORT_PATH"
|
|
8
|
+
|
|
9
|
+
cd "$(dirname "$0")"
|
|
10
|
+
|
|
11
|
+
export HOME=${HOME:-$(pwd)}
|
|
12
|
+
export REPORT_PATH
|
|
13
|
+
|
|
14
|
+
if [[ "${CI}" == "true" ]]; then
|
|
15
|
+
git config --unset credential.helper || :
|
|
16
|
+
git config --global user.name "catapa-infra"
|
|
17
|
+
git config --global user.email "sre@catapa.com"
|
|
18
|
+
git config --global url."https://${GH_TOKEN}:x-oauth-basic@github.com/".insteadOf "https://github.com/"
|
|
19
|
+
git config --global url."https://${GH_TOKEN}@github.com".insteadOf "ssh://git@github.com"
|
|
20
|
+
git branch -m temp-branch 2>/dev/null || echo "Note: Could not rename branch, continuing..."
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
function build {
|
|
24
|
+
echo "Installing SDK dependencies..."
|
|
25
|
+
uv sync --extra dev --frozen
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function run_code_style_check {
|
|
29
|
+
echo "Running code style check with ruff..."
|
|
30
|
+
uv run ruff check . --exclude=.venv,build,dist,.local,.cache,__pycache__
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function run_tests {
|
|
34
|
+
echo "Running SDK tests and generating coverage report..."
|
|
35
|
+
uv run python -m coverage run -m pytest
|
|
36
|
+
test_exit_code=$?
|
|
37
|
+
|
|
38
|
+
if [[ $test_exit_code -ne 0 ]]; then
|
|
39
|
+
echo "ERROR: Tests failed with exit code $test_exit_code"
|
|
40
|
+
exit $test_exit_code
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
uv run python -m coverage report -m -i --skip-empty
|
|
44
|
+
uv run python -m coverage xml -i -o "$REPORT_PATH/gl-runner-sdk.xml"
|
|
45
|
+
|
|
46
|
+
if [[ -f "$REPORT_PATH/gl-runner-sdk.xml" ]]; then
|
|
47
|
+
echo "SUCCESS: Coverage report generated at $REPORT_PATH/gl-runner-sdk.xml"
|
|
48
|
+
else
|
|
49
|
+
echo "ERROR: Coverage report file was not created!"
|
|
50
|
+
exit 1
|
|
51
|
+
fi
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function build_package {
|
|
55
|
+
echo "Building SDK package..."
|
|
56
|
+
uv build
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
build
|
|
60
|
+
|
|
61
|
+
if [[ "${CI}" == "true" ]]; then
|
|
62
|
+
run_code_style_check
|
|
63
|
+
run_tests
|
|
64
|
+
build_package
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
echo "Build and test completed successfully!"
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# GL Runner Manual Publish Checklist (Premium)
|
|
2
|
+
|
|
3
|
+
This is the operational source of truth for:
|
|
4
|
+
|
|
5
|
+
- sidebar order in GitBook,
|
|
6
|
+
- target slug mapping under `https://gdplabs.gitbook.io/sdk/gl-runner/...`,
|
|
7
|
+
- phased publishing sequence.
|
|
8
|
+
|
|
9
|
+
Authoring source in repo:
|
|
10
|
+
|
|
11
|
+
- `python/gl-runner-sdk/gitbook/`
|
|
12
|
+
|
|
13
|
+
Standardization policy applied:
|
|
14
|
+
|
|
15
|
+
- UX-first onboarding order is used for GL Runner:
|
|
16
|
+
`Overview` -> `Prerequisites` -> `Getting Started` -> `Guides` -> `Tutorials` -> `Resources`.
|
|
17
|
+
- Required sections are present: Introduction (Overview), Prerequisites, Getting Started.
|
|
18
|
+
- Topics are organized into: `Getting Started`, `Guides`,
|
|
19
|
+
`Prerequisites`, `Tutorials`, `Resources`.
|
|
20
|
+
- `Cookbook` is published at the root level (`gl-runner-cookbook.md`), not nested under `guides/`.
|
|
21
|
+
|
|
22
|
+
## 0) One-time setup in GitBook (GL SDK space)
|
|
23
|
+
|
|
24
|
+
1. Create a top-level page/collection: `GL Runner`.
|
|
25
|
+
1. Set top-level slug: `gl-runner`.
|
|
26
|
+
1. Create top-level children in this exact order:
|
|
27
|
+
- `introduction-to-gl-runner`
|
|
28
|
+
- `prerequisites`
|
|
29
|
+
- `getting-started`
|
|
30
|
+
- `guides`
|
|
31
|
+
- `tutorials`
|
|
32
|
+
- `resources`
|
|
33
|
+
1. Under `resources`, create child pages and collections in this order:
|
|
34
|
+
- `runtime-environment`
|
|
35
|
+
- `glossary`
|
|
36
|
+
- `reference`
|
|
37
|
+
- `reference/rest-api`
|
|
38
|
+
|
|
39
|
+
## 1) Publish order (recommended)
|
|
40
|
+
|
|
41
|
+
Ship in waves for navigability and lower risk.
|
|
42
|
+
|
|
43
|
+
### Wave A: Required baseline
|
|
44
|
+
|
|
45
|
+
- `introduction-to-gl-runner.md` -> `gl-runner/introduction-to-gl-runner`
|
|
46
|
+
- `prerequisites.md` -> `gl-runner/prerequisites`
|
|
47
|
+
- `getting-started/README.md` -> `gl-runner/getting-started/README`
|
|
48
|
+
|
|
49
|
+
### Wave B: Guides
|
|
50
|
+
|
|
51
|
+
- `guides/README.md` -> `gl-runner/guides/README`
|
|
52
|
+
- `guides/bundle-format.md` -> `gl-runner/guides/bundle-format`
|
|
53
|
+
- `guides/building-runnables.md` -> `gl-runner/guides/building-runnables`
|
|
54
|
+
- `guides/deploy-runnables.md` -> `gl-runner/guides/deploy-runnables`
|
|
55
|
+
- `guides/run-and-wait.md` -> `gl-runner/guides/run-and-wait`
|
|
56
|
+
- `guides/streaming-and-history.md` -> `gl-runner/guides/streaming-and-history`
|
|
57
|
+
- `guides/update-runnables.md` -> `gl-runner/guides/update-runnables`
|
|
58
|
+
- `gl-runner-cookbook.md` -> `gl-runner/gl-runner-cookbook`
|
|
59
|
+
|
|
60
|
+
### Wave C: Tutorials
|
|
61
|
+
|
|
62
|
+
- `tutorials/README.md` -> `gl-runner/tutorials/README`
|
|
63
|
+
- `tutorials/hello-world.md` -> `gl-runner/tutorials/hello-world`
|
|
64
|
+
- `tutorials/math-sum.md` -> `gl-runner/tutorials/math-sum`
|
|
65
|
+
- `tutorials/simple-de.md` -> `gl-runner/tutorials/simple-de`
|
|
66
|
+
- `tutorials/custom-de.md` -> `gl-runner/tutorials/custom-de`
|
|
67
|
+
- `tutorials/stateful-runnables.md` -> `gl-runner/tutorials/stateful-runnables`
|
|
68
|
+
|
|
69
|
+
### Wave D: Resources
|
|
70
|
+
|
|
71
|
+
- `resources/README.md` -> `gl-runner/resources/README`
|
|
72
|
+
- `resources/runtime-environment.md` -> `gl-runner/resources/runtime-environment`
|
|
73
|
+
- `resources/glossary.md` -> `gl-runner/resources/glossary`
|
|
74
|
+
- `resources/reference/README.md` -> `gl-runner/resources/reference/README`
|
|
75
|
+
- `resources/reference/python-sdk.md` -> `gl-runner/resources/reference/python-sdk`
|
|
76
|
+
- `resources/reference/rest-api/README.md` -> `gl-runner/resources/reference/rest-api/README`
|
|
77
|
+
- `resources/reference/rest-api/runnables.md` -> `gl-runner/resources/reference/rest-api/runnables`
|
|
78
|
+
- `resources/reference/rest-api/runs.md` -> `gl-runner/resources/reference/rest-api/runs`
|
|
79
|
+
- `resources/reference/rest-api/schemas.md` -> `gl-runner/resources/reference/rest-api/schemas`
|
|
80
|
+
- (no rest-api/index.md — use rest-api/README as entry)
|
|
81
|
+
|
|
82
|
+
## 2) Policy guardrails during publishing
|
|
83
|
+
|
|
84
|
+
1. Default to Agent-first examples and workflows.
|
|
85
|
+
1. Keep `Client` examples only for legacy/advanced admin workflows.
|
|
86
|
+
1. Keep REST details in `resources/reference/rest-api/*`; avoid deep REST walkthroughs in guides.
|
|
87
|
+
1. Move long advanced examples to cookbook links when page readability degrades.
|
|
88
|
+
1. Keep internal links under `https://gdplabs.gitbook.io/sdk/gl-runner/...`.
|
|
89
|
+
1. Avoid GitBook block macros in source markdown (for example `{% stepper %}` / `{% step %}`), because manual copy-paste mode may render them as plain text. Use numbered headings/lists instead.
|
|
90
|
+
|
|
91
|
+
## 3) QA before each publish wave
|
|
92
|
+
|
|
93
|
+
- Exactly one in-content H1 in source markdown, as the first line, matching the page title in GitBook navigation.
|
|
94
|
+
- Internal links resolve to current target slugs.
|
|
95
|
+
- Code fences and GitBook hints render properly.
|
|
96
|
+
- Terminology is consistent (Agent-first, CLI in Guides, REST reference-only).
|
|
97
|
+
- Sidebar order matches this checklist.
|
|
98
|
+
|
|
99
|
+
## 4) Drift control
|
|
100
|
+
|
|
101
|
+
If a hotfix is made directly in GitBook UI, mirror it back into
|
|
102
|
+
`python/gl-runner-sdk/gitbook/` immediately.
|
|
103
|
+
|
|
104
|
+
## 5) Team sync process
|
|
105
|
+
|
|
106
|
+
Use the **`gitbook_sync`** skill (located at `.agents/skills/gitbook_sync/`):
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# 1. Dry-run to preview changes
|
|
110
|
+
python .agents/skills/gitbook_sync/scripts/sync_from_checklist.py
|
|
111
|
+
|
|
112
|
+
# 2. Apply sync (copies files to gl-sdk)
|
|
113
|
+
python .agents/skills/gitbook_sync/scripts/sync_from_checklist.py --apply
|
|
114
|
+
|
|
115
|
+
# 3. Commit and push in gl-sdk repo
|
|
116
|
+
cd /path/to/gl-sdk
|
|
117
|
+
git add gitbook/gl-runner gitbook/SUMMARY.md
|
|
118
|
+
git commit -m "docs: sync GL Runner pages"
|
|
119
|
+
git push origin docs/gitbook-sync
|
|
120
|
+
|
|
121
|
+
# 4. Wait 1-2 minutes, then verify live
|
|
122
|
+
# https://gdplabs.gitbook.io/sdk/gl-runner/overview
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Note:** This checklist is the source of truth for page mappings. The skill
|
|
126
|
+
reads it automatically to determine which files to sync.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""Hello World — deploy and run the hello-world bundle.
|
|
2
|
+
|
|
3
|
+
Authors:
|
|
4
|
+
Immanuel Rhesa (immanuel.rhesa@gdplabs.id)
|
|
5
|
+
|
|
6
|
+
References:
|
|
7
|
+
NONE
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
|
|
12
|
+
from dotenv import load_dotenv
|
|
13
|
+
|
|
14
|
+
from gl_runner_sdk import Runnable
|
|
15
|
+
|
|
16
|
+
load_dotenv()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def main() -> None:
|
|
20
|
+
"""Deploy the hello-world bundle and run it with a sample payload."""
|
|
21
|
+
runnable = Runnable(
|
|
22
|
+
base_url=os.environ["GL_RUNNER_BASE_URL"],
|
|
23
|
+
api_key=os.environ["GL_RUNNER_API_KEY"],
|
|
24
|
+
key="hello-world",
|
|
25
|
+
bundle_path="./bundles/hello-world",
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
print("Deploying hello-world...")
|
|
29
|
+
deployment = runnable.deploy()
|
|
30
|
+
print(f"Deployed: {deployment.id}")
|
|
31
|
+
|
|
32
|
+
print("Running hello-world...")
|
|
33
|
+
result = runnable.run(payload={"name": "GL Runner"})
|
|
34
|
+
print(f"Result: {result}")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
if __name__ == "__main__":
|
|
38
|
+
main()
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""Math Sum — deploy and run the math-sum bundle.
|
|
2
|
+
|
|
3
|
+
Authors:
|
|
4
|
+
Immanuel Rhesa (immanuel.rhesa@gdplabs.id)
|
|
5
|
+
|
|
6
|
+
References:
|
|
7
|
+
NONE
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
|
|
12
|
+
from dotenv import load_dotenv
|
|
13
|
+
|
|
14
|
+
from gl_runner_sdk import Runnable
|
|
15
|
+
|
|
16
|
+
load_dotenv()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def main() -> None:
|
|
20
|
+
"""Deploy the math-sum bundle and run it with a list of numbers."""
|
|
21
|
+
runnable = Runnable(
|
|
22
|
+
base_url=os.environ["GL_RUNNER_BASE_URL"],
|
|
23
|
+
api_key=os.environ["GL_RUNNER_API_KEY"],
|
|
24
|
+
key="math-sum",
|
|
25
|
+
bundle_path="./bundles/math-sum",
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
print("Deploying math-sum...")
|
|
29
|
+
deployment = runnable.deploy()
|
|
30
|
+
print(f"Deployed: {deployment.id}")
|
|
31
|
+
|
|
32
|
+
print("Running math-sum with [1, 2, 3, 4, 5]...")
|
|
33
|
+
result = runnable.run(payload={"numbers": [1, 2, 3, 4, 5]})
|
|
34
|
+
print(f"Result: {result}")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
if __name__ == "__main__":
|
|
38
|
+
main()
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""Simple Digital Employee — deploy and run the simple-de bundle.
|
|
2
|
+
|
|
3
|
+
Authors:
|
|
4
|
+
Immanuel Rhesa (immanuel.rhesa@gdplabs.id)
|
|
5
|
+
|
|
6
|
+
References:
|
|
7
|
+
NONE
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
|
|
12
|
+
from dotenv import load_dotenv
|
|
13
|
+
|
|
14
|
+
from gl_runner_sdk import Runnable
|
|
15
|
+
|
|
16
|
+
load_dotenv()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def main() -> None:
|
|
20
|
+
"""Deploy the simple-de bundle and invoke the Digital Employee with a message.
|
|
21
|
+
|
|
22
|
+
The bundle's .env is included in the deployment so the Digital Employee
|
|
23
|
+
can access the Google Mail MCP credentials at runtime.
|
|
24
|
+
"""
|
|
25
|
+
runnable = Runnable(
|
|
26
|
+
base_url=os.environ["GL_RUNNER_BASE_URL"],
|
|
27
|
+
api_key=os.environ["GL_RUNNER_API_KEY"],
|
|
28
|
+
key="simple-de",
|
|
29
|
+
bundle_path="./bundles/simple-de",
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
print("Deploying simple-de...")
|
|
33
|
+
deployment = runnable.deploy(include_sensitive_files=[".env"])
|
|
34
|
+
print(f"Deployed: {deployment.id}")
|
|
35
|
+
|
|
36
|
+
print("Running simple-de...")
|
|
37
|
+
result = runnable.run(
|
|
38
|
+
payload={"message": "Send a welcome email to the new team member."}
|
|
39
|
+
)
|
|
40
|
+
print(f"Result: {result}")
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
if __name__ == "__main__":
|
|
44
|
+
main()
|