Data-driven model reduction of agent-based systems using the Koopman generator