Skip to content

yggdrasil.loki.capability

capability

Backend detection — what can Loki reach from where it's running.

Loki is the global yggdrasil agent. It adapts to wherever it wakes up: a Databricks notebook/job, a workstation with a configured Databricks session, a running yggdrasil node, or just a bare shell. :func:detect sniffs the environment offline (no network, never raises) and reports the backends Loki can lean on, so the agent can reason about its own capabilities before it acts.

Backend dataclass

Backend(name: str, available: bool, detail: dict[str, Any] = dict())

A capability surface Loki can drive (e.g. Databricks, a node).

detect_databricks

detect_databricks() -> Backend

Detect a usable Databricks session without a network round-trip.

Looks for the signals that mean "credentials are resolvable": the Databricks runtime, DATABRICKS_* env vars, a ~/.databrickscfg, or a session remembered by ygg databricks configure. Only when one is present does it resolve a client (offline — host/auth from config), so it never pollutes the process-global client with a credential-less instance.

detect_aws

detect_aws() -> Backend

Detect a usable AWS session without a network round-trip.

Looks for the signals that mean "boto3 can resolve credentials": the AWS_* env vars, an AWS_PROFILE, a web-identity token (IRSA), or a ~/.aws config/credentials file. Offline only — never calls STS, so it never blocks or raises.

detect_local

detect_local() -> Backend

The local machine — always available.

detect

detect() -> list[Backend]

Every backend Loki can see from here, in priority order.