Software agents represent an interesting paradigm to approach complex and distributed systems. Their sociality enables to build multiagent systems, where different agents interact to pursue their goals. Multiagent systems can involve both cooperative and competitive agents. In both cases, the composition of different agents is an issue that must be faced by developers. In this paper, we propose to build infrastructures based on roles, which are abstractions that enable the composition of different agents in an open scenario. Some concrete examples are provided to support our proposal.