Detect if agent is unable to upload data

Q: How can I detect if the agent is not able to upload data?


The following script checks the agent's connection to the server:

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


def handle_telemetry(datapoint):
    if datapoint.datapoint.health.status == 2:
        print("Agent cannot reach server")
    if datapoint.datapoint.health.status == 1:
        print("Agent can reach server")



if __name__ == "__main__":
    fclient = FormantClient(ignore_throttled=True, ignore_unavailable=True)

    fclient.register_telemetry_listener_callback(
        handle_telemetry, stream_filter=["$.agent.health"]
    )

    while True:
        time.sleep(10)

👋

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 support@formant.io.