Update to the new agent API