Analysis
Analysis is Strata's ability to write and run code in an isolated sandbox — for math, transforms, advanced visualizations, and any task the pre-built tools cannot cover. Everywhere in the product it is called Analysis; the sandbox itself runs Python, which matters only if you are an administrator reviewing what it can reach.
When Strata reaches for analysis
Strata runs an analysis automatically when:
- You ask for a chart or image that the inline
chartblock cannot produce — heatmaps, multi-panel layouts, annotated plots, infographics drawn with PIL. - You ask explicitly: "use Python", "do this in Python", "compute X with Python".
- Data needs a transform too custom for a SQL query (statistical fits, regressions, custom aggregations, dataframe gymnastics).
- A file you uploaded needs programmatic processing (parsing a binary, splitting a multi-sheet workbook, generating a derived file).
You will see the action step appear in the trail as Running analysis… or Ran 1 analysis when complete.
What the sandbox can do
- A broad pre-installed library set. Data and modeling: pandas, numpy, scipy, scikit-learn, statsmodels, sympy, networkx, joblib. Plotting: matplotlib, seaborn, plotly, pillow (PIL), wordcloud. Files and documents: openpyxl, xlsxwriter, xlrd, pyarrow, python-docx, python-pptx, pypdf, pdfplumber, reportlab, lxml, beautifulsoup4, html5lib, markdown, jinja2, sqlalchemy.
- Extra libraries on demand. When a task needs a library that is not pre-installed, Strata can name it and the platform installs it into that run before the code executes — so you can ask for work that depends on a package like
yfinanceorgeopandaswithout any setup. The platform fetches the package; the sandbox running your code still has no network of its own. If a requested package cannot be installed, the import errors and Strata falls back to another approach. - Persistent state within a session. Top-level variables — dataframes, dicts, numbers, lists — are pickled and restored on the next
run_pythoncall, and files written under/workspacestay there. So Strata can load and clean in one step, then aggregate and plot in another, reusing the samedf. An idle conversation eventually gets a fresh, empty sandbox, so Strata re-creates anything it can no longer find. - A writable file workspace.
/workspace/outputs/holds files meant for you — anything registered there can be returned as a download or rendered inline — and/workspace/scratch/is working space. The sandbox starts empty each session; see Working with uploaded data for how files you attach reach an analysis. - Inline rendering of images.
.png,.jpg,.jpeg,.gif,.svg,.webp,.bmpsaved to/workspace/outputs/and registered withstrata_runtime.present_file()render directly in the chat as image cards. - Download cards for other file types. Excel, PDF, PPTX, DOCX, Markdown, CSV, JSON, ZIP all become download cards.
- HTML routed to the dashboard panel. An
.htmlfile produced by an analysis opens in the artifact panel as a dashboard — the same placeupdate_dashboardputs things.
Working with uploaded data
When you attach a data file — CSV, TSV, Excel, JSON, or Parquet — and ask for an analysis, Strata stages the real file into the sandbox at /workspace/scratch/_inputs/<filename> and the analysis reads it straight from disk (for example pd.read_csv('/workspace/scratch/_inputs/sales.csv')). The analysis works on the actual file — every row, with correct types — not a text approximation. So a prompt like "run a regression on the columns in this CSV" reads the whole dataset from disk. You never manage paths yourself; just attach the file and describe the analysis.
A zip archive is staged the same way, as the archive itself: an analysis opens it with Python's zipfile, lists what is inside, and reads only what your question needs. Strata never unpacks a zip for you, so a zip can be opened only where Analysis is available. See Zip files.
For other attachments, Strata reads the extracted content already in its context instead of staging a file.
To change an uploaded Office or PDF file itself — rather than compute over its data — Strata uses the dedicated editing tools instead of an analysis. See Files.
NoteStaged input files have limits (a handful of files, up to ~20 MB each). A file above the cap — or a non-data attachment — is read from its extracted content instead, which may be summarized or sampled. For a very large dataset, load it into your database and let Strata query it.
The action-step panel for an analysis
Click any Running analysis step in the action-step trail to expand a composite panel showing:
- Code — the script Strata ran (syntax-highlighted).
- Output — what the script printed.
- Errors — anything the script wrote to its error stream (only shown if it wrote something).
- Files Produced — a list of every file the script registered, with file size.
- Timing and exit code — how long the call took, and the script's exit code.
Sandbox security
- Isolated per session. Each conversation gets its own ephemeral sandbox, scoped to your organization. The sandbox is destroyed when the session ends and rebuilt from a fresh image on the next run.
- Strict tenant boundaries. Sandbox state is keyed by tenant and session, so one organization's scripts and files can never reach another's.
- No network. Scripts cannot make outbound HTTP requests or talk to the internet. Any attempt to reach beyond the sandbox is blocked and flagged. When a run needs an extra library, the platform — not the sandbox — fetches it and installs it into the run; the code itself never gains network access.
- No host filesystem access. Scripts see only
/workspace/outputs/and/workspace/scratch/. Reading any other path raisesFileNotFoundError. - Process isolation. Each script runs in a fresh process; the only thing carried between runs is the pickled top-level state.
Resource limits
- Wall-clock timeout of 30 seconds per script. Long-running computation must be broken into multiple
run_pythoncalls. - Memory cap of 256 MB.
- Stdout cap of 50 KB; longer output is truncated. Print summaries, not raw data dumps.
If a script exceeds a limit, you see a stderr line and the step is marked as failed in the trail. Ask Strata to "split this into smaller steps" or "process the data in chunks."
Who can use analysis (admins)
Whether the AI can run an analysis is governed by a three-layer cascade — organization, then role, then individual user — where a more specific layer overrides a broader one. The effective setting decides whether run_python is offered in chat at all; when it is off, the AI simply solves the request with its other tools or explains it cannot run code.
| Layer | Where | Behavior |
|---|---|---|
| Organization | Organization → Member defaults → Rules for everyone, effective now → Analysis | The org-wide default. On unless an admin turns it off. |
| Role | Organization → Roles → (role) → Analysis | Tri-state: Inherit org default, Allowed, or Denied for everyone in the role. |
| User | Organization → Users → (manage user) → Access → Analysis | Tri-state per person: Inherit role / org, Allowed, or Denied. A user override wins over their role and the org default. |
NoteThe first non-inherited setting wins, and everything defaults to enabled. So a role set to Allowed re-enables analysis for its members even if the org default is off, and a user set to Denied loses it even when their role allows it.
These controls only decide who may run an analysis. The sandbox kill-switch and per-tenant isolation always apply on top — an operator can disable run_python platform-wide for incident response regardless of these settings.
What analysis cannot do here
- Reach the internet from your code — no
requests/urllibto external URLs. The code itself has no network. (Extra libraries are the exception: the platform fetches and installs them for a run, but your code still cannot make its own outbound calls.) - Write outside
/workspace/. - Add your organization's branding. Files your analysis writes (images, workbooks, documents) carry no logo or accent color; for a branded deliverable, ask for an Excel, Word, PowerPoint or PDF file, which Strata's document tools brand automatically.
- Spawn long-lived processes or open ports.
Examples you can try
- "Run a linear regression on this CSV and chart the fit."
- "Produce a correlation heatmap of these columns as a PNG."
- "Split this multi-sheet workbook into one file per sheet and let me download them."
- "Generate a 3-panel infographic comparing North/South/Central revenue."
What can go wrong
- Step fails with "timeout". The script ran longer than 30 seconds. Ask Strata to chunk the work or sample the data first.
- Step fails with "out of memory". A dataframe exceeded the 256 MB cap. Ask Strata to stream the file or process it in batches.
- A requested library did not install. The package name may be wrong, or it may need to compile binaries the offline sandbox cannot build. Ask Strata to try a pure-Python alternative or to solve the task with the pre-installed libraries.
- Image was generated but did not render inline. The script saved the PNG but forgot to register it with
strata_runtime.present_file(). Ask Strata to "present that file so it shows inline." - Variable lost between calls. The variable was unpicklable (an open file handle, a database cursor, a non-serializable module object). Re-create those each call; only data values persist.
Related
- Charts — when to use a
chartblock vs. an analysis - Artifacts — where HTML outputs render
- Files — uploading files for an analysis to process
- Roles and permissions — set who can run an analysis by role and per user