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.


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())