Bosphorus
Contents — agentdesk

Documentationagentdesk

The code sandbox

What builtin__run_code gives an agent: its own Python environment for one run — what it can do, what it cannot reach, its limits, and how files leave it.

Checked against the running product on 22 November 2026

builtin__run_code gives an agent a private Python environment to calculate in, work with data, draw charts and write files. This page says what it can do and what it cannot. Where your installation has no sandbox, the checkbox in the editor is shown as unavailable, with the reason.

What it can do

  • Run Python, step by step. One environment lasts for the whole run, so variables, imports and files survive from one call to the next, and the agent can build its work up instead of repeating it. Two runs never share an environment.
  • Use the scientific stack. The sandbox as shipped carries numpy, pandas, matplotlib, scipy and openpyxl — enough for calculations, tables, charts and Excel files. Libraries for Word, PowerPoint or PDF files are not part of it; ask for CSV, Excel, Markdown or an image instead, or ask your administrator for a sandbox that has them.
  • Make files you can download. Anything the agent saves in its working directory is copied out and appears in the run’s Files panel — while the run is still going, not only at the end. See Runs, files and memory.

What it cannot do

  • Reach the network. Code written by a model gets no path of its own to anything, and nothing can be installed from inside a run. The agent’s way to the outside world is its tools, which are checked and recorded; data goes into the sandbox through the code the agent writes.
  • Reach the platform. The sandbox cannot call the gateway, read your agents, or see another run’s environment.
  • See pictures. A chart the code draws is not shown to the model. The agent is told to save it to a file and describe it, or to print the numbers.
  • Run for ever. Each call is interrupted when its time is up: 60 seconds unless the agent asks for more, and 5 minutes at most, as shipped. A block of code may be up to 60,000 characters. Runaway code is interrupted rather than left running.

How long it lasts

The environment is released when the run ends, and it is recycled after a period of inactivity. If a run waits a long time — for your answer to a question, say — the environment may be recycled in the meantime: the agent then starts a fresh one, and its earlier variables are gone. Files already copied to the run are not affected; they stay on the run page after the sandbox itself is gone.

Ticking it

Ticking builtin__run_code authorises code execution: the agent may run any Python it writes inside the sandbox. The limits above are why that can be granted to an agent that has just read a web page — the code has no network of its own and no way into the platform. If the sandbox cannot be reached when the agent calls it, the agent is told the code was not run, rather than that the code was wrong.