mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-29 20:19:24 +08:00
feat: add Tenki sandbox provider (#17305)
### Summary Adds a `tenki` sandbox provider that runs each agent code execution in a disposable Tenki (https://tenki.cloud) microVM (create → exec → destroy, no volumes or snapshots). Registration mirrors PR #15039, configure `api_key` and `project_id` in Admin > Sandbox Settings. Both runtimes are covered: - Python: `agent/sandbox/providers/tenki.py` (structured results + artifact collection). - Go: `internal/agent/sandbox/tenki.go`, mirroring the e2b provider and wired into the provider manager. `tenki-sandbox` is an optional dependency (it requires `protobuf>=6.31`, which differs from RAGFlow's pinned gRPC stack), lazily imported with a clear error when missing; installation is documented in the sandbox quickstart. Unit tests cover execution, structured results, artifacts (symlink/size/extension limits), non-zero exit, timeout, error mapping, and idempotent destroy. --------- Co-authored-by: yiming.wang <yiming.wang@luxor.com>
This commit is contained in:
@@ -24,7 +24,7 @@ Configure sandbox providers from the admin page:
|
||||
- `self_managed`: Uses the executor manager service.
|
||||
- `local`: Runs code on the current machine.
|
||||
- `ssh`: Runs code on a remote machine over SSH.
|
||||
- `aliyun_codeinterpreter` and `e2b`: Cloud providers.
|
||||
- `aliyun_codeinterpreter`, `e2b`, and `tenki`: Cloud providers.
|
||||
|
||||
<img width="2547" height="1475" alt="admin-sandbox-settings" src="https://github.com/user-attachments/assets/59ab948e-b98a-45a8-9db4-f1afbf6c3685" />
|
||||
|
||||
@@ -38,6 +38,32 @@ Admin > Sandbox Settings after the services are up.
|
||||
- `local`: Runs code as local Python or Node.js subprocesses. Use this only in trusted development environments.
|
||||
- `ssh`: Runs code on a remote machine over SSH.
|
||||
- `aliyun_codeinterpreter` and `e2b`: Cloud-hosted providers that remain available in the admin provider list.
|
||||
- `tenki`: Cloud-hosted provider that runs each execution in a disposable [Tenki](https://tenki.cloud) microVM. See [Tenki](#tenki) below.
|
||||
|
||||
### Tenki
|
||||
|
||||
`tenki` runs each code execution in a fresh Tenki microVM and destroys it afterwards. It is cloud-hosted, so it needs no local sandbox services, gVisor, or Docker base images — only outbound network access and an API key.
|
||||
|
||||
The `tenki-sandbox` SDK is an optional dependency (it requires `protobuf>=6.31`, which differs from RAGFlow's default gRPC stack), so it is not installed by default. Install it into the RAGFlow runtime before selecting this provider:
|
||||
|
||||
```bash
|
||||
pip install tenki-sandbox
|
||||
```
|
||||
|
||||
Configure it in **Admin > Sandbox Settings**:
|
||||
|
||||
- `api_key` (required): Tenki API key. Create one at [app.tenki.cloud](https://app.tenki.cloud) under **API Keys**.
|
||||
- `project_id` (required): the Tenki project that sandboxes are created under.
|
||||
- `base_url` (optional): override the Tenki API endpoint.
|
||||
- `image` (optional): sandbox base image. Leave empty to use the Tenki default image, which includes `python3` and `node`.
|
||||
- `allow_outbound` (optional, security-relevant): whether the sandbox may make outbound network connections. Defaults to `false` so sandboxed code has no network access; set it to `true` when code needs the network (for example, to install packages).
|
||||
- `timeout`, `max_lifetime`, `cpu_cores`, `memory_mb`, `disk_size_gb`, and the output/artifact limits have sensible defaults and can be tuned in the same page.
|
||||
|
||||
Notes:
|
||||
|
||||
- Supported languages are Python and JavaScript.
|
||||
- Files written to the `artifacts/` directory of the working directory are returned as run artifacts.
|
||||
- The provider uses only Tenki's create/exec/destroy operations; it does not use volumes or snapshots.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
|
||||
Reference in New Issue
Block a user