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. If the agent didn’t say what the run is for, the line reads Running code while the code runs and Ran code once it has run. 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.

When the agent made a file for you, such as a report or a chart, its answer names the file as a link, for example Your report is ready: report.csv. Select the link to download the file: it says Preparing… beside it at once, your browser saves the file under its own name, and you stay on the page. If the download doesn’t work, the link says so, and you select it again.

Every file a run wrote is also on the run’s card. The card 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. A file the run wrote into a Shared Drive is on the card too, with the name of the drive. Only files the agent wrote with its drive helper are listed; a file made another way isn’t. 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 spreadsheet or an Office document isn’t text, so the agent reads those by running code that opens them.

The agent can also look at an image or at pages of a PDF, when what matters is how it looks: a screenshot of a chart, a photo, a scanned page. It looks at PNG, JPEG, GIF and WebP images, and at the pages of a PDF it needs, 20 pages at most at a time. A large image is scaled down to fit first. Its step says Looked at and the file’s name, and for a PDF which pages the agent read and how many the PDF has. If the agent asks for a file that is neither an image nor a PDF, or for pages the PDF doesn’t have, the step says Refused and why, and the agent reads the file another way.

What an image or a page shows is only information for the agent: it never follows instructions written in a file.

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. The line of its card says 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.
  • Data Sources set to Also in the Sandbox reach your code only with the Right: the code connects to them over the internet. Without it, the agent says which ones it can’t reach and queries them with the query tool instead. See Also in the Sandbox.
  • Data Sources on your private network set to Also in the Sandbox are reached from your Tenant network, where your code has no internet access, whatever your Rights. See Use the private network in the Sandbox.

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.

When the agent has queried a Data Source and needs more than SQL can do, such as a forecast or a statistical test, it hands the result to its code. The rows arrive in the Sandbox as a file, and only the rows: a Data Source set to Query tool only never puts its connection string into the Sandbox. Results are kept for 7 days; after that, the agent runs the query again. What the code works out, it can show as a Card.

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.