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

# Python Code Execution Toolkit

> Execute Python code in secure sandbox with file uploads and analysis

Configure Python sandbox for code execution, file uploads, and analysis reports. Each chat session uses an isolated sandbox; uploaded files are sandboxed; sandboxes are cleaned after the session ends.

<img src="https://mintcdn.com/odinai/JI14YIDoIJKTxHdQ/img/agents-toolkits/19.jpg?fit=max&auto=format&n=JI14YIDoIJKTxHdQ&q=85&s=84a8491b1c03d7bdc6564be00c213a6d" alt="Python Code Execution configuration with security info and tool selection" width="1280" height="630" data-path="img/agents-toolkits/19.jpg" />

## Available Tools (5/5)

* **Execute Code**: Run Python code in secure sandbox (Enabled, Require Confirmation).
* **Search Files**: Search for files in the sandbox environment.
* **Upload File**: Upload files to the sandbox for processing.
* **List Files**: Show all files currently in the sandbox.
* **Create Download URL**: Generate download links for files created in the sandbox.

## Installing External Libraries

<img src="https://mintcdn.com/odinai/OEGLjTGYK0dzh8aJ/img/agents-toolkits/python.png?fit=max&auto=format&n=OEGLjTGYK0dzh8aJ&q=85&s=30785675e8c6d3222d1543a33dfc7f2b" alt="Installing PyMuPDF library in Python sandbox" width="2586" height="1446" data-path="img/agents-toolkits/python.png" />

*Example: Installing PyMuPDF library in Python sandbox*

If you want to install any external library that you want the agent to install and use, you can include the installation command in your code. For example, if you want the agent to install PyMuPDF, you should do it as shown below:

```python theme={null}
# Install PyMuPDF library
subprocess.check_call([sys.executable, "-m", "pip", "install", "PyMuPDF"])
```

**Note:** Before executing your code, you must execute the installation command shown above. The library installation is performed using `subprocess.check_call()` with the proper syntax for pip installation.

## Use Cases

* **Data Analysis**: Process CSV/Excel files, perform statistical analysis, generate reports.
* **Visualization**: Create charts and graphs from data.
* **Mathematical Computation**: Solve equations and perform calculations.
* **File Processing**: Transform data formats, merge datasets, clean data.
* **Automation**: Execute repetitive data processing tasks.
