Skip to main content
Goal: Create a sandbox, execute code, and see the output in under 5 minutes.
Prerequisites: Python 3.8+, pip, HopX API key
Time: ~5 minutes
This quickstart gets you from zero to your first successful code execution. Follow these steps in order.

What You’ll Learn

In this quickstart, you’ll learn how to:
  • Install and verify the Python SDK
  • Set up API key authentication
  • Create a sandbox from a template
  • Execute Python code in the sandbox
  • Access execution results and output
  • Clean up sandboxes properly

Step 1: Install the SDK

Step 1.5: Verify Installation

Verify the SDK is installed correctly:
Expected output: HopX SDK 0.3.0 installed successfully

Step 2: Set Your API key

Set the HOPX_API_KEY environment variable:
Get your API key from console.hopx.dev → Settings → API Keys

Step 3: Create and Run Your First Sandbox

Create a file hello_hopx.py:
Expected Output:

Cleanup - delete the sandbox

sandbox.kill()

Expected Output

What Just Happened?

  1. Sandbox.create() - Created a new sandbox from the code-interpreter template (Python environment)
  2. sandbox.run_code() - Executed Python code in the sandbox
  3. result.stdout - Retrieved the standard output from code execution
  4. sandbox.kill() - Deleted the sandbox to free resources

Next Steps

Now that you have a working setup, explore more:

Quickstart Variations

For more advanced quickstart examples including async/await, error handling, and context managers, see the Advanced Quickstart Guide (coming soon).

Troubleshooting

“API key required” error?
  • Verify HOPX_API_KEY is set: echo $HOPX_API_KEY
  • Get your key at console.hopx.dev
“Template not found” error?
  • Use template="code-interpreter" (default Python template)
  • See Available Templates for options
Network timeout?
  • Check internet connection
  • Verify firewall allows HTTPS (port 443)
For more help, see the Troubleshooting Guide.