Reading application configuration

To read application configuration using the Agent SDK, call the get_app_config method.

fclient.get_app_config("low_power_mode", None)

The first argument is the name of the key you wish to retrieve the value for, and the second argument is the default return if no key exists.

914

Device configuration -> General -> Application configuration

Example application

Play with the following script to understand how application configuration can be read and handled.

import time
import random
from formant.sdk.agent.v1 import Client as FormantClient


if __name__ == "__main__":
    fclient = FormantClient()

    low_power_mode = fclient.get_app_config("low_power_mode", None) == "true"

    if low_power_mode:
        print("Entering low power mode.")

    cycle_period = 1.0 if low_power_mode else 0.25

    while True:
        fclient.post_numeric("example.numeric", random.random())
        time.sleep(cycle_period)

👋

If you notice an issue with this page or need help, please reach out to us! Use the 'Did this page help you?' buttons below, or get in contact with our Customer Success team via the Intercom messenger in the bottom-right corner of this page, or at [email protected].