Firm innovation is a complex and multidimensional process that is affected by internal and external factors. Companies and governments have traditionally tried to promote in‐house innovation by promoting research and development investment. In an economy characterized by a large percentage of small‐ and medium‐sized enterprises and continuous change toward digital and green transition, many companies struggle to innovate because of their lack of resources, knowledge, or capabilities. In this context, the external links and networks that materialize through active engagement in innovation activities with market and institutional agents are key, and analyzing cooperation for innovation is essential to obtain an overview to promote innovation. This study contributes to the understanding of (1) the drivers in innovative companies that lead to cooperation with external agents for innovation; (2) the relative importance of these drivers for cooperation; (3) the extent to which the eco‐innovation orientation of a company affects its engagement in collaborations with other stakeholders; and (4) an understanding of the differences in the cooperation drivers according to the type of collaborator (institutional, market, or both). Using data from the Spanish Technological Innovation Panel and machine‐learning techniques, we confirm the importance of internal and external factors, namely public financing, the environmental and social orientation of innovation, and the commitment to innovation. This research also reveals the asymmetric impact of many of the cooperation drivers, and that company cooperation with both market and institutional agents leads to higher innovation performance. The findings have important implications for policymakers and practitioners.