What You’ll Learn
In this quickstart, you’ll learn how to:- Install and set up the HopX SDK (Python or JavaScript) or CLI
- Create your first sandbox from a pre-built template
- Execute code in multiple languages (Python, JavaScript, Bash, Go)
- Work with files in sandboxes (read, write, list)
- Clean up sandboxes to free resources
- Use context managers for automatic cleanup (Python)
Prerequisites
- HopX API key (get one here if you don’t have it)
- Python 3.8+ or Node.js 18+ or CLI installed
- Basic experience with Python, JavaScript, or command line
Run your first sandbox
Choose your preferred method: Python SDK, JavaScript SDK, or CLI. This guide focuses on SDKs. For CLI, see the CLI Quickstart.1
Install the SDK or CLI
Install the HopX SDK for your preferred language, or use the CLI:
- Python
- JavaScript
- CLI
2
Create Your First Sandbox
Create a sandbox using a pre-built template. Templates provide pre-configured environments with common tools and packages.Expected Output:
- Python
- JavaScript
You can also use
Sandbox.create() without specifying an API key if you set the HOPX_API_KEY environment variable.3
Execute Code
Run code in your sandbox.
- Python
- JavaScript
The
run_code() method automatically captures rich outputs like matplotlib plots and pandas DataFrames. See Rich Output Capture for more details.The sandbox will execute code written in any language as long as the template you use provides the necessary dependencies.
See the Getting Template Details page for information on available templates and their environments, alternatively create your own template with the Building Templates guide.
See the Getting Template Details page for information on available templates and their environments, alternatively create your own template with the Building Templates guide.
4
Work with Files
Upload, read, and write files in your sandbox:Expected Output:
- Python
- JavaScript
5
Clean Up
Always clean up your sandbox when you’re done to free resources:Expected Output:
- Python
- JavaScript
Using Context Managers (Python)
Python SDK supports context managers for automatic cleanup:Complete Example
Here’s a complete example that brings it all together:- Python
- JavaScript
Related
- Python SDK Quickstart - Detailed Python SDK guide
- JavaScript SDK Quickstart - Detailed JavaScript SDK guide
- CLI Quickstart - Command-line interface quickstart
- API Quickstart - API-based quickstart
- Creating Sandboxes - Learn more about sandbox creation
- Code Execution - Learn about code execution
Next Steps
Now that you’ve created your first sandbox, explore more:- Learn about sandbox lifecycle: Creating Sandboxes
- Execute code in different ways: Code Execution
- Work with templates: Templates
- Integrate with MCP: MCP Integration
- Explore the SDK: Python SDK Reference or JavaScript SDK Reference
- Use the CLI: CLI Reference - Command-line interface for HopX
- Check supported languages: Supported Languages

