> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hopx.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Get your first sandbox running in minutes with the HopX Python SDK - install, authenticate, execute code, see results. Complete quickstart guide for creating sandboxes, running Python code, managing files, and cleaning up resources. Perfect for developers new to HopX. Includes step-by-step examples and best practices.

**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

```bash theme={null}
pip install hopx-ai
```

## Step 1.5: Verify Installation

Verify the SDK is installed correctly:

```bash theme={null}
python -c "import hopx_ai; print(f'HopX SDK {hopx_ai.__version__} installed successfully')"
```

Expected output: `HopX SDK 0.3.0 installed successfully`

## Step 2: Set Your API key

Set the `HOPX_API_KEY` environment variable:

```bash theme={null}
# Linux/macOS
export HOPX_API_KEY="your-api-key-here"

# Windows (PowerShell)
$env:HOPX_API_KEY="your-api-key-here"
```

<Note>
  Get your API key from [console.hopx.dev](https://console.hopx.dev) → Settings → API Keys
</Note>

## Step 3: Create and Run Your First Sandbox

Create a file `hello_hopx.py`:

```python theme={null}
from hopx_ai import Sandbox

# Create a sandbox (~100ms)
sandbox = Sandbox.create(template="code-interpreter")

# Execute code in the sandbox
result = sandbox.run_code('print("Hello from HopX!")')

# Print the output
print(result.stdout)
```

**Expected Output:**

```
Hello from HopX!
```

# Cleanup - delete the sandbox

sandbox.kill()

````

## Step 4: Run It

```bash
python hello_hopx.py
````

## Expected Output

```
Hello from HopX!
```

<Success>
  🎉 **Success!** You've created your first sandbox and executed code. The sandbox was automatically cleaned up after execution.
</Success>

## 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

## Related

* **[API Quickstart](/api/quickstart)** - Get started with the API
* **[Sandbox Class Reference](/sdk/python/sandbox)** - Complete SDK reference
* **[Creating Sandboxes](/core-concepts/sandboxes/creating)** - Learn more about sandbox creation
* **[Code Execution](/core-concepts/code-execution/synchronous)** - Understand code execution

## Next Steps

Now that you have a working setup, explore more:

* **[Creating Sandboxes](/core-concepts/sandboxes/creating)** - Learn about different templates and options
* **[Code Execution](/core-concepts/code-execution/synchronous)** - Run Python, JavaScript, Bash, and more
* **[File Operations](/core-concepts/filesystem/reading)** - Read, write, and manage files in sandboxes
* **[CLI Quickstart](/cli/quickstart)** - Use HopX from the command line
* **[API Reference](/sdk/python/sandbox)** - Complete SDK documentation

## Quickstart Variations

<Note>
  For more advanced quickstart examples including async/await, error handling, and context managers, see the [Advanced Quickstart Guide](/sdk/python/advanced-quickstart) (coming soon).
</Note>

## Troubleshooting

**"API key required" error?**

* Verify `HOPX_API_KEY` is set: `echo $HOPX_API_KEY`
* Get your key at [console.hopx.dev](https://console.hopx.dev)

**"Template not found" error?**

* Use `template="code-interpreter"` (default Python template)
* See [Available Templates](/core-concepts/templates/listing) for options

**Network timeout?**

* Check internet connection
* Verify firewall allows HTTPS (port 443)

For more help, see the [Troubleshooting Guide](/sdk/python/troubleshooting).
