Skip to content

Commit 19e4cb5

Browse files
francoluxorclaude
andcommitted
Migrate to the tenki SDK 0.5.1 and drop project ID support
The Python SDK now publishes as `tenki` (LuxorLabs/tenki.cloud#477); the `tenki_sandbox` namespace remains as a legacy alias but new code should use the canonical one. Pin `tenki[async]>=0.5.1` and import `from tenki import ...` in the core, the frontmatter `requirements:` of both distributables, and the live integration tests. Project scoping was removed from the API: `AsyncClient.create()` in 0.5.1 no longer accepts `project_id`, so passing it raises TypeError. Drop the `tenki_project_id` valve, the create-call argument, and the `TENKI_PROJECT_ID` env plumbing in `scripts/try_live.py` and the live tests. `workspace_id` is unchanged and still the way to scope a sandbox. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent c07ebaf commit 19e4cb5

14 files changed

Lines changed: 19 additions & 42 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ if they drift (`git diff --exit-code open-webui/`).
2525
```bash
2626
export TENKI_API_KEY=sk-...
2727
# optional: export TENKI_API_ENDPOINT=https://api.tenki.cloud
28-
# optional: export TENKI_PROJECT_ID=proj_...
2928
pytest tests/integration # provisions real microVMs; costs quota
3029
python scripts/try_live.py # ad-hoc single run; images saved to ./live_out/
3130
```
@@ -76,7 +75,7 @@ publishing.
7675
trust. (Ours: secrets only in Valves, never logged; fully `async` handlers;
7776
documented security posture — all in line with Open WebUI's sharing guidance.)
7877
- **`requirements:` installs at load time.** Open WebUI pip-installs
79-
`tenki-sandbox[async]` on import. This requires that version to be published on
78+
`tenki[async]` on import. This requires that version to be published on
8079
PyPI. Note for operators: in multi-replica deployments, runtime installs can
8180
race across workers — they can set
8281
`ENABLE_PIP_INSTALL_FRONTMATTER_REQUIREMENTS=False` and bake the dependency into

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ between runs**, is **non-blocking** (async), enforces a **timeout**, and is
4545
`open-webui/tools/tenki_code_execution.py`.
4646
- **Action** (optional) — Admin Panel → Functions → import _Tenki Run Code_,
4747
or paste the contents of `open-webui/functions/tenki_run_code.py`.
48-
- Open WebUI installs the declared `tenki-sandbox[async]` dependency
48+
- Open WebUI installs the declared `tenki[async]` dependency
4949
automatically on import — no manual `pip install`, no server restart.
5050
_(Multi-replica deployments may prefer to bake the dependency into their
5151
image and set `ENABLE_PIP_INSTALL_FRONTMATTER_REQUIREMENTS=False` to avoid
@@ -74,7 +74,6 @@ between runs**, is **non-blocking** (async), enforces a **timeout**, and is
7474
| `tenki_api_key` | _(empty)_ | **Required** (unless every user sets their own). Instance-wide Tenki key. |
7575
| `tenki_api_endpoint` | `https://api.tenki.cloud` | Override for self-hosted / staging. |
7676
| `tenki_workspace_id` | _(empty)_ | Optional workspace scope; uses the account default when empty. |
77-
| `tenki_project_id` | _(empty)_ | Optional project scope; uses the account default when empty. |
7877
| `default_language` | `python` | `python` or `shell`, used when the caller doesn't specify. |
7978
| `cpu_cores` / `memory_mb` / `disk_size_gb` | `1` / `512` / `5` | Sandbox resource size (disk 5–100 GiB). |
8079
| `timeout_seconds` | `300` | Max execution time per run (1–600). |
@@ -101,7 +100,7 @@ crashes or silently does nothing.
101100
Everything your code runs against — the Python version, the shell, and the
102101
available libraries — comes from the **Tenki sandbox image**, not from this
103102
plugin. The `requirements:` frontmatter only installs the plugin's own dependency
104-
(`tenki-sandbox[async]`) on the Open WebUI host; it does **not** add packages to
103+
(`tenki[async]`) on the Open WebUI host; it does **not** add packages to
105104
the sandbox.
106105

107106
The default image ships a common set of libraries. To use a different set, point

TESTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ green without secrets.
3434
export TENKI_API_KEY=sk-...
3535
# optional, for a self-hosted or non-default deployment:
3636
# export TENKI_API_ENDPOINT=https://api.tenki.cloud
37-
# export TENKI_PROJECT_ID=proj_...
3837

3938
pytest tests/integration -v # full gated suite
4039
python scripts/try_live.py # ad-hoc single run; images saved to ./live_out/
@@ -84,7 +83,7 @@ docker run -d -p 3000:8080 \
8483

8584
Open <http://localhost:3000> and create the first (admin) account.
8685

87-
> Open WebUI installs the plugin's declared `tenki-sandbox[async]` dependency
86+
> Open WebUI installs the plugin's declared `tenki[async]` dependency
8887
> automatically on import (from the `requirements:` frontmatter) — no manual
8988
> install, no restart.
9089

open-webui/functions/tenki_run_code.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
description: A "Run code" button that executes a message's Python or shell code block in an isolated, ephemeral Tenki microVM sandbox — a secure code interpreter / code execution sandbox for Open WebUI.
77
version: 0.1.0
88
license: MIT
9-
requirements: tenki-sandbox[async]>=0.3.5
9+
requirements: tenki[async]>=0.5.1
1010
"""
1111

1212
# ---------------------------------------------------------------------------
@@ -19,7 +19,7 @@
1919
from dataclasses import dataclass, field
2020
from os.path import splitext
2121
from pydantic import BaseModel, Field, field_validator
22-
from tenki_sandbox import AsyncSandbox
22+
from tenki import AsyncSandbox
2323
from typing import Literal
2424
import asyncio
2525
import base64
@@ -71,10 +71,6 @@ class Valves(BaseModel):
7171
default="",
7272
description="Optional Tenki workspace ID. Uses the account default when empty.",
7373
)
74-
tenki_project_id: str = Field(
75-
default="",
76-
description="Optional Tenki project ID. Uses the account default when empty.",
77-
)
7874
default_language: Literal["python", "shell"] = Field(
7975
default="python",
8076
description="Language used when the caller does not specify one.",
@@ -414,7 +410,6 @@ async def _provision_and_run(request: CodeExecutionRequest) -> ExecutionResult:
414410
auth_token=request.api_key,
415411
base_url=valves.tenki_api_endpoint, # data goes only to the configured endpoint
416412
workspace_id=valves.tenki_workspace_id or None,
417-
project_id=valves.tenki_project_id or None,
418413
cpu_cores=valves.cpu_cores,
419414
memory_mb=valves.memory_mb,
420415
disk_size_gb=valves.disk_size_gb,

open-webui/tools/tenki_code_execution.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
description: Run Python and shell code in isolated, ephemeral Tenki microVM sandboxes. A secure code interpreter / code execution sandbox for Open WebUI (isolated, ephemeral, microVM).
77
version: 0.1.0
88
license: MIT
9-
requirements: tenki-sandbox[async]>=0.3.5
9+
requirements: tenki[async]>=0.5.1
1010
"""
1111

1212
# ---------------------------------------------------------------------------
@@ -19,7 +19,7 @@
1919
from dataclasses import dataclass, field
2020
from os.path import splitext
2121
from pydantic import BaseModel, Field, field_validator
22-
from tenki_sandbox import AsyncSandbox
22+
from tenki import AsyncSandbox
2323
from typing import Literal
2424
import asyncio
2525
import base64
@@ -70,10 +70,6 @@ class Valves(BaseModel):
7070
default="",
7171
description="Optional Tenki workspace ID. Uses the account default when empty.",
7272
)
73-
tenki_project_id: str = Field(
74-
default="",
75-
description="Optional Tenki project ID. Uses the account default when empty.",
76-
)
7773
default_language: Literal["python", "shell"] = Field(
7874
default="python",
7975
description="Language used when the caller does not specify one.",
@@ -413,7 +409,6 @@ async def _provision_and_run(request: CodeExecutionRequest) -> ExecutionResult:
413409
auth_token=request.api_key,
414410
base_url=valves.tenki_api_endpoint, # data goes only to the configured endpoint
415411
workspace_id=valves.tenki_workspace_id or None,
416-
project_id=valves.tenki_project_id or None,
417412
cpu_cores=valves.cpu_cores,
418413
memory_mb=valves.memory_mb,
419414
disk_size_gb=valves.disk_size_gb,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ keywords = [
2020
"tenki",
2121
]
2222
dependencies = [
23-
"tenki-sandbox[async]>=0.3.5",
23+
"tenki[async]>=0.5.1",
2424
"pydantic>=2",
2525
]
2626

scripts/build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
description: Run Python and shell code in isolated, ephemeral Tenki microVM sandboxes. A secure code interpreter / code execution sandbox for Open WebUI (isolated, ephemeral, microVM).
3030
version: 0.1.0
3131
license: MIT
32-
requirements: tenki-sandbox[async]>=0.3.5
32+
requirements: tenki[async]>=0.5.1
3333
"""'''
3434

3535
ACTION_FRONTMATTER = '''\
@@ -41,7 +41,7 @@
4141
description: A "Run code" button that executes a message's Python or shell code block in an isolated, ephemeral Tenki microVM sandbox — a secure code interpreter / code execution sandbox for Open WebUI.
4242
version: 0.1.0
4343
license: MIT
44-
requirements: tenki-sandbox[async]>=0.3.5
44+
requirements: tenki[async]>=0.5.1
4545
"""'''
4646

4747
# (entry_module, frontmatter, output_path)

scripts/try_live.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
Usage:
88
export TENKI_API_KEY=sk-...
99
# optional: export TENKI_API_ENDPOINT=https://api.tenki.cloud
10-
# optional: export TENKI_PROJECT_ID=proj_...
1110
1211
python scripts/try_live.py # default demo snippet
1312
python scripts/try_live.py -l shell -c 'uname -a'
@@ -61,7 +60,6 @@ async def main() -> int:
6160
valves = Valves(
6261
tenki_api_key=key,
6362
tenki_api_endpoint=os.getenv("TENKI_API_ENDPOINT", "https://api.tenki.cloud"),
64-
tenki_project_id=os.getenv("TENKI_PROJECT_ID", ""),
6563
timeout_seconds=args.timeout,
6664
network_egress=args.egress,
6765
)

src/open_webui_tenki/config.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ class Valves(BaseModel):
2626
default="",
2727
description="Optional Tenki workspace ID. Uses the account default when empty.",
2828
)
29-
tenki_project_id: str = Field(
30-
default="",
31-
description="Optional Tenki project ID. Uses the account default when empty.",
32-
)
3329
default_language: Literal["python", "shell"] = Field(
3430
default="python",
3531
description="Language used when the caller does not specify one.",

src/open_webui_tenki/core.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from dataclasses import dataclass
1414
from os.path import splitext
1515

16-
from tenki_sandbox import AsyncSandbox
16+
from tenki import AsyncSandbox
1717

1818
from .config import Valves
1919
from .constants import (
@@ -131,7 +131,6 @@ async def _provision_and_run(request: CodeExecutionRequest) -> ExecutionResult:
131131
auth_token=request.api_key,
132132
base_url=valves.tenki_api_endpoint, # data goes only to the configured endpoint
133133
workspace_id=valves.tenki_workspace_id or None,
134-
project_id=valves.tenki_project_id or None,
135134
cpu_cores=valves.cpu_cores,
136135
memory_mb=valves.memory_mb,
137136
disk_size_gb=valves.disk_size_gb,

0 commit comments

Comments
 (0)