Agent Coordination Contexts (ACCs) have been proposed as virtual environments where agents live and interact. In this way, as in a human society, interactions may be subject to conventions and laws depending on their context. This is obtained by a suitable ACC that embeds the communication laws relevant to a specific application and checks whether they are fulfilled as interactions take place.Context modeling, while representing a communication aspect relevant for all the agents of an application, is a crosscutting concern with respect to the design of the activities of each agent. In this paper, we propose an approach allowing a separate design and implementation of, respectively, behaviour and the interaction aspects constituting the context. Once the latter have been formalised in a specification consisting of communication laws, a tool generates the necessary management and checking code from the specification. Moreover, we automate the way laws are enforced on agent communication by suitably re-directing any interaction between agents, so as to ensure it respects the constraints specified by the laws, and take the actions some laws may request, before it actually takes place. Re-direction is accomplished by means of computational reflection, which transparently changes the meaning of the communication primitives normally used by agents programmers.