Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

refactor(sandbox): remove obsolete configuration (#20809)

Sbaaoui Idriss2d1385eba598
diff --git a/conf/system_settings.json b/conf/system_settings.json
index e2700a1c16..27bfc89e67 100644
--- a/conf/system_settings.json
+++ b/conf/system_settings.json
@@ -70,7 +70,7 @@
"name": "sandbox.self_managed",
"source": "variable",
"data_type": "json",
- "value": "{\"endpoint\": \"http://sandbox-executor-manager:9385\", \"timeout\": 30, \"max_retries\": 3}"
+ "value": "{\"endpoint\": \"http://sandbox-executor-manager:9385\", \"timeout\": 30}"
},
{
"name": "sandbox.aliyun_codeinterpreter",
diff --git a/internal/agent/sandbox/catalog.go b/internal/agent/sandbox/catalog.go
index 236a183d77..661777bace 100644
--- a/internal/agent/sandbox/catalog.go
+++ b/internal/agent/sandbox/catalog.go
@@ -4,7 +4,6 @@ import (
"fmt"
"os"
"slices"
- "strconv"
"strings"
)
@@ -91,20 +90,10 @@ func ValidateConfig(provider string, config map[string]any) error {
if endpoint, _ := config["endpoint"].(string); endpoint != "" && !strings.HasPrefix(endpoint, "http://") && !strings.HasPrefix(endpoint, "https://") {
return invalid("invalid endpoint format: %s", endpoint)
}
- poolValue, present := config["executor_manager_pool_size"]
- if !present {
- poolValue = config["pool_size"]
- }
- if pool, ok := integerValue(poolValue); ok && pool <= 0 {
- return invalid("pool size must be greater than 0")
- }
timeout := integerOr(config["timeout"], 30)
if timeout < 1 || timeout > 600 {
return invalid("timeout must be between 1 and 600 seconds")
}
- if retries, ok := integerValue(config["max_retries"]); ok && (retries < 0 || retries > 10) {
- return invalid("max retries must be between 0 and 10")
- }
case "ssh":
if strings.TrimSpace(stringValue(config["host"])) == "" {
return invalid("SSH host is required")
@@ -252,25 +241,10 @@ func env(key, fallback string) string {
return fallback
}
-func envInt(key string, fallback int64) int64 {
- value, err := strconv.ParseInt(env(key, strconv.FormatInt(fallback, 10)), 10, 64)
- if err != nil {
- return fallback
- }
- return value
-}
-
func selfManagedSchema() map[string]any {
s := staticSchema("self_managed")
- s["executor_manager_image"].(map[string]any)["default"] = env("SANDBOX_EXECUTOR_MANAGER_IMAGE", "infiniflow/sandbox-executor-manager:latest")
- s["executor_manager_pool_size"].(map[string]any)["default"] = envInt("SANDBOX_EXECUTOR_MANAGER_POOL_SIZE", 3)
s["base_python_image"].(map[string]any)["default"] = env("SANDBOX_BASE_PYTHON_IMAGE", "infiniflow/sandbox-base-python:latest")
s["base_nodejs_image"].(map[string]any)["default"] = env("SANDBOX_BASE_NODEJS_IMAGE", "infiniflow/sandbox-base-nodejs:latest")
- s["executor_manager_port"].(map[string]any)["default"] = envInt("SANDBOX_EXECUTOR_MANAGER_PORT", 9385)
- s["enable_seccomp"].(map[string]any)["default"] = strings.EqualFold(env("SANDBOX_ENABLE_SECCOMP", "false"), "true")
- s["max_memory"].(map[string]any)["default"] = env("SANDBOX_MAX_MEMORY", "256m")
- s["container_network"].(map[string]any)["default"] = env("SANDBOX_CONTAINER_NETWORK", "none")
- s["sandbox_timeout"].(map[string]any)["default"] = env("SANDBOX_TIMEOUT", "10s")
return cloneMap(s)
}
@@ -289,18 +263,11 @@ func staticSchema(provider string) map[string]any {
}
case "self_managed":
return map[string]any{
- "endpoint": fieldWith("string", true, "Executor Manager Endpoint", "placeholder", "http://sandbox-executor-manager:9385", "default", "http://sandbox-executor-manager:9385", "description", "HTTP endpoint used by RAGFlow to call sandbox-executor-manager.", "scope", "runtime", "readonly", false),
- "api_token": fieldWith("string", false, "Executor Manager API Token", "secret", true, "placeholder", "Optional; defaults to SANDBOX_EXECUTOR_MANAGER_API_TOKEN", "default", "", "description", "Shared secret authenticating RAGFlow to sandbox-executor-manager. Must match SANDBOX_EXECUTOR_MANAGER_API_TOKEN on the executor-manager side.", "scope", "runtime", "readonly", false),
- "timeout": limitsScoped("integer", false, "Request Timeout (seconds)", 30, 5, 300, "Maximum request time for a single code execution call. Unit: seconds.", "runtime", false),
- "executor_manager_image": fieldWith("string", false, "Executor Manager Image", "default", "infiniflow/sandbox-executor-manager:latest", "description", "Docker image used by sandbox-executor-manager.", "scope", "deployment", "readonly", true),
- "executor_manager_pool_size": limitsScoped("integer", false, "Container Pool Size", int64(3), 1, 100, "Container pool size used by sandbox-executor-manager.", "deployment", true),
- "base_python_image": fieldWith("string", false, "Base Python Image", "default", "infiniflow/sandbox-base-python:latest", "description", "Python runtime image used by executor-managed containers.", "scope", "deployment", "readonly", true),
- "base_nodejs_image": fieldWith("string", false, "Base Node.js Image", "default", "infiniflow/sandbox-base-nodejs:latest", "description", "Node.js runtime image used by executor-managed containers.", "scope", "deployment", "readonly", true),
- "executor_manager_port": limitsScoped("integer", false, "Executor Manager Port", int64(9385), 1, 65535, "Host port exposed by sandbox-executor-manager.", "deployment", true),
- "enable_seccomp": fieldWith("boolean", false, "Enable Seccomp", "default", false, "description", "Whether sandbox-executor-manager starts containers with seccomp enabled.", "scope", "deployment", "readonly", true),
- "max_memory": fieldWith("string", false, "Max Memory", "default", "256m", "description", "Memory limit applied to each sandbox container. Common format: 256m or 1g.", "scope", "deployment", "readonly", true),
- "container_network": fieldWith("string", false, "Container Network", "default", "none", "description", "Docker network attached to sandbox containers. Defaults to 'none' (no external network access); set to 'bridge' only if sandboxed code needs outbound network.", "scope", "deployment", "readonly", true),
- "sandbox_timeout": fieldWith("string", false, "Sandbox Timeout", "default", "10s", "description", "Executor-manager container timeout for each sandbox run. Common format: 10s or 1m.", "scope", "deployment", "readonly", true),
+ "endpoint": fieldWith("string", true, "Executor Manager Endpoint", "placeholder", "http://sandbox-executor-manager:9385", "default", "http://sandbox-executor-manager:9385", "description", "HTTP endpoint used by RAGFlow to call sandbox-executor-manager.", "scope", "runtime", "readonly", false),
+ "api_token": fieldWith("string", false, "Executor Manager API Token", "secret", true, "placeholder", "Optional; defaults to SANDBOX_EXECUTOR_MANAGER_API_TOKEN", "default", "", "description", "Shared secret authenticating RAGFlow to sandbox-executor-manager. Must match SANDBOX_EXECUTOR_MANAGER_API_TOKEN on the executor-manager side.", "scope", "runtime", "readonly", false),
+ "timeout": limitsScoped("integer", false, "Request Timeout (seconds)", 30, 5, 300, "Maximum request time for a single code execution call. Unit: seconds.", "runtime", false),
+ "base_python_image": fieldWith("string", false, "Base Python Image", "default", "infiniflow/sandbox-base-python:latest", "description", "Python runtime image used by executor-managed containers.", "scope", "deployment", "readonly", true),
+ "base_nodejs_image": fieldWith("string", false, "Base Node.js Image", "default", "infiniflow/sandbox-base-nodejs:latest", "description", "Node.js runtime image used by executor-managed containers.", "scope", "deployment", "readonly", true),
}
case "ssh":
return sshSchema()
diff --git a/internal/agent/sandbox/catalog_test.go b/internal/agent/sandbox/catalog_test.go
index fb75ba4632..03d1f11d50 100644
--- a/internal/agent/sandbox/catalog_test.go
+++ b/internal/agent/sandbox/catalog_test.go
@@ -107,7 +107,7 @@ func TestCatalogValidationBoundaries(t *testing.T) {
}
func TestCatalogDynamicDeploymentDefaults(t *testing.T) {
- for env, field := range map[string]string{"SANDBOX_EXECUTOR_MANAGER_IMAGE": "executor_manager_image", "SANDBOX_BASE_PYTHON_IMAGE": "base_python_image", "SANDBOX_BASE_NODEJS_IMAGE": "base_nodejs_image", "SANDBOX_MAX_MEMORY": "max_memory", "SANDBOX_CONTAINER_NETWORK": "container_network", "SANDBOX_TIMEOUT": "sandbox_timeout"} {
+ for env, field := range map[string]string{"SANDBOX_BASE_PYTHON_IMAGE": "base_python_image", "SANDBOX_BASE_NODEJS_IMAGE": "base_nodejs_image"} {
t.Setenv(env, "custom")
schema, err := ConfigSchema("self_managed")
if err != nil {
@@ -125,18 +125,10 @@ func TestCatalogDynamicDeploymentDefaults(t *testing.T) {
t.Errorf("%s empty env lost", field)
}
}
- t.Setenv("SANDBOX_ENABLE_SECCOMP", "TRUE")
- t.Setenv("SANDBOX_EXECUTOR_MANAGER_POOL_SIZE", "9")
- t.Setenv("SANDBOX_EXECUTOR_MANAGER_PORT", "9999")
schema, err := ConfigSchema("self_managed")
if err != nil {
t.Fatal(err)
}
- for field, want := range map[string]any{"enable_seccomp": true, "executor_manager_pool_size": int64(9), "executor_manager_port": int64(9999)} {
- if got := schema[field].(map[string]any)["default"]; got != want {
- t.Errorf("%s=%v want %v", field, got, want)
- }
- }
providers := ListProviders()
providers[0]["tags"].([]any)[0] = "changed"
if fmt.Sprint(ListProviders()[0]["tags"]) == fmt.Sprint(providers[0]["tags"]) {
@@ -180,13 +172,19 @@ func TestValidateConfigTypesRangesAndProviderRules(t *testing.T) {
}
}
-func TestSelfManagedPoolValidationUsesSelectedField(t *testing.T) {
- cfg := map[string]any{"endpoint": "http://localhost", "executor_manager_pool_size": 3, "pool_size": -1}
- if err := ValidateConfig("self_managed", cfg); err != nil {
+func TestSelfManagedRetiredSettingsAreTolerated(t *testing.T) {
+ schema, err := ConfigSchema("self_managed")
+ if err != nil {
t.Fatal(err)
}
- delete(cfg, "executor_manager_pool_size")
- if err := ValidateConfig("self_managed", cfg); err == nil {
- t.Fatal("invalid fallback pool accepted")
+ cfg := map[string]any{"endpoint": "http://localhost", "timeout": 30, "api_token": "secret"}
+ for _, key := range []string{"executor_manager_image", "executor_manager_pool_size", "executor_manager_port", "enable_seccomp", "max_memory", "container_network", "sandbox_timeout", "pool_size", "max_retries"} {
+ if _, exists := schema[key]; exists {
+ t.Errorf("retired field %q remains exposed", key)
+ }
+ cfg[key] = "retired value"
+ }
+ if err := ValidateConfig("self_managed", cfg); err != nil {
+ t.Fatal(err)
}
}
diff --git a/internal/agent/sandbox/manager_test.go b/internal/agent/sandbox/manager_test.go
index a483b22cd5..7aa2f3d223 100644
--- a/internal/agent/sandbox/manager_test.go
+++ b/internal/agent/sandbox/manager_test.go
@@ -180,7 +180,7 @@ func TestSelfManaged_EndToEnd_FullLoop(t *testing.T) {
// TestNewSelfManagedProviderFromConfig_MinimalConfig pins the
// settings-driven init path: a minimal JSON config yields the
-// expected defaults (default endpoint, 30s timeout, pool size 3,
+// expected defaults (default endpoint, 30s timeout,
// no per-language base image override).
func TestNewSelfManagedProviderFromConfig_MinimalConfig(t *testing.T) {
t.Parallel()
@@ -191,9 +191,6 @@ func TestNewSelfManagedProviderFromConfig_MinimalConfig(t *testing.T) {
if p.timeout != 30*time.Second {
t.Errorf("timeout = %v, want 30s", p.timeout)
}
- if p.poolSize != 3 {
- t.Errorf("poolSize = %d, want 3", p.poolSize)
- }
if p.baseImages["python"] != "" || p.baseImages["nodejs"] != "" {
t.Errorf("baseImages should be empty, got %+v", p.baseImages)
}
@@ -201,7 +198,7 @@ func TestNewSelfManagedProviderFromConfig_MinimalConfig(t *testing.T) {
// TestNewSelfManagedProviderFromConfig_FullConfig verifies that
// every config key propagates: a custom endpoint, a custom timeout
-// in seconds-as-float, a non-default pool size, and per-language
+// in seconds-as-float and per-language
// base images.
func TestNewSelfManagedProviderFromConfig_FullConfig(t *testing.T) {
t.Parallel()
@@ -219,9 +216,6 @@ func TestNewSelfManagedProviderFromConfig_FullConfig(t *testing.T) {
if p.timeout != 45*time.Second {
t.Errorf("timeout = %v, want 45s", p.timeout)
}
- if p.poolSize != 10 {
- t.Errorf("poolSize = %d, want 10", p.poolSize)
- }
if p.baseImages["python"] != "registry.example.com/py:latest" {
t.Errorf("python baseImage = %q", p.baseImages["python"])
}
@@ -628,9 +622,6 @@ func TestLoadFromSettingsWithReader_HappyPath(t *testing.T) {
if sm.timeout != 5*time.Second {
t.Errorf("timeout = %v, want 5s (from settings)", sm.timeout)
}
- if sm.poolSize != 7 {
- t.Errorf("poolSize = %d, want 7 (from settings)", sm.poolSize)
- }
if sm.baseImages["python"] != "reg.example.com/py:1" {
t.Errorf("python baseImage = %q (from settings)", sm.baseImages["python"])
}
diff --git a/internal/agent/sandbox/self_managed.go b/internal/agent/sandbox/self_managed.go
index 8567cd8dbd..77df728481 100644
--- a/internal/agent/sandbox/self_managed.go
+++ b/internal/agent/sandbox/self_managed.go
@@ -62,7 +62,6 @@ import (
"fmt"
"io"
"net/http"
- "strconv"
"strings"
"sync"
"time"
@@ -83,8 +82,6 @@ const selfManagedDefaultEndpoint = "http://sandbox-executor-manager:9385"
type SelfManagedProvider struct {
endpoint string
timeout time.Duration
- poolSize int
- maxRetries int
helper *HTTPClient
healthHelper *HTTPClient
mu sync.Mutex
@@ -120,15 +117,7 @@ func newSelfManagedProviderFromEnv() *SelfManagedProvider {
return newSelfManagedProviderFromConfig(map[string]any{})
}
-// The provider resolves each field through one canonical chain: the
-// lowercase admin-panel settings schema first (endpoint, timeout,
-// max_retries, pool_size, api_token — the exact schema
-// agent/sandbox/providers/self_managed.py persists and reads; pool_size
-// additionally accepts its executor_manager_pool_size spelling, which the
-// Python provider reads first), then the SANDBOX_* environment variable for
-// fields absent from persisted settings, then the built-in default. Keeping
-// a single resolution path on both runtimes means a settings row plus
-// environment variables configures Python and Go identically.
+// Settings take precedence over environment variables and built-in defaults.
func configStringEnv(cfg map[string]any, envName string, keys ...string) string {
for _, key := range keys {
// Blank-after-trim values count as absent so they fall through to
@@ -141,20 +130,6 @@ func configStringEnv(cfg map[string]any, envName string, keys ...string) string
return common.GetEnv(envName)
}
-func configIntEnv(cfg map[string]any, fallback int, envName string, keys ...string) int {
- for _, key := range keys {
- if _, ok := cfg[key]; ok && cfg[key] != nil {
- return configInt(cfg, key, fallback)
- }
- }
- if envValue := common.GetEnv(envName); envValue != "" {
- if parsed, err := strconv.Atoi(envValue); err == nil {
- return parsed
- }
- }
- return fallback
-}
-
func configDurationEnv(cfg map[string]any, fallback time.Duration, envName string, keys ...string) time.Duration {
for _, key := range keys {
if _, ok := cfg[key]; ok && cfg[key] != nil {
@@ -169,13 +144,7 @@ func configDurationEnv(cfg map[string]any, fallback time.Duration, envName strin
return fallback
}
-// newSelfManagedProviderFromConfig builds the provider from the persisted
-// settings JSON (the `sandbox.self_managed` row written by the admin panel,
-// lowercase keys: endpoint, timeout, max_retries, pool_size, api_token,
-// optionally base_python_image / base_nodejs_image). Fields absent from the
-// settings fall back to their SANDBOX_* environment variable before the
-// built-in default, mirroring the Python provider's config-over-env
-// resolution.
+// newSelfManagedProviderFromConfig resolves connection settings and image overrides.
func newSelfManagedProviderFromConfig(cfg map[string]any) *SelfManagedProvider {
endpoint := configStringEnv(cfg, common.EnvSandboxExecutorManagerURL, "endpoint")
if endpoint == "" {
@@ -184,10 +153,6 @@ func newSelfManagedProviderFromConfig(cfg map[string]any) *SelfManagedProvider {
endpoint = strings.TrimRight(endpoint, "/")
timeout := configDurationEnv(cfg, 30*time.Second, common.EnvSandboxExecutorManagerTimeout, "timeout")
- poolSize := configIntEnv(cfg, 3, common.EnvSandboxExecutorManagerPoolSize, "executor_manager_pool_size", "pool_size")
- // max_retries maps to the HTTP client's total attempt count (first try
- // included), matching its default of 3 attempts.
- maxRetries := configIntEnv(cfg, 3, common.EnvSandboxExecutorManagerMaxRetries, "max_retries")
// Per-language base image overrides. Empty = executor_manager
// default; non-empty = the operator picked a custom base image
@@ -204,12 +169,11 @@ func newSelfManagedProviderFromConfig(cfg map[string]any) *SelfManagedProvider {
return &SelfManagedProvider{
endpoint: endpoint,
timeout: timeout,
- poolSize: poolSize,
baseImages: baseImages,
apiToken: apiToken,
helper: NewHTTPClient(HTTPConfig{
Timeout: timeout,
- MaxAttempts: maxRetries,
+ MaxAttempts: 1,
}),
healthHelper: NewHTTPClient(HTTPConfig{
Timeout: 5 * time.Second,
@@ -256,9 +220,8 @@ func (p *SelfManagedProvider) CreateInstance(ctx context.Context, template strin
Provider: ProviderSelfManaged,
Status: "running",
Metadata: map[string]any{
- "language": lang,
- "endpoint": p.endpoint,
- "pool_size": p.poolSize,
+ "language": lang,
+ "endpoint": p.endpoint,
},
}, nil
}
diff --git a/internal/agent/sandbox/self_managed_test.go b/internal/agent/sandbox/self_managed_test.go
index 404901ebf3..e53cda25df 100644
--- a/internal/agent/sandbox/self_managed_test.go
+++ b/internal/agent/sandbox/self_managed_test.go
@@ -34,7 +34,6 @@ func newSelfManagedForTest(endpoint string) *SelfManagedProvider {
return &SelfManagedProvider{
endpoint: endpoint,
timeout: 5 * time.Second,
- poolSize: 3,
helper: NewHTTPClient(HTTPConfig{}),
healthHelper: NewHTTPClient(HTTPConfig{Timeout: 2 * time.Second}),
}
@@ -553,12 +552,8 @@ func handleRunWithResult(t *testing.T, w http.ResponseWriter, _ *http.Request, s
_ = json.NewEncoder(w).Encode(resp)
}
-// TestNewSelfManagedProviderFromConfig_CanonicalPythonSchema pins the
-// canonical lowercase admin-panel settings shape that the Python provider
-// persists and reads (`sandbox.self_managed`: endpoint, timeout,
-// max_retries, pool_size, api_token). The Go provider must map the same
-// schema so a standard settings row configures both runtimes identically.
-func TestNewSelfManagedProviderFromConfig_CanonicalPythonSchema(t *testing.T) {
+// Retired keys in stored settings must not affect connection settings.
+func TestNewSelfManagedProviderFromConfig_LegacySettings(t *testing.T) {
t.Parallel()
p := newSelfManagedProviderFromConfig(map[string]any{
"endpoint": "https://manager.example:9385/",
@@ -567,8 +562,8 @@ func TestNewSelfManagedProviderFromConfig_CanonicalPythonSchema(t *testing.T) {
"pool_size": float64(9),
"api_token": "settings-secret",
})
- if p.helper.maxAttempts != 5 {
- t.Errorf("helper maxAttempts = %d, want 5 from settings max_retries", p.helper.maxAttempts)
+ if p.helper.maxAttempts != 1 {
+ t.Errorf("execution maxAttempts = %d, want 1", p.helper.maxAttempts)
}
if p.endpoint != "https://manager.example:9385" {
t.Errorf("endpoint = %q, want trailing slash stripped", p.endpoint)
@@ -576,9 +571,6 @@ func TestNewSelfManagedProviderFromConfig_CanonicalPythonSchema(t *testing.T) {
if p.timeout != 20*time.Second {
t.Errorf("timeout = %v, want 20s", p.timeout)
}
- if p.poolSize != 9 {
- t.Errorf("poolSize = %d, want 9", p.poolSize)
- }
if p.apiToken != "settings-secret" {
t.Errorf("apiToken = %q, want settings-secret", p.apiToken)
}
@@ -675,7 +667,6 @@ func TestNewSelfManagedProvider_EnvOnlyFallbacks(t *testing.T) {
t.Setenv("SANDBOX_EXECUTOR_MANAGER_TIMEOUT", "15s")
t.Setenv("SANDBOX_EXECUTOR_MANAGER_POOL_SIZE", "11")
t.Setenv("SANDBOX_EXECUTOR_MANAGER_MAX_RETRIES", "6")
- // asserted via p.helper.maxAttempts below
t.Setenv("SANDBOX_BASE_PYTHON_IMAGE", "reg.example.com/envpy:2")
t.Setenv("SANDBOX_EXECUTOR_MANAGER_API_TOKEN", "env-only-secret")
@@ -686,17 +677,14 @@ func TestNewSelfManagedProvider_EnvOnlyFallbacks(t *testing.T) {
if p.timeout != 15*time.Second {
t.Errorf("timeout = %v, want 15s from env", p.timeout)
}
- if p.poolSize != 11 {
- t.Errorf("poolSize = %d, want 11 from env", p.poolSize)
- }
if p.baseImages["python"] != "reg.example.com/envpy:2" {
t.Errorf("python baseImage = %q, want env value", p.baseImages["python"])
}
if p.apiToken != "env-only-secret" {
t.Errorf("apiToken = %q, want env value", p.apiToken)
}
- if p.helper.maxAttempts != 6 {
- t.Errorf("helper maxAttempts = %d, want 6 from env max retries", p.helper.maxAttempts)
+ if p.helper.maxAttempts != 1 {
+ t.Errorf("execution maxAttempts = %d, want 1", p.helper.maxAttempts)
}
}
@@ -711,9 +699,6 @@ func TestNewSelfManagedProviderFromConfig_SettingsBeatEnv(t *testing.T) {
"pool_size": float64(4),
"base_python_image": "reg.example.com/settingspy:3",
})
- if p.poolSize != 4 {
- t.Errorf("poolSize = %d, want settings value 4 to beat env 11", p.poolSize)
- }
if p.baseImages["python"] != "reg.example.com/settingspy:3" {
t.Errorf("python baseImage = %q, want settings value to beat env", p.baseImages["python"])
}
diff --git a/internal/agent/sandbox/testdata/admin_contract.json b/internal/agent/sandbox/testdata/admin_contract.json
deleted file mode 100644
index 2d28876d5a..0000000000
--- a/internal/agent/sandbox/testdata/admin_contract.json
+++ /dev/null
@@ -1,653 +0,0 @@
-{
- "providers": [
- {
- "id": "local",
- "name": "Local",
- "description": "Execute code directly on the current host process.",
- "tags": [
- "local",
- "host",
- "minimal"
- ]
- },
- {
- "id": "self_managed",
- "name": "Self-Managed",
- "description": "On-premise deployment using Daytona/Docker",
- "tags": [
- "self-hosted",
- "low-latency",
- "secure"
- ]
- },
- {
- "id": "ssh",
- "name": "SSH",
- "description": "Execute code on a remote machine over SSH.",
- "tags": [
- "remote",
- "ssh",
- "custom-runtime"
- ]
- },
- {
- "id": "aliyun_codeinterpreter",
- "name": "Aliyun Code Interpreter",
- "description": "Aliyun Function Compute Code Interpreter - Code execution in serverless microVMs",
- "tags": [
- "saas",
- "cloud",
- "scalable",
- "aliyun"
- ]
- },
- {
- "id": "e2b",
- "name": "E2B",
- "description": "E2B Cloud - Code Execution Sandboxes",
- "tags": [
- "saas",
- "fast",
- "global"
- ]
- },
- {
- "id": "tenki",
- "name": "Tenki",
- "description": "Tenki - Disposable microVM code sandboxes",
- "tags": [
- "saas",
- "cloud",
- "microvm",
- "isolated"
- ]
- },
- {
- "id": "ucloud_agent_sandbox",
- "name": "UCloud Agent Sandbox",
- "description": "UCloud Agent Sandbox - Disposable cloud sandboxes for agent code execution",
- "tags": [
- "saas",
- "cloud",
- "isolated",
- "ucloud"
- ]
- }
- ],
- "schemas": {
- "local": {
- "python_bin": {
- "type": "string",
- "required": false,
- "default": "python3",
- "label": "Python Binary",
- "description": "Python executable used for local code execution."
- },
- "node_bin": {
- "type": "string",
- "required": false,
- "default": "node",
- "label": "Node.js Binary",
- "description": "Node.js executable used for local JavaScript execution."
- },
- "work_dir": {
- "type": "string",
- "required": false,
- "default": "/tmp/ragflow-codeexec",
- "label": "Working Directory",
- "description": "Directory used to store temporary scripts and artifacts on the current host."
- },
- "timeout": {
- "type": "integer",
- "required": false,
- "default": 30,
- "label": "Timeout (seconds)",
- "description": "Maximum execution time for each local run. Unit: seconds.",
- "min": 1,
- "max": 600
- },
- "max_memory_mb": {
- "type": "integer",
- "required": false,
- "default": 512,
- "label": "Max Memory (MB)",
- "description": "Address-space memory limit for the local child process. Unit: MB.",
- "min": 1,
- "max": 65536
- },
- "max_output_bytes": {
- "type": "integer",
- "required": false,
- "default": 1048576,
- "label": "Max Output (bytes)",
- "description": "Maximum combined stdout and stderr size. Unit: bytes.",
- "min": 1024,
- "max": 10485760
- },
- "max_artifacts": {
- "type": "integer",
- "required": false,
- "default": 20,
- "label": "Max Artifacts",
- "description": "Maximum number of files collected from the artifacts directory.",
- "min": 0,
- "max": 100
- },
- "max_artifact_bytes": {
- "type": "integer",
- "required": false,
- "default": 10485760,
- "label": "Max Artifact Size (bytes)",
- "description": "Maximum size of a single artifact file. Unit: bytes.",
- "min": 1024,
- "max": 104857600
- }
- },
- "self_managed": {
- "endpoint": {
- "type": "string",
- "required": true,
- "label": "Executor Manager Endpoint",
- "placeholder": "http://sandbox-executor-manager:9385",
- "default": "http://sandbox-executor-manager:9385",
- "description": "HTTP endpoint used by RAGFlow to call sandbox-executor-manager.",
- "scope": "runtime",
- "readonly": false
- },
- "api_token": {
- "type": "string",
- "required": false,
- "label": "Executor Manager API Token",
- "secret": true,
- "placeholder": "Optional; defaults to SANDBOX_EXECUTOR_MANAGER_API_TOKEN",
- "default": "",
- "description": "Shared secret authenticating RAGFlow to sandbox-executor-manager. Must match SANDBOX_EXECUTOR_MANAGER_API_TOKEN on the executor-manager side.",
- "scope": "runtime",
- "readonly": false
- },
- "timeout": {
- "type": "integer",
- "required": false,
- "label": "Request Timeout (seconds)",
- "default": 30,
- "min": 5,
- "max": 300,
- "description": "Maximum request time for a single code execution call. Unit: seconds.",
- "scope": "runtime",
- "readonly": false
- },
- "executor_manager_image": {
- "type": "string",
- "required": false,
- "label": "Executor Manager Image",
- "default": "infiniflow/sandbox-executor-manager:latest",
- "description": "Docker image used by sandbox-executor-manager.",
- "scope": "deployment",
- "readonly": true
- },
- "executor_manager_pool_size": {
- "type": "integer",
- "required": false,
- "label": "Container Pool Size",
- "default": 3,
- "min": 1,
- "max": 100,
- "description": "Container pool size used by sandbox-executor-manager.",
- "scope": "deployment",
- "readonly": true
- },
- "base_python_image": {
- "type": "string",
- "required": false,
- "label": "Base Python Image",
- "default": "infiniflow/sandbox-base-python:latest",
- "description": "Python runtime image used by executor-managed containers.",
- "scope": "deployment",
- "readonly": true
- },
- "base_nodejs_image": {
- "type": "string",
- "required": false,
- "label": "Base Node.js Image",
- "default": "infiniflow/sandbox-base-nodejs:latest",
- "description": "Node.js runtime image used by executor-managed containers.",
- "scope": "deployment",
- "readonly": true
- },
- "executor_manager_port": {
- "type": "integer",
- "required": false,
- "label": "Executor Manager Port",
- "default": 9385,
- "min": 1,
- "max": 65535,
- "description": "Host port exposed by sandbox-executor-manager.",
- "scope": "deployment",
- "readonly": true
- },
- "enable_seccomp": {
- "type": "boolean",
- "required": false,
- "label": "Enable Seccomp",
- "default": false,
- "description": "Whether sandbox-executor-manager starts containers with seccomp enabled.",
- "scope": "deployment",
- "readonly": true
- },
- "max_memory": {
- "type": "string",
- "required": false,
- "label": "Max Memory",
- "default": "256m",
- "description": "Memory limit applied to each sandbox container. Common format: 256m or 1g.",
- "scope": "deployment",
- "readonly": true
- },
- "container_network": {
- "type": "string",
- "required": false,
- "label": "Container Network",
- "default": "none",
- "description": "Docker network attached to sandbox containers. Defaults to 'none' (no external network access); set to 'bridge' only if sandboxed code needs outbound network.",
- "scope": "deployment",
- "readonly": true
- },
- "sandbox_timeout": {
- "type": "string",
- "required": false,
- "label": "Sandbox Timeout",
- "default": "10s",
- "description": "Executor-manager container timeout for each sandbox run. Common format: 10s or 1m.",
- "scope": "deployment",
- "readonly": true
- }
- },
- "ssh": {
- "host": {
- "type": "string",
- "required": true,
- "label": "SSH Host",
- "placeholder": "192.168.1.10",
- "description": "Remote host that will execute generated code."
- },
- "port": {
- "type": "integer",
- "required": true,
- "label": "SSH Port",
- "default": 22,
- "min": 1,
- "max": 65535,
- "description": "SSH port on the remote host."
- },
- "username": {
- "type": "string",
- "required": true,
- "label": "SSH Username",
- "placeholder": "ragflow",
- "description": "Username used to connect to the remote host."
- },
- "password": {
- "type": "string",
- "required": false,
- "label": "SSH Password",
- "secret": true,
- "placeholder": "Optional when using a private key",
- "description": "Password-based SSH authentication."
- },
- "private_key": {
- "type": "string",
- "required": false,
- "label": "SSH Private Key",
- "secret": true,
- "multiline": true,
- "placeholder": "Paste PEM content or enter a local file path",
- "description": "Private key PEM content or a readable private key path on the RAGFlow host."
- },
- "passphrase": {
- "type": "string",
- "required": false,
- "label": "Private Key Passphrase",
- "secret": true,
- "placeholder": "Optional",
- "description": "Passphrase for the private key if it is encrypted."
- },
- "known_hosts": {
- "type": "string",
- "required": false,
- "label": "SSH known_hosts File",
- "placeholder": "/etc/ragflow/ssh_known_hosts",
- "description": "Path to an OpenSSH-format known_hosts file used to verify the remote host's key. When set, the file is loaded on top of the system host keys (~/.ssh/known_hosts). When unset, only system keys are used and unknown hosts are rejected."
- },
- "python_bin": {
- "type": "string",
- "required": false,
- "default": "python3",
- "label": "Python Binary",
- "description": "Python executable used for remote code execution."
- },
- "node_bin": {
- "type": "string",
- "required": false,
- "default": "node",
- "label": "Node.js Binary",
- "description": "Node.js executable used for remote JavaScript execution."
- },
- "work_dir": {
- "type": "string",
- "required": false,
- "label": "Remote Workspace Root",
- "default": "/tmp",
- "placeholder": "/tmp",
- "description": "Writable remote directory used to create a temporary workspace."
- },
- "timeout": {
- "type": "integer",
- "required": false,
- "label": "Timeout (seconds)",
- "default": 30,
- "min": 1,
- "max": 600,
- "description": "Maximum SSH execution time for a single run."
- },
- "max_output_bytes": {
- "type": "integer",
- "required": false,
- "label": "Max Output Bytes",
- "default": 1048576,
- "min": 1024,
- "max": 10485760,
- "description": "Maximum combined stdout and stderr size."
- },
- "max_artifacts": {
- "type": "integer",
- "required": false,
- "label": "Max Artifacts",
- "default": 20,
- "min": 0,
- "max": 100,
- "description": "Maximum number of files collected from the remote artifacts directory."
- },
- "max_artifact_bytes": {
- "type": "integer",
- "required": false,
- "label": "Max Artifact Bytes",
- "default": 10485760,
- "min": 1024,
- "max": 104857600,
- "description": "Maximum size of a single artifact file in bytes."
- }
- },
- "aliyun_codeinterpreter": {
- "access_key_id": {
- "type": "string",
- "required": true,
- "label": "Access Key ID",
- "placeholder": "LTAI5t...",
- "description": "Aliyun AccessKey ID for authentication",
- "secret": false
- },
- "access_key_secret": {
- "type": "string",
- "required": true,
- "label": "Access Key Secret",
- "placeholder": "••••••••••••••••",
- "description": "Aliyun AccessKey Secret for authentication",
- "secret": true
- },
- "account_id": {
- "type": "string",
- "required": true,
- "label": "Account ID",
- "placeholder": "1234567890...",
- "description": "Aliyun primary account ID, required for API calls"
- },
- "region": {
- "type": "string",
- "required": false,
- "label": "Region",
- "default": "cn-hangzhou",
- "description": "Aliyun region for Code Interpreter service",
- "options": [
- "cn-hangzhou",
- "cn-beijing",
- "cn-shanghai",
- "cn-shenzhen",
- "cn-guangzhou"
- ]
- },
- "template_name": {
- "type": "string",
- "required": false,
- "label": "Template Name",
- "placeholder": "my-interpreter",
- "description": "Optional sandbox template name for pre-configured environments"
- },
- "timeout": {
- "type": "integer",
- "required": false,
- "label": "Execution Timeout (seconds)",
- "default": 30,
- "min": 1,
- "max": 30,
- "description": "Code execution timeout (max 30 seconds - hard limit)"
- }
- },
- "e2b": {
- "api_key": {
- "type": "string",
- "required": true,
- "label": "API Key",
- "placeholder": "e2b_sk_...",
- "description": "E2B API key for authentication",
- "secret": true
- },
- "region": {
- "type": "string",
- "required": false,
- "label": "Region",
- "default": "us",
- "description": "E2B service region (us or eu)"
- },
- "timeout": {
- "type": "integer",
- "required": false,
- "label": "Request Timeout (seconds)",
- "default": 30,
- "min": 5,
- "max": 300,
- "description": "API request timeout for code execution"
- }
- },
- "tenki": {
- "api_key": {
- "type": "string",
- "required": true,
- "label": "API Key",
- "secret": true,
- "placeholder": "tk_...",
- "description": "Tenki API key. Create one at https://app.tenki.cloud under API Keys."
- },
- "base_url": {
- "type": "string",
- "required": false,
- "label": "API Endpoint",
- "placeholder": "https://api.tenki.cloud",
- "description": "Override the Tenki API endpoint. Leave empty for the default."
- },
- "image": {
- "type": "string",
- "required": false,
- "label": "Sandbox Image",
- "description": "Base image for sandboxes. Empty uses the Tenki default image (includes python3 and node)."
- },
- "allow_outbound": {
- "type": "boolean",
- "required": false,
- "label": "Allow Outbound Network",
- "default": false,
- "description": "Security-relevant. Disabled by default so sandboxed code has no network access. Enable it to let code make outbound connections (e.g. to install packages)."
- },
- "timeout": {
- "type": "integer",
- "required": false,
- "label": "Timeout (seconds)",
- "default": 30,
- "min": 1,
- "max": 600,
- "description": "Maximum execution time for a single run."
- },
- "max_lifetime": {
- "type": "integer",
- "required": false,
- "label": "Max Sandbox Lifetime (seconds)",
- "default": 3600,
- "min": 60,
- "max": 86400,
- "description": "Tenki reclaims a sandbox after this, guarding against leaks if the run is interrupted."
- },
- "cpu_cores": {
- "type": "integer",
- "required": false,
- "label": "vCPU Cores",
- "default": 0,
- "min": 0,
- "max": 16,
- "description": "vCPU per sandbox. 0 uses the Tenki default."
- },
- "memory_mb": {
- "type": "integer",
- "required": false,
- "label": "Memory (MB)",
- "default": 0,
- "min": 0,
- "max": 65536,
- "description": "Memory per sandbox in MB. 0 uses the Tenki default."
- },
- "disk_size_gb": {
- "type": "integer",
- "required": false,
- "label": "Disk Size (GB)",
- "default": 0,
- "min": 0,
- "max": 100,
- "description": "Disk size per sandbox in GB. 0 uses the Tenki default."
- },
- "max_output_bytes": {
- "type": "integer",
- "required": false,
- "label": "Max Output Bytes",
- "default": 1048576,
- "min": 1024,
- "max": 10485760,
- "description": "Maximum combined stdout and stderr size."
- },
- "max_artifacts": {
- "type": "integer",
- "required": false,
- "label": "Max Artifacts",
- "default": 20,
- "min": 0,
- "max": 100,
- "description": "Maximum number of files collected from the sandbox artifacts directory."
- },
- "max_artifact_bytes": {
- "type": "integer",
- "required": false,
- "label": "Max Artifact Bytes",
- "default": 10485760,
- "min": 1024,
- "max": 104857600,
- "description": "Maximum size of a single artifact file in bytes."
- }
- },
- "ucloud_agent_sandbox": {
- "api_key": {
- "type": "string",
- "required": true,
- "label": "API Key",
- "secret": true,
- "description": "UCloud Agent Sandbox API key."
- },
- "region": {
- "type": "string",
- "required": false,
- "label": "Region",
- "default": "cn-wlcb",
- "description": "UCloud Agent Sandbox region, for example cn-wlcb or us-ca."
- },
- "domain": {
- "type": "string",
- "required": false,
- "label": "Domain",
- "description": "Override the sandbox domain. Leave empty to derive it from Region."
- },
- "api_url": {
- "type": "string",
- "required": false,
- "label": "API URL",
- "description": "Override the UCloud Agent Sandbox control-plane API URL."
- },
- "template": {
- "type": "string",
- "required": false,
- "label": "Template",
- "default": "base",
- "description": "Sandbox template. The base template includes Python and Node.js."
- },
- "allow_internet_access": {
- "type": "boolean",
- "required": false,
- "label": "Allow Internet Access",
- "default": false,
- "description": "Allow sandboxed code to access the internet. Disabled by default."
- },
- "insecure_http": {
- "type": "boolean",
- "required": false,
- "label": "Use Insecure HTTP",
- "default": false,
- "description": "Use HTTP instead of HTTPS. Enable only for trusted private deployments."
- },
- "timeout": {
- "type": "integer",
- "required": false,
- "label": "Execution Timeout (seconds)",
- "default": 30,
- "min": 1,
- "max": 600
- },
- "sandbox_timeout": {
- "type": "integer",
- "required": false,
- "label": "Sandbox Lifetime (seconds)",
- "default": 300,
- "min": 60,
- "max": 86400
- },
- "max_output_bytes": {
- "type": "integer",
- "required": false,
- "label": "Max Output Bytes",
- "default": 1048576,
- "min": 1024,
- "max": 10485760
- },
- "max_artifacts": {
- "type": "integer",
- "required": false,
- "label": "Max Artifacts",
- "default": 20,
- "min": 0,
- "max": 100
- },
- "max_artifact_bytes": {
- "type": "integer",
- "required": false,
- "label": "Max Artifact Bytes",
- "default": 10485760,
- "min": 1024,
- "max": 104857600
- }
- }
- }
-}
diff --git a/internal/common/environments.go b/internal/common/environments.go
index 4dcc7a0cd3..c12bf00c48 100644
--- a/internal/common/environments.go
+++ b/internal/common/environments.go
@@ -137,8 +137,6 @@ const (
EnvSandboxProviderType = "SANDBOX_PROVIDER_TYPE"
EnvSandboxExecutorManagerURL = "SANDBOX_EXECUTOR_MANAGER_URL"
EnvSandboxExecutorManagerTimeout = "SANDBOX_EXECUTOR_MANAGER_TIMEOUT"
- EnvSandboxExecutorManagerPoolSize = "SANDBOX_EXECUTOR_MANAGER_POOL_SIZE"
- EnvSandboxExecutorManagerMaxRetries = "SANDBOX_EXECUTOR_MANAGER_MAX_RETRIES"
EnvSandboxExecutorManagerAPIToken = "SANDBOX_EXECUTOR_MANAGER_API_TOKEN"
EnvSandboxBasePythonImage = "SANDBOX_BASE_PYTHON_IMAGE"
EnvSandboxBaseNodeJSImage = "SANDBOX_BASE_NODEJS_IMAGE"