Skip to content

datarobot_genai.drmcputils.credentials

credentials

AuthResolutionStrategy

Bases: StrEnum

How tool authentication secrets are resolved.

Source code in datarobot_genai/drmcputils/credentials.py
class AuthResolutionStrategy(StrEnum):
    """How tool authentication secrets are resolved."""

    HTTP = "http"
    CONFIG = "config"

DataRobotCredentials

Bases: DataRobotAppFrameworkBaseSettings

DataRobot API credentials.

Loads from env vars (including MLOPS_RUNTIME_PARAM_*), .env, file secrets, and pulumi_config.json. Fields map by name: datarobot_api_token reads DATAROBOT_API_TOKEN, datarobot_endpoint reads DATAROBOT_ENDPOINT.

Source code in datarobot_genai/drmcputils/credentials.py
class DataRobotCredentials(DataRobotAppFrameworkBaseSettings):
    """DataRobot API credentials.

    Loads from env vars (including MLOPS_RUNTIME_PARAM_*), .env, file secrets,
    and pulumi_config.json. Fields map by name: ``datarobot_api_token`` reads
    ``DATAROBOT_API_TOKEN``, ``datarobot_endpoint`` reads ``DATAROBOT_ENDPOINT``.
    """

    datarobot_api_token: str = ""
    datarobot_endpoint: str = DEFAULT_DATAROBOT_ENDPOINT

ToolsAuthCredentials

Bases: DataRobotAppFrameworkBaseSettings

Application credentials and auth resolution settings for tools.

Config fields are used when auth_resolution_strategy is config. Use config only for personal, single-user agents; shared deployments should use http so each caller supplies their own credentials via request headers. See docs/drtools/auth.md for strategy details.

Source code in datarobot_genai/drmcputils/credentials.py
class ToolsAuthCredentials(DataRobotAppFrameworkBaseSettings):
    """Application credentials and auth resolution settings for tools.

    Config fields are used when ``auth_resolution_strategy`` is ``config``.
    Use ``config`` only for personal, single-user agents; shared deployments should
    use ``http`` so each caller supplies their own credentials via request headers.
    See ``docs/drtools/auth.md`` for strategy details.
    """

    auth_resolution_strategy: AuthResolutionStrategy = AuthResolutionStrategy.HTTP
    datarobot: DataRobotCredentials = Field(default_factory=DataRobotCredentials)
    tavily_api_key: str = ""
    perplexity_api_key: str = ""
    atlassian_api_token: str = ""
    atlassian_email: str = ""
    atlassian_site_url: str = ""

    def has_datarobot_credentials(self) -> bool:
        """Check if DataRobot credentials are configured."""
        return bool(self.datarobot.datarobot_api_token)

has_datarobot_credentials

has_datarobot_credentials() -> bool

Check if DataRobot credentials are configured.

Source code in datarobot_genai/drmcputils/credentials.py
def has_datarobot_credentials(self) -> bool:
    """Check if DataRobot credentials are configured."""
    return bool(self.datarobot.datarobot_api_token)

get_credentials

get_credentials() -> ToolsAuthCredentials

Get the global credentials instance.

Source code in datarobot_genai/drmcputils/credentials.py
def get_credentials() -> ToolsAuthCredentials:
    """Get the global credentials instance."""
    # Use a local variable to avoid global statement warning
    credentials = _credentials
    if credentials is None:
        credentials = ToolsAuthCredentials()
        # Update the global variable
        globals()["_credentials"] = credentials
    return credentials