This is begging to be a switch (config->agent_type) !