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

# Sandbox SDK (Python)

> Python SDK usage for creating and managing sandboxes.

# Sandbox SDK (Python)

Use the Python SDK to create sandboxes, execute commands, and manage files.

## Install

```bash theme={null}
pip install stateset-sandbox
```

## Initialize the Client

```python theme={null}
from stateset_sandbox import SandboxClient

client = SandboxClient(
    base_url="https://api.sandbox.stateset.app",
    api_key="sk-sandbox-YOUR_API_KEY",
    org_id="org_YOUR_ORG_ID",
)
```

## Create and Execute

```python theme={null}
sandbox = client.create(timeout_seconds=300)
result = client.execute(
    sandbox_id=sandbox["sandbox_id"],
    command=["python3", "-c", "print('Hello from StateSet!')"],
)
```

## File Operations

```python theme={null}
client.write_files(
    sandbox_id=sandbox["sandbox_id"],
    files=[{"path": "/workspace/hello.txt", "content": "SGVsbG8h", "encoding": "base64"}],
)

file = client.read_files(sandbox_id=sandbox["sandbox_id"], paths=["/workspace/hello.txt"])
```

## Cleanup

```python theme={null}
client.stop(sandbox_id=sandbox["sandbox_id"])
```

## Related Documentation

* [Quickstart](/stateset-sandbox/QUICKSTART)
* [API Reference](/stateset-sandbox/API_REFERENCE)
