Configure code-executor resource limits
Set memory limits for workflow code block execution on self-hosted Retool.
| Workflow code executor limits Availability | |||
|---|---|---|---|
| Self-hosted Edge Expected in 3.383.0 and later | Closed beta | ||
| Self-hosted Stable Expected in an upcoming stable release. | |||
Organization admins can configure the memory available to workflow code blocks during execution. You can set an org-wide default that all workflow runs inherit, and optionally allow workflow editors to override it per workflow.
Configuring limits lets you:
- Prevent runaway code blocks from consuming all available host resources.
- Set tighter budgets for organizations running many concurrent workflows.
- Let teams self-serve a fix for out-of-memory errors without an infrastructure change.
Prerequisites
- A self-hosted instance on a Business or Enterprise plan
- The
WORKFLOW_MONITOR_PROCESS_ENABLEDenvironment variable set totrueon yourcode-executorcontainer. Without this, resource limits are not enforced regardless of what is configured here. - A Retool API access token with:
organization:writescope to configure organization-level settingsworkflows:writescope to configure per-workflow overrides
Default limits
When WORKFLOW_MONITOR_PROCESS_ENABLED is true, the code-executor enforces limits from the WORKFLOW_MEMORY_LIMIT_MBS environment variable on the code-executor container. If that variable is not set, the default is 2,500 MB.
Organization-level and workflow-level limits take priority over these environment variable defaults. If neither is set, the environment variable value applies.
Set organization-level defaults
Organization-level limits apply as defaults across all workflow code blocks in your organization. Use the PUT /api/v2/organization/code-executor-settings endpoint to configure them.
curl -X PUT https://{your-domain}/api/v2/organization/code-executor-settings \
-H 'Authorization: Bearer $RETOOL_API_TOKEN' \
-H 'Content-Type: application/json' \
--data '{
"memoryLimitMbs": 1024,
"maxConcurrentProcesses": 10,
"circuitBreakerEnabled": true
}'
memoryLimitMbs must be between 256 and 32768 (in MB).
Refer to the Retool API reference for all available fields and options.
To read the current organization settings, use GET /api/v2/organization/code-executor-settings:
curl https://{your-domain}/api/v2/organization/code-executor-settings \
-H 'Authorization: Bearer $RETOOL_API_TOKEN'
You can also configure organization-level limits in Settings, under the Advanced section, by clicking Advanced settings.
Override limits per workflow
Workflow editors can override the organization-level default for a specific workflow using PATCH /api/v2/workflows/{workflowId} (requires workflows:write scope), or in the workflow editor under Settings > Resource limits.
Refer to the Retool API reference for all available fields and options.
Limit resolution order
When a code block runs, Retool resolves the effective limit using this priority chain:
- Workflow-level override — if a workflow editor has set a limit on that specific workflow, it takes effect.
- Organization-level default — if no workflow-level override is set, the organization default applies.
- Environment variable default — if neither is configured, the
code-executorcontainer's environment variables determine the limit.
When a code block exceeds its limit
If a code block exceeds the enforced memory limit, Retool terminates the process immediately and the block returns the following error:
The process was aborted because memory or cpu limits were breached.
The block fails fast rather than consuming all available host resources. No other blocks in the workflow are affected unless the failed block is a dependency.
Reset a limit to default
Set a field to null to remove an override and fall back to the next priority level.
To remove a per-workflow override (falls back to the organization-level default):
curl -X PATCH https://{your-domain}/api/v2/workflows/{workflowId} \
-H 'Authorization: Bearer $RETOOL_API_TOKEN' \
-H 'Content-Type: application/json' \
--data '{
"code_executor_memory_limit_mbs": null
}'
To remove an organization-level default (falls back to the environment variable):
curl -X PUT https://{your-domain}/api/v2/organization/code-executor-settings \
-H 'Authorization: Bearer $RETOOL_API_TOKEN' \
-H 'Content-Type: application/json' \
--data '{
"memoryLimitMbs": null,
"maxConcurrentProcesses": null
}'