Genesys Python SDK auto-refresh token not working

I am using the Genesys Cloud Python SDK for a background script that checks WEM adherence metrics. The initial token works, but after an hour the requests fail with 401 Unauthorized even though I configured the refresh_token in the credentials. I expected the SDK to handle the refresh automatically, but it doesn’t seem to be doing that. Here is my setup code:

credentials = AuthCredentials(
 client_id='my_client_id',
 client_secret='my_secret',
 refresh_token='my_refresh_token'
)
api_instance = RoutingApi(Configuration(credentials))

Is there a specific setting I am missing to enable auto-refresh?