ConfigurationFeatures
Code Execution
Configure server-side code execution capabilities
The [features.code_execution] section configures server-side code execution. By default, code execution happens client-side via WebAssembly in the browser (Pyodide for Python, QuickJS for JavaScript).
Client-side WASM execution requires no server configuration. This section is only needed for server-side sandboxed execution.
Configuration Reference
Main Settings
[features.code_execution]
enabled = true
mode = "wasm"
allowed_languages = ["python", "javascript"]
timeout_secs = 30
max_memory_mb = 256| Key | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Enable code execution |
mode | string | "wasm" | Execution mode |
allowed_languages | array | ["python", "javascript"] | Allowed languages |
timeout_secs | integer | 30 | Execution timeout |
max_memory_mb | integer | 256 | Maximum memory per execution |
Execution Modes
WASM (Default)
Client-side execution in the browser:
[features.code_execution]
enabled = true
mode = "wasm"No server-side configuration needed. Runs via:
- Python: Pyodide (numpy, pandas, matplotlib available)
- JavaScript: QuickJS (sandboxed)
Sandboxed
Server-side execution in containers:
[features.code_execution]
enabled = true
allowed_languages = ["python", "javascript", "bash"]
timeout_secs = 60
max_memory_mb = 512
[features.code_execution.mode]
sandboxed = { runtime = "docker" }| Runtime | Description |
|---|---|
docker | Docker containers |
firecracker | Firecracker microVMs |
gvisor | gVisor sandboxed containers |
External Service
Delegate to an external code execution service:
[features.code_execution]
enabled = true
allowed_languages = ["python", "javascript", "r", "julia"]
timeout_secs = 120
max_memory_mb = 1024
[features.code_execution.mode]
external = { url = "https://code-exec.example.com", api_key = "${CODE_EXEC_API_KEY}" }| Key | Type | Description |
|---|---|---|
url | string | External service URL |
api_key | string | API key for authentication |
Complete Examples
Client-Side Only (Default)
[features.code_execution]
enabled = true
mode = "wasm"
allowed_languages = ["python", "javascript"]
timeout_secs = 30
max_memory_mb = 256Docker Sandboxed
[features.code_execution]
enabled = true
allowed_languages = ["python", "javascript", "bash", "ruby"]
timeout_secs = 60
max_memory_mb = 512
[features.code_execution.mode]
sandboxed = { runtime = "docker" }External Service
[features.code_execution]
enabled = true
allowed_languages = ["python", "javascript", "r", "julia", "sql"]
timeout_secs = 120
max_memory_mb = 2048
[features.code_execution.mode]
external = { url = "https://code-exec.internal.company.com", api_key = "${CODE_EXEC_API_KEY}" }Security Considerations
Server-side code execution requires careful security configuration. Consider: - Network isolation for containers - Resource limits (CPU, memory, disk) - Execution timeouts - Language restrictions
See Also
- Frontend Tools Guide - Client-side WASM execution