Run Python code in a sandboxed environment for data analysis and plotting.
Code Execution gives the AI the ability to write and run Python code in a secure sandboxed environment. This is useful for post-processing simulation data, generating plots, performing calculations, and transforming datasets.
What it can do
The sandboxed Python environment supports common scientific and data analysis workflows:
Data analysis -- Load CSV or Excel data, compute statistics, filter and transform datasets
Plotting -- Generate publication-quality charts with matplotlib (residual plots, contour maps, bar charts, scatter plots)
Computation -- Calculate derived quantities like drag coefficients, Nusselt numbers, or pressure drops from raw simulation output
Comparison -- Compare results across multiple simulation runs or against experimental data
Formatting -- Convert data between formats, generate summary tables, export processed results
How it works
AI writes the code
Based on your request, the AI generates a Python script tailored to your data and question.
Sandboxed execution
The script runs in an isolated environment with no access to the internet or your local filesystem. Only the data you have shared in the conversation is available.
Results displayed inline
Output -- text, tables, or images -- is rendered directly in the chat. Plots appear as inline images that you can click to expand.
You can see the code
The AI always shows the Python code it wrote before executing it. You can ask it to modify the code, add labels, change colors, or adjust the analysis before or after running.
Example use cases
Configuration
Parameter
Value
Toggle
Can be enabled or disabled in Settings
Sandbox limitations
The execution environment is sandboxed for security. It does not have internet access, cannot install arbitrary packages, and has a limited execution time. Pre-installed packages include NumPy, pandas, matplotlib, SciPy, and other common scientific Python libraries.
When to use Code Execution
Code Execution is most valuable when you need quantitative analysis beyond what the AI can do with text alone. If you are asking for a specific number, a comparison chart, or a data transformation, the AI will often suggest running code automatically. You can also request it explicitly: "Write a Python script to compute the Reynolds number for each case."