Refactor data->agent and fix tests