Python Config SDK Reference

AutoblocksConfig

This is the base class your config will inherit from.

namerequireddefaultdescription
valuetrueThe initial value for the config
class MyConfigValue(pydantic.BaseModel):
    my_val: str

class MyConfig(AutoblocksConfig[MyConfigValue]):
    pass

config = MyConfig(
    value=MyConfigValue(my_val="initial-val"),
)

# Usage
config.value.my_val

activate_from_remote

Retrieves the value of a remote config and overrides the initial value of the config class.

namerequireddefaultdescription
configtrueThe remote config to activate. See RemoteConfig below.
parsertrueThe function to use when parsing the remote config and setting the value of the config class.
api_keyfalseAUTOBLOCKS_API_KEY environment variableYour Autoblocks API key.
refresh_intervalfalsetimedelta(seconds=10)How often to refresh the latest config. Only relevant if the version is set to LATEST.
refresh_timeoutfalsetimedelta(seconds=30)How long to wait for the latest config to refresh before timing out. A refresh timeout will not raise an uncaught exception. An error will be logged and the background refresh process will continue to run at its configured interval.
activate_timeoutfalsetimedelta(seconds=30)How long to wait for the remote config to activate before timing out.
config.activate_from_remote(
    config=RemoteConfig(id="my-remote-config", version="latest"),
    parser=MyConfigValue.model_validate
)

RemoteConfig

Used when activating a remote config. Either major and minor version or dangerously_use_undeployed_revision is required.

namerequireddefaultdescription
idtrueThe id of the config in Autoblocks.
major_versionfalseNoneA specific config major version such as "1"
minor_versionfalseNoneA specific config minor version such as "1" or "latest"
dangerously_use_undeployed_revisionfalseNoneEither "latest" or a specific revision such as "cljzx8zhd00077w3sqredd0fz"
config.activate_from_remote(
    config=RemoteConfig(
        id="my-remote-config",
        major_version="1",
        minor_version="latest"
    ),
    parser=MyConfigValue.model_validate
)