client: Add support for registering and unregistering an agent