Overview
Run anything in secure code execution environments
Sandboxes provide an isolated environment for running arbitrary python code, or processes interactively. It also supports basic file system operations, networking, and public preview URLs.
Features
- Process Management: Execute commands and Python code with real-time output streaming
- File System Operations: Upload, download, list, and manage files inside the sandbox environment programatically
- Preview URLs: Dynamically expose ports behind SSL-terminated, authenticated endpoints
- Persistent Sessions: Keep sandboxes running indefinitely or with custom timeouts
- GPU Support: Run GPU-accelerated workloads
Quick Start
Create a sandbox, run some code, and see the results:
This creates a remote environment with NumPy and Pandas, runs a data analysis script, and returns the results to your local machine. The computation happens in the cloud, not on your laptop.
Core Features
Process Management
Run Python code, shell commands, or start long-running processes:
File System Operations
Upload local files, download results, and manage your workspace:
Dynamic Preview URLs
Expose ports to make your services accessible over the internet:
Key Concepts
SandboxInstance
When you create a sandbox, you get a SandboxInstance
class that provides:
process
: Run commands and code with real-time outputfs
: Upload, download, and manage filesexpose_port()
: Make your services accessible to the internetterminate()
: Cleanup when you’re done
Lifecycle
- Create: Configure your environment (CPU, memory, packages, etc.)
- Launch: Start the sandbox with
create()
- Use: Execute code, manage files, expose services
- Terminate: Clean up with
terminate()
(or let it auto-terminate)
What’s Next?
Now that you understand what Sandbox can do, let’s dive deeper into each capability:
- Configuration: Learn how to customize your sandbox for different use cases
- Process Management: Master running code and commands with real-time feedback
- File System Operations: Upload, download, and manage files inside your Sandbox
- Networking: Deploy web services and expose them to the internet
- Examples: See real-world patterns and workflows