Skip to content

datarobot_genai.core.runtime

runtime

DataRobot hosted-runtime detection helpers.

Canonical helpers for determining whether the current process is running inside a DataRobot-managed container (workload or custom-model deployment) and retrieving the platform-injected identifiers.

get_workload_id

get_workload_id() -> str | None

Return the platform-injected workload ID, or None when not on a workload.

Source code in datarobot_genai/core/runtime.py
def get_workload_id() -> str | None:
    """Return the platform-injected workload ID, or None when not on a workload."""
    return os.environ.get(WORKLOAD_ID_ENV, "").strip() or None

get_deployment_id

get_deployment_id() -> str | None

Return the platform-injected deployment ID, or None when not on a deployment.

Source code in datarobot_genai/core/runtime.py
def get_deployment_id() -> str | None:
    """Return the platform-injected deployment ID, or None when not on a deployment."""
    return os.environ.get(DEPLOYMENT_ID_ENV, "").strip() or None

is_workload_mode

is_workload_mode() -> bool

Return True when running inside a DataRobot workload container.

Source code in datarobot_genai/core/runtime.py
def is_workload_mode() -> bool:
    """Return True when running inside a DataRobot workload container."""
    return get_workload_id() is not None

is_deployment_mode

is_deployment_mode() -> bool

Return True when running inside a DataRobot custom-model deployment container.

Source code in datarobot_genai/core/runtime.py
def is_deployment_mode() -> bool:
    """Return True when running inside a DataRobot custom-model deployment container."""
    return get_deployment_id() is not None

is_hosted_runtime

is_hosted_runtime() -> bool

Return True when running in any DataRobot-hosted runtime (vs local dev).

Source code in datarobot_genai/core/runtime.py
def is_hosted_runtime() -> bool:
    """Return True when running in any DataRobot-hosted runtime (vs local dev)."""
    return is_workload_mode() or is_deployment_mode()