BRAIN: A framework for flexible role-based interactions inmultiagent systems