Environments pose antagonistic demands on individual and collective cognition, such as trading off cognitive stability against cognitive flexibility. Manifestations of this tradeoff have been shown to vary across individuals, leading to differences in individual task switching performance. In this simulation study, we examine how individual differences in cognitive stability and flexibility contribute to collective task switching performance. Specifically, we study whether diversity in cognitive stability and flexibility among members of a group can facilitate collaborative task switching. We test this hypothesis by probing task switching performance of a multi-agent dynamical system, and by varying the heterogeneity of cognitive stability and flexibility among agents. We find that heterogeneous (compared to homogeneous) groups perform better in environments with high switch rates, especially if the most flexible agents receive task switch instructions. We discuss the implications of these findings for normative accounts of cognitive heterogeneity, as well as clinical and educational settings.