Skip to content

datarobot_genai.dragent.registry_l2_bootstrap

registry_l2_bootstrap

Ensure agent card registry L2 provisioning runs before the registry singleton locks in L1.

On enclave workloads, memory_space_cache.try_resolve_memory_space_id provisions the registry L2 MemorySpace. configure_datarobot_memory_client skips dr.Client()'s GET /version/ compatibility check on enclave endpoints because gateways expose the memory Session API but not the full control-hub /api/v2 surface.

This module retries provisioning at lifespan startup, resets the registry singleton when a space is adopted, and logs raw HTTP probes when SDK error handling masks the real failure.

ensure_registry_l2_cache_provisioned

ensure_registry_l2_cache_provisioned(*, phase: str) -> str | None

Provision the registry L2 MemorySpace on enclave workloads and reset the singleton.

Import-time bootstrap uses this synchronous helper. Lifespan warmup must call :func:ensure_registry_l2_cache_provisioned_async.

Source code in datarobot_genai/dragent/registry_l2_bootstrap.py
def ensure_registry_l2_cache_provisioned(*, phase: str) -> str | None:
    """Provision the registry L2 MemorySpace on enclave workloads and reset the singleton.

    Import-time bootstrap uses this synchronous helper. Lifespan warmup must
    call :func:`ensure_registry_l2_cache_provisioned_async`.
    """
    context = _begin_registry_l2_provision(phase)
    if context is None:
        return None
    gates, deduplication_key = context
    return _finish_registry_l2_provision(
        phase,
        try_resolve_memory_space_id(),
        gates=gates,
        deduplication_key=deduplication_key,
    )

ensure_registry_l2_cache_provisioned_async async

ensure_registry_l2_cache_provisioned_async(*, phase: str) -> str | None

Async counterpart of :func:ensure_registry_l2_cache_provisioned.

Source code in datarobot_genai/dragent/registry_l2_bootstrap.py
async def ensure_registry_l2_cache_provisioned_async(*, phase: str) -> str | None:
    """Async counterpart of :func:`ensure_registry_l2_cache_provisioned`."""
    context = _begin_registry_l2_provision(phase)
    if context is None:
        return None
    gates, deduplication_key = context
    return _finish_registry_l2_provision(
        phase,
        await try_resolve_memory_space_id_async(),
        gates=gates,
        deduplication_key=deduplication_key,
    )

bootstrap_registry_l2_cache

bootstrap_registry_l2_cache() -> None

Provision registry L2 before workflow config locks the registry singleton to L1.

Source code in datarobot_genai/dragent/registry_l2_bootstrap.py
def bootstrap_registry_l2_cache() -> None:
    """Provision registry L2 before workflow config locks the registry singleton to L1."""
    if _BootstrapState.bootstrapped:
        return
    _BootstrapState.bootstrapped = True
    logger.info("Agent card registry L2 bootstrap: ensuring enclave MemorySpace provisioning.")
    ensure_registry_l2_cache_provisioned(phase="import")