Roles are a powerful paradigm to develop distributed applications based on agents, especially when they are in need of interacting with other entities. An agent-oriented approach requires that roles are conceived as first-class entities, and at the same time that roles are dynamically embedded into agents at runtime. In this paper we propose an approach that addresses such requirements, enabling Java agents to dynamically assume roles. We present a mechanism that modifies the agent bytecode to add the role features.