[PATCH 2/2] client: Rework agent registarion logic