> Code execution
What it does
When a question needs real work rather than a plausible answer, Ocai writes and runs Python. The code executes inside an isolated sandbox on Ocai's servers, and the result comes back into the chat.
That is the difference between a number that was produced and a number that was guessed. Arithmetic across a hundred rows, a conversion, a statistic over a file you attached: those are computed, not estimated.
When it is worth using
- Math that has to be right. Totals, percentages, unit conversions, anything with a wrong answer you would notice.
- Data work. Cleaning, grouping, counting, and summarising rows from a file.
- Files that need processing. Extracting what you need from a large document rather than reading the whole thing.
- Anything repeated. A calculation across many items, done by hand, is exactly what this is for.
You do not need to ask for the code tool. Ask for the result, and Ocai reaches for it when the question calls for it.
Asking well
- Say what you want calculated, and over what.
- Attach the data rather than describing it.
- Say what the output should look like, so you get a table rather than a paragraph.
Reading the output
The result appears in the chat. Check it the way you would check any number that matters: does the total match what you expect, does the shape look right, does it survive a second calculation a different way.
If a result looks wrong, say what you expected instead. That is usually enough for Ocai to find where it went astray.
Reusing the result
The output stays in the conversation, so you can build on it: ask for a chart, a different grouping, or the same analysis over a second file.
The sandbox on your laptop
This sandbox runs on Ocai's servers. If you install the desktop app, a separate sandbox runs on your own machine with internet access. That is a different setup, described on the Desktop sandbox page.
Questions people ask
Do I need to know Python?
No. Ask for what you want, in plain language.
Can it reach the internet?
The sandbox on Ocai's servers has no internet access. It works with what you give it.
What if the code is wrong?
Say so and describe what you expected. Ocai reruns it, usually with the mistake fixed, and shows you the new result.