> ## Documentation Index
> Fetch the complete documentation index at: https://docs.varios-ai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Code execution

> What assistants can do with code execution: calculations, data analysis, charts and files for download.

With the option **Allow code execution (for calculations and files)**, the assistant writes a Python program when needed and runs it in an isolated environment on the server of your VARIOS AI installation. This lets it calculate precisely, analyze data from uploaded files and provide results as files for download.

<Tip>
  Home page > Menu icon > All Assistants > New Assistant > Functions and files
</Tip>

The option is already enabled for new assistants. If it is disabled, the assistant does not run any code: it can then neither calculate precisely nor create files. It still reads uploaded files as text or images, but it can only search the contents of ZIP and TAR archives, not unpack them. Binary files such as `.pkl` cannot be uploaded without the option.

## What the assistant can do with it

| Task | Examples |
| - | - |
| **Calculate** | Exact results instead of estimates, statistics, financial and interest calculations, unit conversions |
| **Analyze data** | Read Excel and CSV files, filter, sort, group, merge tables, find duplicates |
| **Create charts** | Line, bar, pie and scatter charts as an image or PDF, interactive charts as an HTML file |
| **Create Office documents** | Word documents, Excel workbooks with multiple sheets and formatting, PowerPoint presentations |
| **Create and edit PDFs** | Generate reports as PDF, extract text from PDFs, merge or split PDFs, render pages as images |
| **Convert files** | Convert Word, Excel or PowerPoint to PDF, CSV to Excel, JSON to CSV |
| **Process structured data** | Parse HTML and XML, reshape JSON and YAML, search text for patterns |
| **Simple data models** | Calculate trends, regressions, clustering and classification on existing data |

### Example requests

* "Analyze the attached sales list by region and month and create a bar chart."
* "Merge the two Excel files on the customer number and highlight missing entries."
* "Turn this summary into a Word file with headings and a table."
* "Convert the attached presentation to PDF."
* "Calculate the monthly payment for €250,000 at 3.8% interest over 20 years and output the repayment schedule as an Excel file."

## Available libraries

The code runs in Python 3. The following libraries and tools are preinstalled:

| Area | Libraries and tools |
| - | - |
| **Data analysis and mathematics** | NumPy, pandas, SciPy, scikit-learn |
| **Charts** | Matplotlib, seaborn, Plotly |
| **Excel** | openpyxl, pandas |
| **Word** | python-docx |
| **PowerPoint** | python-pptx |
| **Create PDFs** | WeasyPrint (from HTML), ReportLab, fpdf2 |
| **Read and edit PDFs** | pypdf, pdf2image with Poppler |
| **Convert Office files** | LibreOffice Writer, Calc and Impress (without user interface) |
| **HTML and XML** | Beautiful Soup, lxml |
| **Data formats** | PyYAML, toml, jsonlines, csvkit |
| **Databases** | SQLAlchemy and SQLite for local database files |

The Python standard library is available as well. For charts and documents, fonts are installed that are metric-compatible with Arial, Times New Roman, Courier New, Calibri and Cambria, plus Noto for special characters and other writing systems. This keeps the layout of Office files largely intact when they are converted to PDF.

Additional libraries cannot be installed during execution.

## Files in the chat

* **Input**: Files uploaded to the chat or created there earlier are available to the program under their names, including subfolders. Supported formats include text, CSV, JSON, XML, HTML and Markdown files, PDFs, Word, Excel and PowerPoint files, images (PNG, JPEG, GIF), ZIP and TAR archives, and source code. The selected AI model additionally determines which file types may be uploaded.
* **Output**: Files the program creates appear in the answer as a download link and in the chat's **Files** panel. If the assistant creates a file with a name that already exists, it is saved as a new version of that file.

## Security and limits

* **Isolated execution**: Each execution runs in its own short-lived container on the server of your VARIOS AI installation. Your files are not sent to external services for this.
* **No internet access**: The code cannot reach websites, APIs or external databases. To access external systems, use [connectors](./create-an-assistant#connectors).
* **No memory between executions**: Variables and intermediate results are lost after each execution. Only the files in the chat are kept.

Resource limits also apply. The operator of your installation can adjust the following default values:

| Limit | Default value |
| - | - |
| Run time per execution | 60 seconds |
| Memory | 512 MB |
| Computing power | 1 CPU core |
| Input files | about 12 MB in total, at most 20 files |
| Result files | at most 10 MB per file, at most 30 files per execution |

## Troubleshooting

<AccordionGroup>
  <Accordion title="The assistant only replies with text and does not create a file">
    Check whether the option **Allow code execution (for calculations and files)** is enabled under **Functions and files** in the assistant's settings. If the option is enabled and code is still never executed, code execution may not be set up on your installation. In this case, contact your administrator.
  </Accordion>

  <Accordion title="The execution stops or runs out of time">
    The task exceeds the run time or memory limit. Split the task into smaller steps or reduce the amount of data, for example by filtering to the relevant period.
  </Accordion>

  <Accordion title="An uploaded file is not taken into account">
    Check whether the selected AI model allows the file type and whether the input files together exceed the size limit.
  </Accordion>

  <Accordion title="Websites or interfaces cannot be accessed">
    Code execution has no internet access. Connect external data sources via connectors or upload the data to the chat as a file.
  </Accordion>
</AccordionGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.