Skip to main content

Overview

Run code in secure, isolated sandbox environments with full access to files, package management, and external APIs. Perfect for dynamic code execution, data processing, and automation tasks.

Isolated Execution

Run code in secure containerized environments

Multiple Languages

Support for Python, Node.js, and more

File System Access

Read, write, and manage files

External APIs

Make HTTP requests from sandbox

What is a Sandbox?

A sandbox is an isolated execution environment where you can:
  • Execute arbitrary code safely
  • Install and use packages
  • Access file systems
  • Make external API calls
  • Process data without affecting other workflows
Each sandbox execution is isolated and cleaned up after completion.

Available Actions

Code Execution

Run code in the sandbox environment.Parameters:
  • language - Programming language (python, nodejs, bash)
  • code - Code to execute
  • timeout - Execution timeout in seconds (default: 30, max: 300)
  • packages - Array of packages to install
  • env - Environment variables
  • stdin - Standard input data
Returns:
  • stdout - Standard output
  • stderr - Standard error
  • exit_code - Exit code
  • execution_time - Time taken to execute
  • files - Created files (if any)
Example - Python:Example - Node.js:Example - Bash:

File Management

Read contents of a file from the sandbox.Parameters:
  • path - File path in sandbox
  • encoding - File encoding (default: utf-8)
  • start_line - Starting line number (optional)
  • num_lines - Number of lines to read (optional)
  • max_kb - Maximum KB to read (default: 8, max: 32)
Returns:
  • content - File contents
  • size - File size in bytes
  • lines - Total lines (if text file)
Write content to a file in the sandbox.Parameters:
  • path - File path to write
  • content - Content to write
  • mode - File permissions (default: 0644)
Returns:
  • success - Write success status
  • path - Written file path
  • size - Written bytes
List files and directories in the sandbox.Parameters:
  • path - Directory path (default: /workspace)
  • recursive - Include subdirectories (default: false)
  • pattern - Filename pattern filter (glob)
Returns:
  • files - Array of file objects
    • name - File name
    • path - Full path
    • size - File size
    • type - File or directory
    • modified - Last modified time
Delete a file or directory from the sandbox.Parameters:
  • path - File/directory path to remove
  • recursive - Remove directories recursively (default: false)
Returns:
  • success - Deletion success status
Create a directory in the sandbox.Parameters:
  • path - Directory path to create
  • parents - Create parent directories (default: true)
  • mode - Directory permissions (default: 0755)
Returns:
  • success - Creation success status
  • path - Created directory path

Advanced Features

Upload files from sandbox directly to S3.Parameters:
  • files - Array of file objects
    • remote_path - Path in sandbox
    • filename - Custom filename (optional)
    • content_type - MIME type (optional)
Returns:
  • uploads - Array of uploaded file objects
    • url - S3 URL
    • filename - Uploaded filename
    • size - File size
Get the unique URL for the sandbox session.Returns:
  • url - Sandbox session URL
  • session_id - Unique session identifier
  • expires_at - Session expiration time
Make HTTP requests from within the sandbox.Parameters:
  • method - HTTP method (GET, POST, etc.)
  • url - Request URL
  • headers - Request headers
  • body - Request body
  • timeout - Request timeout
Returns:
  • status_code - HTTP status code
  • body - Response body
  • headers - Response headers
Quickly edit files using AI-powered code transformation.Parameters:
  • target_file - File path to edit
  • instructions - Edit instructions
  • code_edit - Code changes to apply
Returns:
  • success - Edit success status
  • message - Edit confirmation
Edit large files with AI-powered transformations.Parameters:
  • target_file - File path to edit
  • instructions - Detailed edit instructions
  • code_edit - Code changes with context
Returns:
  • success - Edit success status
  • message - Edit confirmation
  • usage - Token usage statistics

Language Support

Python

Pre-installed Packages:
  • numpy, pandas, scipy
  • requests, aiohttp
  • beautifulsoup4, lxml
  • pillow, opencv-python
  • matplotlib, seaborn
  • scikit-learn, tensorflow (CPU)
  • And more…
Custom Packages:

Node.js

Pre-installed Packages:
  • axios, node-fetch
  • lodash, moment
  • express, fastify
  • And more…
Custom Packages:

Bash

Available Commands:
  • Standard Unix utilities (grep, sed, awk, etc.)
  • curl, wget
  • jq (JSON processing)
  • git
  • And more…

Environment Variables

Access workflow variables in sandbox code:

File System Structure

/workspace/           # Main working directory
  ├── input/         # Input files
  ├── output/        # Output files
  ├── temp/          # Temporary files
  └── [your files]   # Your created files

/tmp/                # Temporary storage

Best Practices

Timeout Management

Set appropriate timeouts for long-running tasks

Error Handling

Catch and handle errors in your code

Resource Cleanup

Remove temporary files after use

Package Management

Only install necessary packages

Security

Never expose sensitive data in logs

Optimization

Optimize code for sandbox limits

Limitations

  • Execution Time: Maximum 5 minutes per execution
  • Memory: 2GB RAM per sandbox
  • Disk Space: 10GB per sandbox
  • Network: Outbound requests allowed, no inbound
  • Concurrent: Maximum 10 concurrent sandboxes
Enterprise: Contact us for higher limits and dedicated resources.

Troubleshooting

Causes:
  • Code execution too slow
  • Infinite loops
  • Large file processing
Solutions:
  • Increase timeout parameter
  • Optimize code
  • Break into smaller tasks
Causes:
  • Loading large datasets
  • Memory leaks
  • Too many objects in memory
Solutions:
  • Process data in chunks
  • Free unused variables
  • Use generators/streams
Causes:
  • Package doesn’t exist
  • Dependency conflicts
  • Network issues
Solutions:
  • Verify package name
  • Use specific versions
  • Pre-install common packages
Causes:
  • Wrong file path
  • File not created yet
  • Permission issues
Solutions:
  • Use absolute paths
  • Check file creation
  • Verify permissions

Next Steps