Code Sandbox
Isolated Python and JavaScript execution for file analysis, transformations, and computations (secure, deleted after use, EU-hosted).
The Code Sandbox is a built-in tool that lets an assistant run real code (Python or JavaScript) instead of just generating text answers. It's especially relevant for tasks the model alone can't reliably handle: exact calculations, processing of Excel/CSV files, file generation.
Why a sandbox?
A language model like GPT or Claude is at its core a text generator: it reads and writes text. Three things it can't reliably do on its own, but that come up constantly in real work:
- Read binary files: an
.xlsxfile is not text, it's a binary format. The model only sees what was extracted as text beforehand. - Calculate reliably: for larger multiplications or multi-step computations, the model can miscalculate, because it "guesses" numbers based on probability.
- Complex data analysis: pivots, filters, aggregations across thousands of rows are simply impossible with text processing alone.
The sandbox solves this by giving the model its own small computer. Instead of estimating the answer textually, the model writes Python code that runs on this machine and returns the real result.
How a sandbox call flows
File upload: You upload a file to the chat (e.g. an Excel sheet, a CSV, a Python script).
Task recognition: The assistant detects from your question that the file needs to be processed directly.
File loaded into the sandbox: The original file (not just extracted text) is copied into the sandbox workspace.
Code generation: The assistant writes Python code that solves the task, e.g. import pandas as pd; df = pd.read_excel('file.xlsx'); print(df['Revenue'].mean()).
Execution: The code runs in the isolated environment. The common libraries are preinstalled (incl. pandas, numpy, matplotlib, openpyxl) – no pip install at the start of a session.
Result back: You get the result in chat, plus optionally generated files (e.g. a modified .docx or a PNG chart) as a file card with preview and download actions, if the format supports preview. Excel files (.xlsx) have no classic preview: the card offers Open in editor (view and edit the spreadsheet in the right-hand panel) and the download instead. ZIP archives can only be downloaded.
Note
Spreadsheets in the editor: The editor view is an on-screen browser view and uses neither MeinGPT's language setting nor your regional settings. Numbers and dates therefore appear in US format there (e.g. 1,234.56 or 12/31/2026), even though the file itself is unchanged. Edits made in the editor stay on your device only – to keep them, use the download button inside the editor. The file card's download button in the chat always returns the original, unedited file. In Excel, your Windows or Mac regional settings apply again.
If dates still look wrong in Excel, they were written as text rather than as real dates. Ask the assistant to create real number and date values with the format DD.MM.YYYY (dates) and thousands separator dot / decimal comma (numbers). To make this permanent, add it to your own system prompt under Preferences or to your assistant's instructions.
Note
Images, screenshots, and individual PDF pages are recognized natively – the model sees the image content directly instead of guessing it via OCR. You can also hand multiple files to the sandbox in a single step.
With sandbox vs. without sandbox
| Use case | Without sandbox | With sandbox |
|---|---|---|
| Excel analysis ("Compute the average of the Revenue column") | Model guesses the numbers, often inaccurate | Python reads the file and calculates exactly |
| Edit Excel ("Add a margin column") | Not possible: the model can't write a file back | The file is modified, formatting and formulas are preserved, you receive the edited .xlsx as a download |
| Charts from data | Only simple text diagrams (Mermaid) | Real PNG charts via matplotlib |
| Run code | Model can show the code but not execute it | Code is run, output comes back |
| Large tables (50,000+ rows) | Doesn't fit in the model's context | Python handles arbitrarily large files |
What you see in the chat
From a user perspective, this all happens automatically. You see:
- A short loading indicator while the sandbox starts and the code runs (typically seconds, for complex analysis 10–30 seconds)
- Optionally a display of the executed code: depending on the workspace setting
- The result as text in the chat or as a file card with preview and download actions for generated files
- On errors, an error message; the assistant often tries an alternative approach automatically
Security and hosting
The sandbox is an isolated virtual machine: code running inside it has no access to other customer data, the internet, or the MeinGPT system. Even if faulty or malicious code were executed, it could do no damage outside the sandbox.
- Hosting: Frankfurt, Germany (Unikraft Cloud), isolated EU cloud setup
- Lifetime: A sandbox session is bound to your chat. Within the session, files remain in the workspace — across multiple tool calls and messages. When idle, the VM pauses (scale-to-zero); the attached volume keeps the files until the session ends
- Important: The sandbox session is bound to the chat, but not available over long periods. If you keep working in the same chat over multiple days, the session can be automatically terminated in between (e.g. after a longer period of inactivity) — in that case the volume holding the workspace files is also deleted, and your next message starts a new, empty sandbox. There is currently no warning in the chat before this happens. For multi-day projects with intermediate results, we recommend downloading important intermediate files regularly rather than relying on the workspace persisting across multiple days.
- Data flow: Original files are temporarily loaded into the sandbox for processing and deleted immediately after execution. For on-premise customers it's important to note that sandbox processing happens in the cloud
- Internet access: disabled by default
- Script libraries: a broad stack is preinstalled (no
pip installneeded). Python for data analysis (pandas,numpy,matplotlib,pyarrow), Excel editing and creation (openpyxl,XlsxWriter), PDF (PyMuPDF,pdfplumber,pypdf,PyPDF2,pdfminer.six,pdf2image,reportlab,fpdf2), Office documents (python-docx,python-pptx), web/HTML (requests,beautifulsoup4,lxml,flask), images (Pillow; OCR viapytesseractas a fallback); for Node incl. SheetJS (xlsx),pdfkit,docx,pptxgenjsplus ZIP operations (archiver,unzipper) - Built-in Office skills: for
.xlsx,.docx, and.pptx, MeinGPT ships its own skills — the assistant gets not just the libraries but also the right approach hints (e.g. "preserve formatting when editing, work with styles when generating"). When the sandbox is active in the chat, the AI loads them automatically when a task matches
Current methods
When the Code Sandbox connector is attached to an assistant, the following methods are available. A sandbox session is created implicitly on the first tool call in a chat (matching runtime: Python or Node); there is no separate "start session" method.
sandbox-write-file: write a chat file into the sandboxsandbox-upload-file: upload an external filesandbox-download-file: fetch a generated file back into the chatsandbox-view-file: let the model look at an image or PDF page from the workspace directly (instead of OCR)sandbox-read-file: read a text file from the workspace with line-level offset/limitsandbox-execute-command: execute a command inside the sandbox
There is no separate method for skills: MeinGPT provides them in the sandbox automatically (see the next section).
Skills with scripts
Skills that consist of instructions only don't need the sandbox. If a skill contains a scripts/ folder or binary files (e.g. a Word template), the AI runs it in the sandbox:
- Provided automatically: once the AI has loaded such a skill in the chat, it was selected, or it is set to Always on on the assistant, MeinGPT provides it in the session before the next sandbox command – in exactly the version active in the chat, in a folder of its own for each version. After a sandbox restart this happens again.
- Dependencies: packages from a
requirements.txt(Python) orpackage.json(Node) in the skill are installed automatically when it is provided, for that skill only. - Results: files a script creates land in the sandbox workspace and come back to the chat as a file card.
- Without the sandbox: if the Code Sandbox is turned off in the workspace, the skill library shows Instructions only without sandbox for such skills – the AI then uses only the instructions and doesn't run any scripts.
The AI creates new skills in the chat through the skills tool (e.g. via Create skill → Create with AI in the skill library), independently of the sandbox.
Limits
- Session-bound: The workspace belongs to your chat. If you start a new chat, the sandbox begins fresh — files from another chat aren't available there
- Time limit per execution: A single sandbox command (e.g. via
sandbox-execute-command) runs for up to 2 minutes by default, and 5 minutes maximum in any case. If a command isn't done by then, it's cancelled and reported as failed - Split complex workflows: For very long compute pipelines — like generating a full interactive HTML dashboard from a large Excel file in one step — break the task into smaller steps (prepare data → compute chart data → assemble HTML) instead of one giant call. This also keeps you safely under the per-execution time limit above
- Limited memory: each sandbox VM currently has 1 GB of RAM. Memory-intensive operations on very large tables — such as generating a PDF from a large data table — can fail as a result. If that happens, reduce the data volume first (e.g. filter columns/rows) or split the task into smaller steps
- No outbound internet access from the sandbox: external services are connected via connectors or the Bridge, not directly from code
- Base image ships without
curl; theapt-getindex is empty untilapt-get update: The preinstalled libraries (see Security and hosting) cover the common file workflows; beyond that, the base image is intentionally minimal.curlisn't preinstalled, for example, and theapt-getpackage index is empty until you explicitly runapt-get update. Largerapt-get installoperations can hit the 1 GB RAM limit and leavedpkgin an incomplete state that needs a manualdpkg --configure -abefore further installs will work
Frequent questions
Why does a sandbox response take longer than a regular chat answer?
The sandbox needs to start, code needs to be written and executed. That's more work than plain text generation. Complex analyses take 10–30 seconds, that's normal.
Why is the result sometimes still wrong?
The assistant writes the code. If it misinterprets the data structure or picks the wrong approach, the result can be wrong. Tip: spot-check the result, and when in doubt, sharpen the prompt with concrete constraints (e.g. "filtered on column X = Y").
Which file types work reliably?
Excel (.xlsx, .xls), CSV, and Python scripts generally work reliably for simple to moderately complex spreadsheets. For macro-enabled workbooks (.xlsm), very large named ranges, deeply nested formula chains, or workbooks with many linked helper sheets, automatic extraction can miss or truncate individual tables, factors, or conditions – the preinstalled libraries (openpyxl, XlsxWriter) do not execute or interpret VBA macros themselves. For business-critical calculations, we recommend spot-checking the result against the original file before using it in production. PDF and Word can be parsed with the preinstalled libraries; heavily formatted documents may leave gaps. The same goes in reverse for generation: when a skill fills a Word template, the text follows the template's existing styles – exact adherence to your brand guidelines isn't automatically checked, so spot-checking the result before sending it is recommended. The template also needs to be a plain .docx file – the skill cannot open macro-enabled .docm files, and in that case generates a new document from scratch instead of filling the actual template. Images, screenshots, and individual PDF pages are recognized by the model natively — even scanned or photographed PDFs are looked at directly by the model (sandbox-view-file), which usually beats classic OCR. pytesseract is available as a fallback for purely text-heavy scans.
Is this GDPR-compliant?
Yes. The sandbox is isolated (no access to other data), runs in Frankfurt/Germany (Unikraft Cloud), and is released when your chat session ends. Original files are temporarily loaded into the sandbox. If that matters for your compliance setup, get in touch and we'll walk through the data flow in detail.
Where to go next
- Skills: reusable instructions, optionally with scripts that run in the sandbox
- Assistants: how to attach the Code Sandbox to an assistant as a tool