ClouisleClouisle

Code Sandbox

Run Python and JavaScript code safely in an isolated environment

The code sandbox is Clouisle's isolated execution environment for running user-provided Python and JavaScript in workflows, Agents, and tools. Every job starts in its own runtime, mounts only that job's working directory, and is bounded by timeouts, output limits, and disk quotas.

How isolation works

  • One isolated environment per job: a job runs in a fresh isolated space and cannot see the host's other processes, files, or network configuration, nor reuse the previous job's temporary files.
  • Read-only system directories: the system runtime and dependency directories are mounted read-only, so jobs cannot modify system binaries, installed dependencies, or system configuration.
  • Only the working directory is writable: a job can write only to its own /workspace directory and temporary directory. Temporary files are removed with the job, and the whole working directory is cleaned up when the session expires.
  • Processes end with the job: when a job times out or is cancelled, every child process started inside the sandbox ends with it and leaves nothing running.
  • Filtered runtime environment: jobs receive a filtered process environment, not the platform's full environment.

The sandbox never silently degrades to unsandboxed execution: if the isolated environment cannot start, the job fails instead of running in the host process.

Supported runtimes

RuntimeBase environment
PythonPython 3.13 with the standard library and dependencies configured by the job
JavaScriptNode.js 22 with core modules and dependencies configured by the job

The official sandbox image includes CJK fonts, so charts generated with matplotlib, seaborn, or Pillow render Chinese characters correctly instead of showing missing-glyph boxes.

Use cases

  • Code tools: create reusable code tools under Capabilities > Code in the admin console, install exact pinned dependency versions, declare artifacts under /workspace, and call the tool from Agents and workflows (see Custom HTTP and code tools).
  • Workflow code nodes: embed code directly in a workflow graph, receive input variables, and pass results to downstream nodes (see Workflow nodes).
  • Agent invocation: an Agent triggers a code tool through a function call, letting the model decide when code should run.

Execution limits

Every job is subject to the limits below; the effective value is whichever comes first between the job configuration and the caller's timeout:

LimitDefaultAllowed rangeNotes
Execution timeout30 seconds1-600The job and its child processes are reclaimed on timeout
Disk quota1024MBBounded by deploymentSpace available to the working directory
Standard output limit256KB16-8192KBExcess is truncated and marked as truncated at the end
Standard error limit256KB16-8192KBSame as above

The caller has its own timeout: direct code execution defaults to 30 seconds, and calling a code tool from an Agent chat has an outer limit of 60 seconds. A saved tool's timeout takes precedence over the value passed at call time, and whichever expires first wins: a timeout inside the sandbox reports "execution timed out", while the outer timeout reports "tool call timed out".

Artifacts must be written under /workspace; writes elsewhere are rejected. A single artifact defaults to 10MB and total artifacts to 10MB.

Outbound network

Sandbox egress is controlled by the sandbox egress allowlist under Settings > Security, a separate policy from the outbound network allowlist on the same page: allowlisting an internal host for tools does not open it to the sandbox.

  • Accepts exact hostnames only, case-insensitively; wildcards, IP addresses, and ranges are rejected on save.
  • Defaults to pypi.org, files.pythonhosted.org, pypi.python.org, and registry.npmjs.org; up to 200 entries, duplicates removed.
  • An empty list blocks all outbound traffic. Jobs can reach allowlisted hosts only over HTTPS on port 443; HTTP, other ports, and direct IP access are refused.
  • Custom Python package indexes and Node registries must use HTTPS, and their hostnames must be in the list.
  • Changes apply to the next job without a restart; running jobs keep the policy from their start time.
  • Turning the sandbox egress allowlist off affects new jobs only: new jobs can reach any target, protocol, and port; filesystem isolation, timeouts, disk, and output limits still apply, and the list is kept and restored when re-enabled.

If the policy cannot be read, it is treated as an empty list, blocking all outbound traffic. Host or cluster network policy remains the outer safety net.

Host and node requirements

The sandbox relies on the host or node allowing isolated process spaces to be created. Supplied deployments run sandbox nodes with the required privileges, so node kernel settings usually need no changes. With a custom deployment, if the isolated environment cannot start, every job fails with a message that a namespace cannot be created. That is a node kernel or security configuration issue; see Troubleshooting.

Failures and troubleshooting

  • Execution timed out: the job did not finish in time and output may be incomplete; reduce the input or raise the tool's timeout.
  • Output truncated: standard output or error exceeded its limit and a truncation marker appears at the end; write key information to artifact files when debugging.
  • No artifact produced: confirm the write path is inside /workspace and neither the single-file nor the total limit was exceeded.
  • Cannot install dependencies: the package host is not in the sandbox egress allowlist, or HTTP was used. Switch to HTTPS and ask an administrator to add the hostname.
  • A job fails instead of degrading: an unavailable isolated environment never falls back to unsandboxed execution. This is a deployment issue; check the sandbox node per Troubleshooting.

See also:

How is this guide?

On this page