Environment:OpenHands OpenHands Third Party Runtime Credentials
| Knowledge Sources | |
|---|---|
| Domains | Cloud_Infrastructure, Runtime_Management |
| Last Updated | 2026-02-11 21:00 GMT |
Overview
API credentials and configuration for third-party sandbox runtime providers: Daytona, E2B, Modal, and Runloop.
Description
OpenHands supports multiple third-party sandbox runtime providers as alternatives to the default Docker-based runtime. Each provider requires specific API keys and optional configuration. These runtimes are optional dependencies installed via the `third_party_runtimes` extra. Each runtime creates isolated sandbox environments where the AI agent executes code, runs commands, and performs file operations.
Usage
Use this environment when deploying OpenHands with a third-party sandbox runtime instead of the default Docker runtime. Each provider is selected at configuration time. Only the credentials for the chosen provider need to be set.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| Runtime | Python >= 3.12, < 3.14 | Same as base OpenHands requirement |
| Network | Outbound HTTPS | All providers require outbound API calls |
| Optional | Docker | Only needed for the default Docker runtime, not third-party providers |
Dependencies
Python Packages (Optional - install via extras)
- `daytona` == 0.24.2 (Daytona SDK)
- `e2b-code-interpreter` >= 2 (E2B SDK)
- `modal` >= 0.66.26, < 1.2 (Modal SDK)
- `runloop-api-client` == 0.50 (Runloop SDK)
Quick Install
# Install with third-party runtime support
pip install "openhands-ai[third_party_runtimes]"
# Or install individual providers
pip install daytona==0.24.2
pip install e2b-code-interpreter>=2
pip install "modal>=0.66.26,<1.2"
pip install runloop-api-client==0.50
Credentials
Daytona:
- `DAYTONA_API_KEY`: Daytona API key (required)
- `DAYTONA_API_URL`: Daytona API endpoint (default: https://app.daytona.io/api)
- `DAYTONA_TARGET`: Daytona target region (default: eu)
- `DAYTONA_DISABLE_AUTO_STOP`: Disable auto-stop for sandbox (default: false)
- `DAYTONA_DELETE_ON_CLOSE`: Delete sandbox on close (default: false)
E2B:
- `E2B_API_KEY`: E2B API key (required)
- `E2B_DOMAIN`: Custom E2B domain (optional; sets `E2B_API_URL` internally)
Modal:
- `MODAL_TOKEN_ID`: Modal token ID (required)
- `MODAL_TOKEN_SECRET`: Modal token secret (required)
Runloop:
- `RUNLOOP_API_KEY`: Runloop API key (required)
Code Evidence
Daytona credential loading from `third_party/runtime/impl/daytona/daytona_runtime.py:50-56`:
api_key = os.getenv("DAYTONA_API_KEY")
if not api_key:
raise ValueError(
"DAYTONA_API_KEY environment variable is not set. "
"Please set it to your Daytona API key."
)
self.api_url = os.getenv("DAYTONA_API_URL", "https://app.daytona.io/api")
self.target = os.getenv("DAYTONA_TARGET", "eu")
E2B credential loading from `third_party/runtime/impl/e2b/sandbox.py:28-35`:
api_key = os.getenv("E2B_API_KEY")
if not api_key:
raise ValueError(
"E2B_API_KEY environment variable is not set. "
"Please set it to your E2B API key."
)
e2b_domain = os.getenv("E2B_DOMAIN")
Modal credential loading from `third_party/runtime/impl/modal/modal_runtime.py:62-63`:
self.modal_token_id = os.getenv("MODAL_TOKEN_ID")
self.modal_token_secret = os.getenv("MODAL_TOKEN_SECRET")
Optional dependency import from `openhands/runtime/__init__.py:79-81`:
except ImportError:
logger.debug(
f"Could not import runtime class {runtime_cls} from {module_name}"
)
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `ValueError: DAYTONA_API_KEY environment variable is not set` | Missing Daytona API key | Set `DAYTONA_API_KEY` in environment or `.env` file |
| `ValueError: E2B_API_KEY environment variable is not set` | Missing E2B API key | Set `E2B_API_KEY` in environment or `.env` file |
| `ImportError: Could not import runtime class` | Third-party runtime package not installed | Install with `pip install "openhands-ai[third_party_runtimes]"` |
| `ModuleNotFoundError: No module named 'daytona'` | Daytona SDK not installed | `pip install daytona==0.24.2` |
Compatibility Notes
- Provider Selection: Only one third-party runtime is active at a time. Set the runtime type in OpenHands configuration to select the provider.
- Modal HA Limitation: Modal runtime tracking uses in-process state that does not work in high-availability (clustered) mode. See FIXME at `third_party/runtime/impl/modal/modal_runtime.py:27`.
- E2B Custom Domain: When `E2B_DOMAIN` is set, the SDK internally sets `E2B_API_URL` to `https://{E2B_DOMAIN}`. This is used for self-hosted E2B deployments.
- Daytona Cleanup: By default, Daytona sandboxes are stopped but not deleted on close. Set `DAYTONA_DELETE_ON_CLOSE=true` to automatically delete sandboxes.
Related Pages
- Implementation:OpenHands_OpenHands_DaytonaRuntime_Init
- Implementation:OpenHands_OpenHands_DaytonaRuntime_Connect
- Implementation:OpenHands_OpenHands_DaytonaRuntime_Start_Action_Server
- Implementation:OpenHands_OpenHands_DaytonaRuntime_Close
- Implementation:OpenHands_OpenHands_E2BBox_Execute
- Implementation:OpenHands_OpenHands_E2BFileStore