Agent surgery: The case for mutable agents LadislauB¨ol¨ oni and Dan C. Marinescu Computer Sciences Department Purdue University West Lafayette, IN 47907 August 30, 2005 Abstract We argue that mutable programs are an important class of future applications. The field of software agents is an important beneficiary of mutability. We evaluate existing mutable applications and discuss basic requirements to legitimize mutability techniques. Agent surgery supports runtime mutability in the agent framework of the Bond distributed object system. 1 Introduction Biological metaphors from structural biology, immunology, and genetics provide useful insights for the design of complex systems. For example a component-based design inspired by protein structure has distinct advantages over more traditional approaches [5], [6]. In this paper we continue this line of thought and discuss another metaphor, program mutability. Introductory computer architecture courses often present an example of self-modifying assembly code to drive home the message that executable code and data are undistinguishable from one an- other once loaded in the internal memory of a computer. Later on, computer science students learn that writing self-modifying programs or programs which modify other programs is not an acceptable software engineering practice but a rebellious approach with unpredictable and undesirable results. A typical recommendation is “Although occasionally employed to overcome the restrictions of first- generation microprocessors, self-modifying code should never ever be used today - it is difficult to read and nearly impossible to debug.” [1] While giving the proper consideration to this point of view, in this paper we argue that self- modifying or mutable programs are already around, and they will be an important component of the computing culture in coming years. In particular, this approach can open new possibilities for the field of autonomous agents. Software agents play an increasingly important role in today’s computing landscape due to their versatility, autonomy, and mobility. For example the Bond agent framework discussed briefly in Section 3 is currently used for a variety of applications including an workflow enactment engine for commercial and business applications [9], resource discovery and management in a wide-area distributed object-system, [11], adaptive video services [10], parallel and distributed computing [7]. Some of these applications require that the functionality be changed while the agent is running. But to change the functionality of an agent we have to modify its structure. This motivates our interest for agent surgery and by extension for program mutability. Program mutability is often motivated by the need to extend the functionality of a running application. Probably the best known examples of this case are the plugins allowing a Web browser to accept new data types. Another reason to modify a running application is to minimize the level of resource consumption. For example, to reduce the latency and bandwidth requirements for migrating an agent from one location to another we may only want to transport the new site only those components of the agent that will be activated in the future rather than all the components. This paper is structured as follows. In Section 2 we identify the features of various existing or envisioned mutable programs and propose a distinction between weak and strong mutability. In Section 3 we present the self-modifying architecture of the agent framework of the Bond distributed object system, while in Section 4 several common surgery techniques are discussed. Section 5 presents a real-world application of agent surgery. Conclusions are drawn in section 6. 1