src.asqi.backends

Submodules

Functions

create_backend(→ asqi.backends.base.ContainerBackend)

Create the appropriate ContainerBackend based on the RUN_BACKEND env var.

Package Contents

src.asqi.backends.create_backend(backend: str | None = None, namespace: str | None = None) asqi.backends.base.ContainerBackend

Create the appropriate ContainerBackend based on the RUN_BACKEND env var.

Reads the provided backend value or RUN_BACKEND environment variable (case-insensitive, default: docker) and constructs the matching backend:

  • dockerDockerBackend

  • k8sKubernetesBackend (namespace taken from the provided namespace or K8S_NAMESPACE, default: "default"; requires pip install 'asqi-engineer[k8s]')

Raises:

ValueError: If the resolved backend value is not one of docker or k8s. ImportError: If k8s is selected but the kubernetes package is not installed.

Returns:

A ContainerBackend instance.