Documentation Index Fetch the complete documentation index at: https://mintlify.com/alibaba/OpenSandbox/llms.txt
Use this file to discover all available pages before exploring further.
OpenSandbox provides SDKs for multiple programming languages, enabling you to create, manage, and interact with secure sandbox environments from your preferred language.
Available SDKs
Sandbox SDKs
Low-level SDKs for direct sandbox interaction:
Python Full async/sync support with comprehensive file and command APIs
JavaScript/TypeScript Modern TypeScript SDK with Node.js and browser support
Kotlin/Java Type-safe JVM SDK with builder pattern and try-with-resources
C#/.NET IAsyncDisposable SDK supporting .NET Standard 2.0+
Code Interpreter SDK
Code Interpreter High-level SDK for executing Python, Java, Go, TypeScript code with state persistence
Choosing the Right SDK
Use Sandbox SDKs when you need:
Direct control over sandbox lifecycle (create, pause, resume, kill)
File system operations (read, write, search, delete)
Command execution with streaming output
Network endpoint management
Custom health checks and resource monitoring
Administrative tasks (listing/managing multiple sandboxes)
Use Code Interpreter SDK when you need:
Code execution in multiple languages (Python, Java, Go, TypeScript)
State persistence across executions (variables/imports retained)
Multi-language contexts in a single sandbox
Simplified API for running code snippets
Pre-configured runtime environments
SDK Comparison
Feature Python JavaScript Kotlin C# Code Interpreter Async/Await ✅ ✅ ❌ ✅ ✅ Sync API ✅ ❌ ✅ ❌ ✅ Streaming ✅ ✅ ✅ ✅ ✅ File Ops ✅ ✅ ✅ ✅ Via Sandbox Browser Support ❌ ✅* ❌ ❌ ❌ Multi-language Execution ❌ ❌ ❌ ❌ ✅ State Persistence Manual Manual Manual Manual ✅
*Browser support with limitations (no streaming file uploads)
Common Capabilities
All Sandbox SDKs share these core capabilities:
Lifecycle Management
Python
JavaScript
Kotlin
C#
# Create with timeout
sandbox = await Sandbox.create(
"ubuntu" ,
connection_config = config,
timeout = timedelta( minutes = 30 )
)
# Renew expiration
await sandbox.renew(timedelta( minutes = 30 ))
# Pause/Resume
await sandbox.pause()
resumed = await Sandbox.resume(
sandbox_id = sandbox.id,
connection_config = config
)
// Create with timeout
const sandbox = await Sandbox . create ({
connectionConfig: config ,
image: "ubuntu" ,
timeoutSeconds: 30 * 60
});
// Renew expiration
await sandbox . renew ( 30 * 60 );
// Pause/Resume
await sandbox . pause ();
const resumed = await sandbox . resume ();
// Create with timeout
Sandbox sandbox = Sandbox . builder ()
. connectionConfig (config)
. image ( "ubuntu" )
. timeout ( Duration . ofMinutes ( 30 ))
. build ();
// Renew expiration
sandbox . renew ( Duration . ofMinutes ( 30 ));
// Pause/Resume
sandbox . pause ();
sandbox . resume ();
// Create with timeout
var sandbox = await Sandbox . CreateAsync ( new SandboxCreateOptions
{
ConnectionConfig = config ,
Image = "ubuntu" ,
TimeoutSeconds = 30 * 60
});
// Renew expiration
await sandbox . RenewAsync ( 30 * 60 );
// Pause/Resume
await sandbox . PauseAsync ();
var resumed = await sandbox . ResumeAsync ();
Command Execution
Python
JavaScript
Kotlin
C#
execution = await sandbox.commands.run( "echo 'Hello!'" )
print (execution.logs.stdout[ 0 ].text)
const execution = await sandbox . commands . run ( "echo 'Hello!'" );
console . log ( execution . logs . stdout [ 0 ]?. text );
Execution execution = sandbox . commands (). run ( "echo 'Hello!'" );
System . out . println ( execution . getLogs (). getStdout (). get ( 0 ). getText ());
var execution = await sandbox . Commands . RunAsync ( "echo 'Hello!'" );
Console . WriteLine ( execution . Logs . Stdout . FirstOrDefault () ? . Text );
File Operations
Python
JavaScript
Kotlin
C#
# Write
await sandbox.files.write_files([
WriteEntry( path = "/tmp/file.txt" , data = "content" , mode = 644 )
])
# Read
content = await sandbox.files.read_file( "/tmp/file.txt" )
# Search
files = await sandbox.files.search(
SearchEntry( path = "/tmp" , pattern = "*.txt" )
)
// Write
await sandbox . files . writeFiles ([
{ path: "/tmp/file.txt" , data: "content" , mode: 644 }
]);
// Read
const content = await sandbox . files . readFile ( "/tmp/file.txt" );
// Search
const files = await sandbox . files . search ({
path: "/tmp" ,
pattern: "*.txt"
});
// Write
sandbox . files (). write ( List . of (
WriteEntry . builder ()
. path ( "/tmp/file.txt" )
. data ( "content" )
. mode ( 644 )
. build ()
));
// Read
String content = sandbox . files (). readFile ( "/tmp/file.txt" , "UTF-8" , null );
// Search
List < EntryInfo > files = sandbox . files (). search (
SearchEntry . builder ()
. path ( "/tmp" )
. pattern ( "*.txt" )
. build ()
);
// Write
await sandbox . Files . WriteFilesAsync ( new [] {
new WriteEntry { Path = "/tmp/file.txt" , Data = "content" , Mode = 644 }
});
// Read
var content = await sandbox . Files . ReadFileAsync ( "/tmp/file.txt" );
// Search
var files = await sandbox . Files . SearchAsync (
new SearchEntry { Path = "/tmp" , Pattern = "*.txt" }
);
Installation
Choose your language to get started:
Python
JavaScript
Kotlin
C#
# Sandbox SDK
pip install opensandbox
# Code Interpreter SDK
pip install opensandbox-code-interpreter
npm install @alibaba-group/opensandbox
// Gradle (Kotlin DSL)
dependencies {
implementation ( "com.alibaba.opensandbox:sandbox:{version}" )
}
dotnet add package Alibaba.OpenSandbox
Next Steps
Quick Start Get started with your first sandbox in 5 minutes
API Reference Explore detailed API documentation
Examples Browse code examples and use cases
Configuration Learn about connection and sandbox configuration