Move agent code into server.