def get_or_create_client(debug: bool = False):
    """Get existing client or create a new one."""
    
    global latest_upsonic_client
    
    if latest_upsonic_client is not None:
        # Check if the existing client's status is False
        if not latest_upsonic_client.status():
            from ..base import UpsonicClient
            new_client = UpsonicClient("localserver", debug=debug)
            latest_upsonic_client = new_client
        return latest_upsonic_client
    
    from ..base import UpsonicClient
    the_client = UpsonicClient("localserver", debug=debug)
    latest_upsonic_client = the_client
    return the_client
Get existing client or create a new one.
src/upsonic/client/agent_configuration/agent_configuration.py