Python Data Analysis
Sandboxed Python execution for data analysis, charting, and statistical computation.
Atlas can execute Python code in a sandboxed environment for data analysis, statistical computation, and chart generation. The agent writes Python after running SQL queries to produce visualizations and deeper analysis.
Enable
ATLAS_PYTHON_ENABLED=truePython execution requires a sandbox backend. Set ATLAS_SANDBOX_URL (sidecar) or use nsjail/Vercel sandbox. Unlike the explore tool, there is no just-bash fallback — Python will not work without a sandbox.
Sandbox Backends
Python runs through the same sandbox infrastructure as the explore tool, with the following priority:
| Priority | Backend | How to enable |
|---|---|---|
| 1 | Sidecar | Set ATLAS_SANDBOX_URL |
| 2 | Vercel sandbox | Set ATLAS_RUNTIME=vercel (Python 3.13) |
| 3 | nsjail (explicit) | Set ATLAS_SANDBOX=nsjail |
| 4 | nsjail (auto-detect) | nsjail binary on PATH or ATLAS_NSJAIL_PATH |
Unlike the explore tool, there is no just-bash fallback for Python. If no isolated backend is available, Python execution is rejected with an error.
Available Libraries
The following libraries are available in the sandbox:
- pandas -- DataFrames and data manipulation
- numpy -- Numerical computation
- matplotlib -- Static charts and plots
- plotly -- Interactive charts
The exact set of available libraries depends on the sandbox backend and its Python environment.
Chart Rendering
When Python code generates charts (via matplotlib or plotly), they appear inline in the chat UI. The agent can produce:
- Bar charts, line charts, pie charts, scatter plots
- Statistical visualizations (histograms, box plots)
- Multi-series and grouped charts
Charts generated with Recharts format (a React charting library) are rendered natively in the web UI for interactive exploration.
Security Model
Python execution is isolated at multiple layers:
- Import guard -- Defense-in-depth blocking of dangerous modules:
subprocess,os,socket,requests,pickle,tempfile,shutil, and others. This is a first-pass filter; the sandbox backend is the real security boundary - No filesystem writes -- The sandbox environment is read-only
- No network access -- Outbound connections are blocked by the sandbox
- No shell access --
os.system(),subprocess.run(), and similar are blocked - Timeout enforcement -- Each execution has a configurable time limit
Environment Variables
| Variable | Default | Description |
|---|---|---|
ATLAS_PYTHON_ENABLED | — | Set to true to enable Python execution |
ATLAS_PYTHON_TIMEOUT | — | Per-execution timeout |
The sandbox itself is configured via the standard sandbox variables. See Environment Variables and Sandbox Architecture.
How It Works
- The agent runs a SQL query via
executeSQLand gets tabular data - The agent writes Python code using the query results as input (passed as a
dataparameter withcolumnsandrows) - Atlas validates the code against blocked imports and builtins
- The code runs in the sandbox backend with the data available
- Output (text, tables, or charts) is returned to the agent and displayed in the chat UI
The agent decides when to use Python based on the question -- statistical analysis, trend detection, and visualization requests typically trigger Python execution.