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

# Python SDK

> Use run.cloud from Python and migrate common sandbox SDK integrations.

Install the native Python client and its compatibility adapters from PyPI:

```bash theme={null}
pip install runcloud-sdk
runcloud login
```

```python theme={null}
from runcloud import Client

cloud = Client()
box = cloud.create(image="runcloud/agent-base", cpu=2, memory=4096)
try:
    result = box.exec("python -V")
    print(result.stdout)
finally:
    box.destroy()
```

`Client()` automatically uses the credential saved by `runcloud login`. For
automation, set `RUN_CLOUD_API_KEY` and optionally `RUN_CLOUD_API_URL`, or pass
`api_key` and `api_url` directly. The client also accepts
`RUN_CLOUD_API_TOKEN` as an alias for `RUN_CLOUD_API_KEY`.

## Name a sandbox

A name is a label you choose, and the filter `list(name=...)` matches on it
server-side. Renaming is how a sandbox gets re-tagged without destroying it:

```python theme={null}
matches = cloud.list(name="checkout-api")
box = matches[0] if matches else cloud.create(name="checkout-api")

box.rename("checkout-api-v2")
box.rename("")  # clears the label
```

Renaming works in every state except `destroyed`, names are capped at 128
characters, and they are not unique — check `state` on a match before using it.

## Compatibility adapters

| Provider | Import |
| - | - |
| Modal | `from runcloud.compat import modal` |
| E2B | `from runcloud.compat.e2b import Sandbox` |
| Daytona | `from runcloud.compat.daytona import Daytona` |
| Vercel Sandbox | `from runcloud.compat.vercel import Sandbox` |
| Blaxel async | `from runcloud.compat.blaxel import SandboxInstance` |
| Blaxel sync | `from runcloud.compat.blaxel import SyncSandboxInstance` |
| Fly Sprites | `from runcloud.compat.sprites import SpritesClient` |

```python theme={null}
# from e2b import Sandbox
from runcloud.compat.e2b import Sandbox

box = Sandbox.create()
try:
    result = box.commands.run("python -V")
    print(result.stdout)
finally:
    box.kill()
```

The adapters cover core creation, lookup, commands, lifecycle, and destruction.
Blaxel's current `SandboxInstance` API is async; use `SyncSandboxInstance` when
migrating its synchronous API. Provider-specific functionality without a public
run.cloud equivalent raises `UnsupportedCompatibilityFeatureError` with a
migration hint. The adapters do not report a fabricated success for unsupported
features.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.