Introducing API checking to agent-server comms.
(cherry picked from commit 577d371d27504978a8c015695e4aab26c03c9a29)