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
import pandas as pd; df = pd.read_excel('file.xlsx'); print(df['Revenue'].mean()).pandas, numpy, matplotlib, openpyxl) – no pip install at the start of a session.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, you receive the edited .xlsx as a download |
| Charts from data | Only simple text diagrams (Mermaid) | Real PNG charts via matplotlib or plotly |
| 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 download link 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: Falkenstein, Germany (Hetzner), fully EU-hosted
- Lifetime: Each sandbox is deleted after use, fresh for the next request
- 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), Office/PDF files (openpyxl,python-docx,python-pptx,pdfplumber,PyMuPDF,reportlab), images and OCR (Pillow,pytesseract); for Node incl. SheetJS (xlsx),pdfkit,docx,pptxgenjs
Current methods
When the Code Sandbox connector is attached to an assistant, the following methods are available:
sandbox-create-session: start a new sandbox sessionsandbox-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-list-files: list workspace contentssandbox-execute-command: execute a command inside the sandbox
Limits
- No persistence: the sandbox is deleted after the request; data does not survive across sessions
- Split complex workflows: very long compute pipelines are better expressed as multiple smaller steps than one monolithic call
- No outbound internet from inside the sandbox: external APIs are reached via connectors or skills, not from the code itself
Frequent questions
Where to go next
- Excel: the Excel agent uses the Code Sandbox under the hood
- Skills: your own code packages with libraries and external API access
- Assistants: how to attach the Code Sandbox to an assistant as a tool