Add support for safelink-agent and improve polling error management