Skip to content

Let the agent run code

When an answer needs arithmetic, statistics, a comparison of two lists, a trend or a check of a formula, the agent doesn’t estimate: it writes Python, or a shell command, and runs it in a Sandbox, an isolated computer that exists for this one purpose. Models are good at explaining and unreliable at arithmetic, so the numbers in an answer come from the code, and the agent tells you in plain words what it computed.

You don’t have to ask for it. Ask What is 123456 times 789? or Which of these two lists has the larger total?, and the agent decides on its own to calculate.

Every run shows as one card among the steps of the agent’s answer. Its line says what the run was for, the language, how it went and how long it took, and the card shows Running… at once, while the code still runs. Open the steps and then the card to see the code, with its syntax highlighted, and the result: the output the code printed, and any error messages, marked as errors. Very long output is shortened to its beginning and its end, with a note between them saying how much was left out, so a step stays readable. After you reload the page, the cards look as before.

Code doesn’t always work the first time. If a run ends with an error, the agent reads the message, fixes its code and runs it again, within the same answer. You see both runs among the steps, the failed one with its error and the corrected one after it. The agent only gives up when it can’t fix the code, and then it tells you.

A run takes about five minutes at the most. If the code is still running after that, the agent ends the run: its card says Timed out, and the Sandbox restarts, so the variables and files of earlier runs are gone. The agent knows this, tells you, and tries again with something shorter or in smaller steps.

Stop ends a run that is going on, too. Select it as for any Turn: the Sandbox stops the code at once, the card of the run says Cancelled, and the Sandbox restarts for the next run. After a reload, the card still says so. Select Continue to let the agent pick up from there.

The Sandbox disappears after about 30 minutes, but your Personal Drive doesn’t. When a run produces a file you want to keep, such as a report, an export or a chart, the agent writes it into the folder of this Conversation on your Personal Drive. The folder is named after the Conversation and stays when you delete the Conversation. In a later run, in this Conversation or another, the agent can open what it kept earlier, also after the Sandbox restarted.

The card of a run that wrote files lists them: the name of each file, its kind and its size. The line of the collapsed card counts them, for example Python · Finished · 0.4 s · 2 files. Open the steps, the card and its Files list, and select Download next to a file: the button says Preparing… at once, and your browser saves the file under its own name. You stay on the page.

A card lists the files the run wrote or changed, not the ones already in the folder. If a run wrote more files than fit on the card, the card says how many more there are; they are in the folder of the Conversation all the same. If a download doesn’t work, the file says so, and you select Download again. You can only download files from your own Personal Drive.

Only you can reach your Personal Drive. When you are removed from a Tenant, your Personal Drive in that Tenant is deleted with all File Versions.

The agent reads the text files on your Personal Drive without running code: it lists folders, opens a file, searches the files for a word and finds lines that match. They appear as the folder /personal in the file listing the agent works with. The agent only reads there; to change or add a file, it runs code. A PDF, a spreadsheet or an Office document isn’t text, so the agent reads those by running code that opens them.

The agent only ever sees your own Personal Drive, never that of another user or of another Tenant. While a Sandbox runs for the Conversation, a file that holds a credential the platform put into the Sandbox shows it as hidden credential, like any other output.

Whether the code can reach the internet depends on the Right “Sandbox has internet access”, which your Tenant’s admins give to users, Groups and Roles. Both preset Roles, Admin and Member, hold it unless your admins removed it.

  • With the Right, the code can download a public dataset or install a package. Its card shows the badge With internet access. The code can also send data out, so don’t ask the agent to put your confidential data on the internet.
  • Without it, the code can’t download anything or install a package. The agent tells you when a task needs that and which Right is missing, so you know whom to ask: an admin of your Tenant.

The agent can search the web, read pages and use the Browser either way: that doesn’t depend on the Right. When an admin gives you the Right or takes it away, your next run starts a new Sandbox, so the variables and files of earlier runs are gone, and the card says The Sandbox restarted.

If an admin takes the Right away while your code runs, the run ends within moments and its internet access with it. The same happens to a Sandbox when you delete its Conversation.

Of our storage, the code reaches only your own Personal Drive: it can read, write and list your files there, but not delete an earlier File Version. It can’t read the files of other users or of another Tenant, whatever it is told to do.

Nothing of you is inside the Sandbox. The code doesn’t run with your sign-in or with the agent’s access, and it can’t read other users’ data or the data of another Tenant.

Each Conversation has one Sandbox Session. It starts with the first run, and the variables and files the code creates stay in it from one run to the next, also from one answer to the next, so the agent can build on an earlier result. A session lasts about 30 minutes. After that, the Sandbox restarts by itself, without you having to do anything.

A Sandbox can also start fresh earlier, for example when another server takes over your Conversation. Then everything the code created is gone, and the card of the next run says The Sandbox restarted. The agent knows that this can happen at any time. It rebuilds what it needs by running its earlier steps again, so a restart costs a little time but doesn’t break your task.

If the Sandbox can’t be reached, the agent says so and goes on with its answer, without a calculation to rely on. Ask again a little later, or select Continue if the answer broke off.