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 code runs without internet access. It can’t download a dataset or install a package, and the agent tells you when a task needs that. The agent can still search the web, read pages and use the Browser, as before: only the code is cut off.

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.