Skip to main content
Feature in Beta
Code execution lets the assistant run bash commands and create, edit, and present files inside an isolated sandbox. Each chat thread (or API container) gets its own sandbox, created on demand by the bundled OpenSandbox service on the same Kubernetes cluster. Users see it in the Workspace when they work with Skills or generate files. Developers can use it through the API; see Code Execution tool. Code execution is enabled by default in standard Zylon 1.58 deployments. Operators can control its availability in Workspace chat with the setting below.

Configuration

Example

To disable code-execution tools in Workspace chat:

When disabled

After setting features.codeExecution.enabled: false, run sudo zylon-cli sync to apply the change. Workspace chat removes code-execution tools before sending requests to the model, including when a Skill would otherwise add them. Ordinary chat and other available tools continue to work; Skill steps that require running code cannot execute through that chat flow.
In Zylon 1.58, this flag does not globally disable code execution through the ZylonGPT API or remove the OpenSandbox service. The GPT provider is configured separately and defaults to OpenSandbox. Treat this flag as a Workspace control; API code execution can remain available.

How it works

  • One sandbox per thread. Each sandbox is a pod in the opensandbox-runtimes namespace, created when the assistant first runs code in a thread and shut down after sessionTTLSeconds of inactivity.
  • Persistent files. Uploads, outputs, and workspace files are stored in the sessions bucket of the platform object storage, so they survive sandbox restarts and platform upgrades.
  • Pre-pulled images. The sandbox images are pulled during installation and upgrade, so no registry access is needed when a sandbox starts. This also works in airgapped installations.

Network access

Sandboxes have no internet access. By default, a code execution sandbox can only reach:
  • DNS.
  • The Zylon API, so code in the sandbox can call the model with the permissions of the user who sent the request.
To let sandboxes reach other services inside the cluster, such as an internal database or API, add them to external.opensandbox.codeExecution.internal.services. Each entry selects pods by their labels: namespaceSelector takes the namespace’s labels and podSelector the pods’ labels. List the labels directly, without matchLabels (Zylon adds it), and give each selector at least one label: an empty one would let sandboxes reach every pod in the cluster.
Code in the sandbox is written by the AI model. Only allow services that you’re comfortable exposing to any user who can chat with the assistant.

Resources

By default, sandboxes don’t have CPU or memory limits. To cap the total resources sandboxes can use, enable the quota and limit range for the sandbox namespace:

Sandbox images

The image includes Python 3 with common data libraries (pandas, numpy, matplotlib, openpyxl, python-docx, pypdf, and others) and command-line tools such as unzip, rg, and sqlite3. When the assistant starts a web app or HTTP server inside the sandbox, such as a dashboard or an interactive chart, it can share a link to it in the chat. These links are served from a dedicated subdomain of your Zylon domain:
The link opens directly in the user’s browser, so the subdomain needs a DNS record and, with manual certificates, its own SSL certificate. See Subdomains. Sandbox app links are turned off by default. Add the following to /etc/zylon/zylon-conf.yaml and run sudo zylon-cli sync:
Then make sure the subdomain is set up: a DNS record and, with manual certificates, the sandbox SSL secret, created after the sync. See Subdomains. To stop the assistant from sharing links to apps running in the sandbox, set presentServer back to false (the default) and run sudo zylon-cli sync. The assistant can still run code and present files.
This setting only controls whether the assistant shares links. The sandbox-exec ingress is part of the sandbox gateway and stays deployed.

Troubleshooting

Check the sandboxes that are running:
Check the OpenSandbox server logs:
If code execution is unavailable in Workspace chat, check features.codeExecution.enabled and run sudo zylon-cli sync after changing it. If a sandbox app link doesn’t load or shows a certificate warning, check the DNS record for sandbox-exec.<your_zylon_domain> and, with manual certificates, the zylon-tls-sandbox-exec secret in the opensandbox namespace. To see the host and the secret the sandbox ingress expects, run the following and check the TLS line (zylon-tls-sandbox-exec terminates sandbox-exec.<your_zylon_domain>):
The error code_execution provider is not configured. means the GPT code-execution provider is missing. Check the GPT provider configuration and OpenSandbox service; this error is not the expected result of disabling the Workspace flag alone.