docs/self-hosting/environment-variables/cloud-sandbox.mdx
Cloud Sandbox powers the built-in code execution, shell command, file operation, and file export tools. By default, LobeHub uses the Market sandbox. Self-hosted deployments can switch the same tool surface to an Onlyboxes-compatible sandbox provider.
SANDBOX_PROVIDERmarketonlyboxesSupported values:
market: Use the existing Market sandbox.onlyboxes: Use an Onlyboxes-compatible self-hosted sandbox console.MARKET_BASE_URLhttps://market.lobehub.comhttps://market.example.comMARKET_TRUSTED_CLIENT_IDlobechat-comMARKET_TRUSTED_CLIENT_SECRETyour-market-trusted-client-secretONLYBOXES_BASE_URLSANDBOX_PROVIDER=onlyboxes/api/v1.https://onlyboxes.example.comONLYBOXES_JIT_SIGNING_KEYSANDBOX_PROVIDER=onlyboxesCONSOLE_JIT_SIGNING_KEY.onlyboxes-jit-signing-secretONLYBOXES_JIT_ISSUERAPP_URLhttps://lobehub.example.comONLYBOXES_JIT_TTL_SEC1800900ONLYBOXES_LEASE_TTL_SEC9003600By default, LobeHub uses the official Market sandbox and does not require extra sandbox configuration:
# SANDBOX_PROVIDER=market
To explicitly use Market, or to connect to a self-hosted or dedicated Market service, configure:
SANDBOX_PROVIDER=market
MARKET_BASE_URL=https://market.example.com
If that Market service requires the LobeHub server to call sandbox, credential, or skill capabilities on behalf of the current user, also configure Trusted Client credentials:
MARKET_TRUSTED_CLIENT_ID=lobechat-com
MARKET_TRUSTED_CLIENT_SECRET=your-market-trusted-client-secret
MARKET_TRUSTED_CLIENT_ID must be registered in the Market service's trusted client allowlist, and MARKET_TRUSTED_CLIENT_SECRET must match the shared secret configured on the Market service. Without Trusted Client credentials, Market capabilities that require authentication continue to use the existing user authorization flow.
The configured Onlyboxes worker should expose terminalExec and terminalResource. LobeHub uses terminalExec as the compatibility layer for shell commands, code execution, and file operations, and uses terminalResource for file export through a pre-signed upload URL.
For feature parity with the Market sandbox, the terminal runtime image should include:
python3, used by file operation wrappers and Python executionnode, used by JavaScript executionnpx with access to tsx, used by TypeScript executionbase64, find, and grepMinimum configuration for using Onlyboxes:
SANDBOX_PROVIDER=onlyboxes
ONLYBOXES_BASE_URL=https://onlyboxes.example.com
ONLYBOXES_JIT_SIGNING_KEY=onlyboxes-jit-signing-secret
Set the same secret on the Onlyboxes console:
CONSOLE_JIT_SIGNING_KEY=onlyboxes-jit-signing-secret
<Callout type={'info'}> File export still writes the exported artifact to the configured LobeHub S3 storage. Configure the S3 environment variables when users need to download files generated inside the sandbox. </Callout>