backport of @randgalt's priam-agent code to 1.1 branch