Resolve Auth Mode • AI Agent SDK

resolve_auth_mode: Resolve authentication mode based on bind host and explicit configuration.

resolve_auth_mode

Function

</div>

This function is defined in the protocols module.

Resolve authentication mode based on bind host and explicit configuration.

Signature

python
def resolve_auth_mode(bind_host: str, configured: Optional[AuthMode]) -> AuthMode

Parameters

ParamField str

Host/IP that the service is bound to

ParamField Optional[AuthMode]

Explicitly configured auth mode (takes precedence)

Returns

ResponseField AuthMode

The resolved authentication mode

Usage

python
>>> resolve_auth_mode("127.0.0.1")
    'local'
    >>> resolve_auth_mode("0.0.0.0")  
    'token'
    >>> resolve_auth_mode("127.0.0.1", "token")
    'token'

Uses

  • is_loopback

Source

View on GitHub

praisonaiagents/gateway/protocols.py at line 2673