Type
pythonVariants
Restricted Imports, Full Access
Common Use Cases
Data processing and analysisParse, transform, and analyze data with Python libraries
Running Python scriptsExecute automation scripts, data pipelines, and workflows
API integrationsCall external APIs using requests, handle OAuth, process responses
Custom business logicImplement complex algorithms and domain-specific operations
Variants Overview
| Variant | Security | Key Permissions | Best For | Create Command |
|---|---|---|---|---|
| Restricted Imports 🟢 | Safe | Standard library modules only | Data processing, safe scripting | --variant restricted_imports |
| Full Access 🔴 | Unrestricted | All modules, third-party packages | Data science, ML workflows | --variant full_access |
Configuration
Example Configuration:📋 Full Configuration Reference
📋 Full Configuration Reference
| Parameter | Type | Default | Description |
|---|---|---|---|
allowed_imports | array | variant-specific | Whitelist of allowed Python modules |
timeout | number | 120 | Execution timeout in seconds |
max_memory | string | ”512MB” | Memory limit for Python process |
max_output_size | string | ”10MB” | Maximum output capture size |
working_directory | string | ”/“ | Execution directory |
environment_variables | object | Custom environment variables |
⚙️ Variant-Specific Defaults
⚙️ Variant-Specific Defaults
Restricted Imports:
allowed_imports: Standard library safe modules (json, csv, datetime, re, math, collections, itertools, etc.)- Network and shell access modules blocked
allowed_imports: [”*”] (all modules)- Third-party packages allowed
- Higher default limits:
max_memory: "2GB",timeout: 600
Quick Start
View Complete Examples
See full data analysis patterns, API integration workflows, and ML pipeline configurations
Python Code Execution
Inline Code Example
Agents can execute Python code directly:Script Execution
Agents can run Python scripts from the filesystem:Installing Additional Packages
For agents that need third-party packages, install them on the worker:Package Management: Packages must be installed on the worker system before agents can import them. Coordinate with your infrastructure team for package deployment.
Security Best Practices
Whitelist Required Imports Only
Whitelist Required Imports Only
Only allow the specific Python modules your agent needs.
Set Memory Limits
Set Memory Limits
Always configure
max_memory to prevent resource exhaustion.Configure Timeouts
Configure Timeouts
Set reasonable timeouts to prevent infinite loops.
Troubleshooting & Related Skills
Import Error: Module Not Allowed
Import Error: Module Not Allowed
Solutions:
- Add module to
allowed_importsin configuration - Verify module name exactly matches Python import (e.g.,
urllib.parsenoturllib) - Consider upgrading to Full Access variant if appropriate
Module Not Found
Module Not Found
Solutions:
- Verify package is installed on worker:
pip list | grep package-name - Ensure
PYTHONPATHincludes package location - Install missing package:
pip install package-name
Memory Limit Exceeded
Memory Limit Exceeded
Solutions:
- Increase
max_memoryin configuration - Optimize script to use less memory (streaming, generators)
- Process data in smaller batches