Engineering Mobile-Agent Applications via Context-dependent Coordination


Engineering Mobile-agent Applications via Context-dependent Coordination
Giacomo Cabri, Letizia Leonardi, Franco Zambonelli Dipartimento di Scienze dell’Ingegneria – Università di Modena e Reggio Emilia Via Vignolese, 905 – 41100 Modena – ITALY E-mail: {giacomo.cabri, letizia.leonardi, franco.zambonelli}@unimo.it

Abstract
Mobility introduces peculiar coordination problems in agent-based Internet applications. First, it suggests the exploitation of an infrastructure based on a multiplicity of local interaction spaces. Second, it may require coordination activities to be adapted both to the characteristics of the execution environment where they occur and to the needs of the application to which the coordinating agents belong. This paper introduces the concept of context-dependent coordination based on programmable interaction spaces. On the one hand, interaction spaces associated to different execution environments may be independently programmed so as to lead to differentiated, environment-dependent, behaviors. On the other hand, agents can program the interaction spaces of the visited execution environments to obtain an application-dependent behavior of the interaction spaces themselves. Several examples show how an infrastructure for context-dependent coordination can be exploited to simplify the design of Internet applications based on mobile agents. In addition, the MARS coordination infrastructure is presented as an example of a system in which the concept of context-dependent coordination has found a clean and efficient implementation.

1.

Introduction

Designing and deploying Internet applications introduces new problems and requirements over traditional approaches to distributed program development. On the one hand, decentralization of management, wideness of the distribution scale, and the necessary partial knowledge available about the target environment, require application components to integrate the capacity of dealing with unexpected situations as part of their intrinsic behavior, rather than in terms of “exceptions”. On the other hand, the intrinsic interactivity of Internet applications require application components to interact with a variety of other, possibly unknown in advance, entities (such as services,

legacy applications, other components of different applications). These kinds of interactions often have to assume complex forms, difficult to be expressed in terms of a traditional client-server fashion, and leading to an “organizational” view of the distributed application rather than to a “compositional” view. The above reasons justify the adoption of an agent-oriented approach for Internet application development [20]. By conceiving and developing applications in terms of autonomous entities, capable both of reacting to changes in the environment and of executing in a proactive way, one can naturally deal with dynamicity and unpredictability [11]. By exploiting the notion of sociality typical of the agent-oriented paradigm, one can easily decompose an application in terms of a multi-agent organization, where the necessary interaction protocols find a first-order accommodation and definition [6]. Agent mobility [12, 19], i.e., the agents’ capability of moving across the Internet while executing, is being recognized as a useful property for both the actual execution and the conceptual design of Internet applications. The actual movement of a software agent – i.e., the transfer of its code, data, and state – towards the nodes where the resources it needs to access are allocated can provide for saving network bandwidth, and for increasing both the reliability and the efficiency of the execution [14, 19]. The virtual movement of a software agent, instead, refers to the fact that, in agent-based Internet applications, it is suitable to abstract the Internet as a multiplicity of execution environments (e.g., Internet nodes or administrative domains) [5, 9] and to design applications in terms of agents that are aware of the distributed nature of the target and virtually move (when not even actually) in different execution environments to access to the resources there allocated. Agents, during their execution, are in need to interact, communicate, and synchronize their activities, both with other agents (inter-agent coordination) and with resources on the visited execution environments (agent-environment coordination).

It has already been argued that both inter-agent and agent-environment coordination can effectively rely on an infrastructure based on a multiplicity of independent interactions spaces (e.g., blackboards or tuple spaces), each associated to an execution environment. These interaction spaces are in charge of mediating all coordination activities (both inter-agent and agentenvironment ones) for the agent currently executing (whether virtually or actually) in the associated execution environment [3, 17]. Such an infrastructure naturally matches the network-aware – virtually mobile – nature of Internet agents and enforces the principle of locality in interactions. Moreover, when agents can actually move at a world-wide scale, relying only global inter-agent interactions is not suitable, requiring the introduction of complex communication middleware [3]. For the very fact that agents move onto different execution environments during their execution, and will exploit the associated local interaction spaces, they will access to different data, services, and will interact with different agents, depending on the environment. This form of context-dependency is intrinsic in agent mobility, and the interaction space does not play any active role in it. However, more sophisticated forms of context-dependent interactions may be needed in Internet applications implying an active role of the interaction space: (i) each execution environment has its own specific characteristics and security policies, and it may be somehow in need of enacting specific coordination laws on the agents accessing its local interaction space (environment-dependent coordination); (ii) application agents may require their coordination activities to occur according to specific application needs, despite the different characteristics of the local environment and the different coordination laws there enacted (application-dependent coordination). By enhancing interaction spaces with the capability of dynamically programming their behaviors in response to interaction events [3, 7], one can make interaction spaces behave in different ways depending on which agent issued which interaction event. This characteristic can be used to support a strong form of context-dependent coordination. In particular: (i) the administrator of one site can adapt the behavior of the interaction spaces to enforce – transparently to agents – site-specific policies/laws on the local interactions; (ii) application agents can dynamically adapt the behavior of the visited interaction spaces accordingly to specific application needs. The aim of this paper is to introduce and analyze the concept of context-dependent coordination, showing its possible exploitation in the design and development of Internet-agent applications. To this end, Section 2 briefly motivates the adoption of local interaction spaces in Internet applications based on mobile agents. Section 3 details the concept of context-dependent coordination and

discusses, via several examples, how it can be effectively exploited in the design and development of Internet applications. In particular, this section shows how contextdependent coordination promotes a clear separation of concerns between computational and coordination issues, which is likely to make applications more modular and easy to be maintained. Section 4 shows how contextdependent coordination can find an effective implementation in MARS, a coordination infrastructure based on programmable tuple spaces and firstly described in [4]. Section 5 discusses related work in the area. Section 6 concludes the paper, outlining open research directions.

2.

From Global and Coupled to Local and Uncoupled Interactions

Agent mobility discourages the generalized adoption of traditional coordination models, such as peer-to-peer message-passing, client-server, globally distributed shared memories, relying on the presence of a global communication abstraction. First, the globality of the Internet scenario and, therefore, of the space of possible interactions, can make communications between distant, actually mobile, agents inefficient and unreliable, also calling for complex infrastructure to deal with message forwarding [16], and lookup of agents' positions and names. Second, the intrinsic autonomy and dynamicity of agents clashes with the strict coupling (in terms of both synchronization of the activities and necessity of sharing a common name space) usually enforced by these models. Third, global and coupled interactions clashes with that principle of locality in interactions that have always to be enforced in the design and development of complex software systems and that, in the case of Internet agents, calls for geographical locality in interactions. The suitable alternative is to make agent coordination rely, whenever possible, on an infrastructure enforcing local and uncoupled interactions. On the one hand, interactions are to be confined within a local interaction space associated to the local execution environment. On the other hand, the local interaction space should act as the medium through which asynchronous and anonymous (i.e., uncoupled) interactions may occur. The mediation of the interaction space can make it possible for agents to indirectly interact with other agents disregarding their current positions and names, and for the local environment to make the interaction space act as the gate through which agent can access the local resources. Although different kinds of infrastructures can be conceived providing this characteristics and inspired by different coordination models (e.g., meetings [19] or event-channels [2]), we specifically suggest the adoption of an infrastructure based on independent tuple spaces [1] associated to each

execution environment. An agent on a site – via storing and retrieving of tuples in the local tuple space – can exchange data and knowledge messages with other agents, in an associative way, whoever and wherever these agents are, and whenever they will read (have written) the messages. In addition, an environment can publish in the form of tuples in the local space its public resources, to be accessed by locally executing agents. Let us consider an application in which a mobile searcher agent roams an itinerary of Internet sites to access and analyze specific HTML pages. The searcher agent arrives at a site, retrieves the needed data, and continues its itinerary. However, if the searcher agent discovers the presence of other interesting sites (via HTML links) not originally in its itinerary, it can clone itself and let the clones go to those sites. This can generate a tree of searcher agents, and makes it likely for two agents to arrive in the same site at different times. This situation must be avoided by coordinating the agents’ movements: when on a site, a searcher agent must know if the site has already been visited or not by another searcher agent. Since a searcher agent not only does not know where the other searcher agents are, but it also ignores who and how many they are, relying on peer-to-peer, global, interaction between them is not feasible without the availability of complex communication middleware to cope with actual agent mobility: searcher agents are forced to refer to a fixed, well-known, “home agent”, acting as mediator (or as a centralized shared memory) for all searcher agents. This introduces performance and reliability problems, and also complicates the application design. Instead, a local infrastructure based on tuple spaces can be exploited in a very simple and elegant way, leading to a simpler application design. When a searcher agent arrives on a site, it simply checks the local tuple space for the presence of a tuple left by another searcher agent on a previous visit. If the tuple is not found, the site has never been visited and the incoming searcher agent is in charge of leaving a tuple in its turn, to mark its current visit. Of course, the tuple space can be effectively used also to access the information about the local HTML files. The administrator can put in the tuple space tuples such: (filename, extension, keyword, modification_time, size). Searcher agents, by their side, can retrieve information about local HTML files related to the argument “coordination”, by asking for tuples matching: (string?, “html”, ”coordination”,
date?, int?).

3.

Context-Dependent Coordination

A model of local and uncoupled interactions not only fits both the actual and the virtual mobility of agents, but also invites thinking applications in terms of mobility. When an agent migrates to a new execution environment,

its interaction space and, thus, its perceivable world changes as a consequence of its movement: what it obtains from a given interaction event on a site is likely to be different from what it obtains on a different site. The above form of context-dependent coordination is intrinsic in agent mobility and in the adoption of independent, local interaction spaces. However, if the interaction space is simply an infrastructure for storing and forwarding of data, messages, or tuples, the above simple form of context-dependency is likely to be very complicated to be handled by agents. First, coordinating with the other agents residing in a foreign environment that an agent is likely to meet may require facing all the typical problems of open systems, such as opportunistic behavior in interactions, heterogeneity of languages and protocols [20]. Second, each environment has its specific characteristics and may somehow constrain the behavior of an agent in coordinating with it, for security or resource control reasons. Finally, despite the different characteristics of each environment, application agents may still require that their coordination occurs according to specific application needs. In the case of a static interaction space the above problems are likely to lead to huge agents, requiring costly maintenance activities as soon as their coordination requirement changes and/or the external conditions (i.e., the execution environments) changes. Alternatively, one can think about having the interaction space itself in charge of the burden of handling all coordination activities, to meet either environment-specific needs, or applicationspecific ones, or both. However, this requires the interaction space to be somehow active and to enable a dynamic adaptation of its behavior in response to interaction events. For instance, one can enhance the basic tuple-space model [1] towards a programmable tuple space model: for any kind of access events (i.e., request for storing, reading, or extracting a tuple), a new behavior in response to it can be programmed to override the basic behavior of the tuple space (i.e., storing and retrieval of tuples based on a stateless pattern-matching mechanism). To this end, one must: (i) characterize the kind of access events of interest, in terms the identity of the agent performing it, the primitive used to access the tuple space, and the parameter tuple supplied in the primitive; (ii) express the new behavior (also called reaction) to be assumed by the tuple space in response to this kind of access events. Similar considerations may apply when considering the enhancement towards programmability of interaction spaces other than those based on the tuple space model The adoption of a programmable tuple space model in mobile-agent Internet applications, as well as of any model based on programmable and local interaction spaces, leads to a stronger, and highly-manageable, form of context-

dependent coordination. On the one hand, interaction spaces associated to different execution environments may exhibit different behaviors in response to the same interaction events. This enables to integrate in the form of new behaviors – transparently to agents – whatever needed environment-specific coordination laws to rule the local coordination activities. On the other hand, on a given site, the same interaction events performed by agents belonging to different applications can lead to differentiated, application-dependent, behavior. Thus, agents can carry-on the code needed to implement and control an applicationspecific coordination laws and install it in the form of a new behavior into the interaction space of the visited site. In this way, agents can coordinate on the site being guaranteed that the interaction space will let them coordinate accordingly to their specific needs. The adoption of programmable interaction spaces to enforce context-dependent coordination leads to the scenario depicted in Figure 1. Agents on a site, whatever the application they belong to, are subject to the local environment-dependent laws. Moreover, the agents of a given application can spread their own coordination laws on the sites they visit, to influence the coordination activities of all the agents of the same application.
SITE A Agent app1 Agent app2 Agent app2 SITE B Agent app2 Agent app1

Agent app1

Local Interaction Space A
Environment A-specific laws App 1 – specific laws App 2 – specific laws

Local Interaction Space B
Environment B-specific laws App 1 – specific laws App 2 – specific laws

Figure 1. The Scenario of Context-Dependent Coordination In the following of this section, we describe several cases for which programmable interaction spaces (specifically, programmable tuple spaces) can be effectively exploited in Internet-agent applications to lead to both environment-dependent and application-dependent coordination. Finally, we discuss how context-dependent coordination laws can positively impact in the design and development of Internet-agent applications.

3.1

Environment-Dependent Coordination

Agents, while accessing a tuple space always with the same interface, can have the semantics of their coordination activities (as well as their perception of the environment) affected by the specific behavior

programmed for the local tuple space. In other words, the same interactions can have different effects depending on the site in which they are performed. This can be used both to embed security policies in the tuple space, and to help agents entering the new environment without having to explicitly take in charge of all the issues implied in executing in and accessing a foreign environment. Enforcing Security. When a site opens itself to the execution of mobile agents, it must be aware that malicious agents are likely to arrive at the site and undermine the integrity of its data and resources, which must be therefore protected from unauthorized accesses. Agents, on their side, may not be aware of the security policies adopted by an execution environment, so that their interactions with an environment are likely to issue a large number of security exceptions, to be handled by the agents themselves. However, if all the interactions with the environment are mediated by a programmable tuple space, the above problems can find a simple and elegant solution. In fact, the administrator can program the behavior of the tuple space so as to make any unauthorized access to the tuple space harmless without requiring the agent to handle exceptions. In the application example, if a searcher agent tries to extract a tuple representing a HTML file (while it has only the right to read that kind of tuples) a properly programmed tuple space can provide that tuple to agent without actually extracting it from the tuple space. Handling Heterogeneity. Different execution environments can adopt different choices w.r.t. the format of their data and resources stored, as well as w.r.t. their representation in the local tuple space. Agents, in these cases, have to explicitly deal with heterogeneity and somehow discover how to fruitfully access the environment. When adopting a programmable tuple space model, a completely different perspective can be adopted. In particular, a tuple space can be programmed so as to react to the access performed by agents by somehow transforming the agents’ request and making them homogeneous to the local representation. Therefore, on the one hand an agent can perceive a tuple space as if it were homogeneous to its expectations; on the other hand, the environment is not forced to change its tuple-based representation of the environment or duplicate it in different formats. In the application example, searcher agents look on a site for HTML files having the “html” extension, by asking for the corresponding HTML tuples. If the environment, by its side, stores HTML pages in files having the “htm” extensions, and shapes its tuples accordingly, a searcher agent, unless intelligent enough, has no possibility of discovering the presence HTML pages of that site. Then, the administrator (which is supposed to know that most of the agents will look for “html” files) can modify the behavior of the tuple space so as to transform the agents’ requests into requests for “htm” files, transparently to agents. In other words, the

administrator modifies the matching mechanisms so as to make “html” match with “htm” in HTML tuples. Supporting Open Interactions. Exploiting tuple space programmability to deal with heterogeneity issues naturally extends also to these cases in which a site is supposed to be open to host the execution of agents belonging to different applications and organizations, possibly heterogeneous in terms of supported languages and protocols, and nevertheless in need of coordinating with each other. Again, a tuple space can be used as a mediator, so as to support the coordination activities among a group of heterogeneous agents. Even more, a trusted site can be used to act as an impartial arbiter, in charge of controlling the interactions of agents with other, possibly selfinterested, agents, that would be likely to be unfruitful or damaging the agents, otherwise. As an example still related to the information retrieval area, the tuple space can be used so as to control the behavior of opportunistic “advertising agents” that could have interest in diverting the research of searcher agents toward specific commercial sites.

3.2

Application-Dependent Coordination

Application designers can exploit the programmability of the tuple spaces in different ways. It can be used to facilitate the access to the information on the visited site, to support the exchange of complex knowledge between agents and to implement complex coordination protocols. More generally, application designers can exploit programmability of tuple spaces so as to adapt the interaction model to their specific, application-dependent, needs. Of course, since these modifications of the tuple spaces’ behaviors are intended to meet specific application needs, some form of confinement must be provided by the tuple spaces to ensure that any application-specific behavior can affect only those access events performed by agents of that specific application. Facilitating Access. Let us consider again the application example. To avoid duplicated work, one can think about having searcher agents put a "marker" tuple in the space of the visited sites. This makes later incoming searcher agents of the same application aware of the fact that the site has already been visited. Even better, the marker tuple can report the time of the visit: later incoming searcher agents, in this case, can simply detect which files have been modified since the previous visit and collect only the information that is updated w.r.t. that held by the earlier visiting agent. However, the basic pattern matching mechanism would force a searcher agent to retrieve all the tuples representing files and, subsequently, to select only those representing files which have been modified since the last visit. Therefore, the application calls for a different pattern-matching mechanism, to effectively support its

inter-agent interaction needs, i.e., one that can make it possible to select all HTML tuples in which the modification_time field is greater than the one specified in the template tuple. Of course, only those access events performed by agents of the application example must trigger the reaction leading to the new pattern-matching mechanism. That is, the specific pattern-matching mechanism has to influence only that application context. Exchanging Knowledge. In the application example, putting a marker tuple in the space to be read by other application agents is a sort of explicit knowledge exchange between agents of the same applications. In other words, agents have to explicitly put and look for this information into the visited tuple spaces. This is likely to complicate the agent design and requires an agent to know a priori that it has to look for some information. In the presence of a programmable tuple space model, a simpler and more general solution can be sketched: agents can install in the visited tuple spaces a reaction that make the tuple spaces reflects – in term of the produced information – the knowledge/information acquired, to be implicitly transferred to other application agents. With regard to the above example, an agent that has visited a site can install a reaction that returns, to other agents of the same application requesting HTML files, only those files that have been modified since the last visit. In that way, another agent arriving there does not have to know or to worry about previous visits, because the reaction guarantees the avoidance of duplicated work. This example shows that making coordination on a site application-dependent can lead to a very powerful model, which is likely to simplify inter-agent coordination and to enable dynamic exchange of knowledge without influencing at all the agent code. Implementing Coordination Protocols. The burden of implementing a coordination protocol, whether involving agents interacting in a peer-to-peer way or indirectly via a not-programmable tuple space, increases the complexity of agents. In fact, agents are in charge of implementing in their code the capability of directly handling and controlling the proper execution of the coordination protocols. A better and cleaner solution would be to charge the interaction space itself (i.e., the tuple space) of the burden of controlling the coordination protocols. In particular, a programmable tuple space can express the control part of the coordination protocols in terms of behaviors in response to access events, to free agents from the duty of actually controlling the execution of the protocol.

3.3

Impact on Design and Development

Given the availability of an infrastructure based on programmable local interaction spaces, the adoption of a context-dependent coordination model can have a very

positive impact on the engineering of mobile agent applications. In fact, the model naturally invites in designing an application by clearly separating the intraagent aspects – related to the specific computational roles of the application agents – and the inter-agent ones – related to the interaction of the agents with the other agents of the same application and with the visited execution environments. In other words, the model promotes a clear separation of concerns, which is likely to reduce the complexity of application design. In the case study example, the application designer can independently focus on two different classes of design issues: ? intra-agent engineering: what kind of information my application agents should retrieve on the visited sites? How should they analyze this information and extract useful data from it? How should this data reported back to the user? How should my agents select their itinerary and possibly clone themselves? ? inter-agent engineering: how should my agents influence with each other when they visit the same site? What kind of information should they exchange via the programmable interaction space? The analysis of the inter-agent issues leads to the definition of the application-dependent coordination laws to be spread into the visited sites by application agents, which are independent from the design choices deriving from the analysis of the intra-agent engineering issues. For instance, no matter what the method for information extraction integrated into the application agents, the designer can opt either for having agents retrieve no HTML pages at all from a site that has already been visited in the past, or from having agents retrieve only those HTML pages that have been modified since the last visit. Independent from the role of the application designers and developers is the role of site administrators. When new kinds of application agents are going to be deployed on the Internet, the administrators of one site can design and implement all the environment-dependent coordination laws that they may find it necessary to both facilitate the execution of the agents on their site and protect their site from improper exploitation of the local interaction space. The separation of concerns of the design phase is preserved during the development and maintenance phases too: the code of the agent is separated from the code implementing the coordination laws (whether environmentor application-dependent), and they can be coded, changed, and re-used, independently. In the case study example, if the application developers want to add some more “intelligence” to the agents – e.g., by having them integrate more sophisticated forms of analysis and extraction of data from HTML pages – they can change the code of the agents without influencing at all the code implementing the application-specific

coordination laws. Conversely, it they want to change the application-specific coordination laws they can do that without having to change the code of the agent. As an example, let us suppose that the application-specific coordination laws for the case study make an agent arriving on a site retrieve only those HTML pages hat have been modified since the last visit. However, later in time, the designer ad/or the developers can discover that, to achieve effective information analysis, an agent arriving on a site does not need to analyze only the HTML pages that have been modified since the last visit, but also all those unmodified pages that are linked to the modified ones. Since the coordination laws are clearly separated from the code of the agents, they can be easily integrated in the application by having the unchanged agents distribute over the visited site the updated coordination laws. A similar approach can be followed by the administrator of one site, that can change at any time its environment-specific laws without forcing the agents that wants to visit the site to adapt to the changes.

4.

Context-Dependent MARS

Coordination

in

MARS (Mobile Agent Reactive Spaces), developed at the University of Modena and Reggio Emilia, and described in [4], implements a tuple-based coordination architecture for Java mobile agents whose characteristics make it a suitable infrastructure for context-dependent coordination.

4.1

The MARS Architecture

The MARS architecture is made up of a multiplicity of independent programmable tuple spaces, each one associated to a node and accessed by the agents locally executing in that node (see Figure 2). When an agent arrives on a site, it has to be automatically bound to the interaction space of the local environment, i.e., the local MARS tuple space. Therefore, the only requirement to integrate MARS with a mobile agent system is to make the agent server – in charge of accepting incoming agents – supply agents with a reference to the local MARS tuple space, which can be accessed via Linda-like primitives. To enforce a context-dependent coordination model, the MARS tuple space on a node should be intended as the only resource an agent can access on that node, and it should be therefore exploited for both inter-agent and agent-environment coordination. However, the current MARS architecture is conceived as an additional coordination service for agents, and does not rule out the possibility for agents of exploiting any other form of coordination supported by the agent system.

The Internet
Roaming Application Agent Accesses to NON Local Tuple Spaces FORBIDDEN

Internet Node
Agent 2 Agent 1 Accesses to Local Tuple Space Agent 3

Tuple Spac e
(interface)

Meta-Level Tuple Space
(programmable reactions)

Figure 2. The MARS Architecture
class FileTuple extends AbstractEntry // tuple class { public String FileName; // tuple fields public String Extension; public String Keyword; public Date ModificationTime; public Integer Size; // constructor to initialize the tuple fields public FileTuple(String name, String extension, String keyword, Date modificationTime, Integer size) { FileName = name; Extension = extension; Keyword = keyword; Size = size; ModificationTime = modificationTime; } } // end of class FileTuple … // code fragment for the searcher agent // the agent migrates to a site go_to("interesting.site.com"); // creation of a template tuple FileTuple filePattern = new FileTuple(null, “html”, “coordination”, null, null); … // access the local space to retrieve // all the tuples representing HTML files // related to the given keyword Entry [ ] HTMLFiles = LocalMARSSpace.readAll(filePattern, null, Op.timeout); // the agent accesses the file // to extract relevant information …

(formal) value. Each MARS tuple space, in its turn, is a Java object, instance of a class implementing the MARS interface and extending the JavaSpace one. To access the tuple space, the following operations are provided: ? write, to put a tuple, supplied as the first parameter, in the space; ? read/take, to read/extract a tuple from the space, on the basis of a template tuple supplied as the first parameter and to be used as a pattern for the matching mechanism; ? readAll/takeAll, to read/extract all matching tuples from the space. The template tuple supplied to the input operations can have both defined and null values. A tuple T matches a template tuple U if the defined values of U are equal to the corresponding ones in T. The matching rules take into account the serialized object form and provide for subclass-superclass matching. With reference to the application example, the tuples representing HTML files and the corresponding templates can be implemented by the Java class shown in Figure 3. The figure also show the code fragment of an agent creating an object from this class to define a template and, on a site, use this template to retrieve, via a non-blocking readAll primitive, all the tuples representing HTML files and matching with it.

4.3

The MARS Reactive Model

Figure 3. Fragment of code of a searcher agent

4.2

The MARS Interface

MARS has been designed in compliance with the Sun's JavaSpaces specification. Therefore, as in JavaSpaces, MARS tuples (also called “Entries”) are Java objects whose instance variables represent the tuple fields. Any field of a tuple can have either a defined (actual) or a null

The association of reactions to access events is represented via 4-ples stored in a “meta-level” tuple space. A meta-level tuple has the form of (Rct, T, Op, I): it means that the reaction method (representing the reaction itself) of the object Rct will be triggered when an agent with identity I invokes the operation Op on a tuple/template matching T. Putting and extracting tuples from the meta-level tuple space means installing and uninstalling, respectively, reactions associated to events at the base-level tuple space. A meta-level 4-ple can have some non-defined values, in which case it associates the specified reaction to all the access events that match it. For example, the 4-ple (ReactionObj, null, read, null) in the meta-level tuple space associates the reaction of the ReactionObj instance to all read operations, whatever the tuple type and content and the agent identity. When an access event to the base-level tuple space occurs, MARS issues the pattern-matching mechanism in the meta-level tuple space to look for reactions to be executed in response to the access event. If several 4-ples satisfy the meta-level matching mechanism, all the corresponding reactions are executed in a pipeline, accordingly to their installation order. When a reaction method executes, it is provided with the information about the identity of the agents that has triggered the reaction, the operation it has performed, as well as the output of the matching mechanism (or of the previously executed

reaction in the pipeline). The fact that a reaction can be associated to access events either when performed by agents with a specific identity or independently of the identity of the accessing agents enables for both environment-dependent coordination (the reaction applies to all agents), and application-dependent one (the reaction applies only to specific agents), as exemplified in the following. Environment–Dependent Coordination in MARS. As described in Subsection 3.1, if a site stores its HTML files with the “htm” extension instead of the “html” ones, the administrator can exploit the MARS programmability to enable agents to retrieve anyway information about its HTML files, without forcing them to deal with this heterogeneity and without having the administrator forced to change local filenames or duplicate the FileTuple tuples in both “html” and “htm” forms. The administrator can install the reaction shown in Figure 4, which transforms any request for file tuples with “html” extension into a request for tuples having “htm” as extension field. The reaction can be installed by writing the meta-level tuple:
(HTML2HTM_instance, (null, ”html", null, null, null), readAll, null)

class ReadOnly implements Reactivity { public Entry[ ] reaction(Space s, Entry InputTuples [ ], Entry Template, Operation Op, Identity Id) { // check for the identity of the agent if (Id.equals(manager)) return s.takeAll(Template, null, NO_WAIT); // the administrator can delete the tuples else return InputTuples // otherwise, the tuples are not extracted } // end of method reaction } // end of class ReadOnly

Figure 5. The ReadOnly reaction The behavior of the two above reactions can be combined in a harmless way: the tuple space can be made react with an HTML2HTM-ReadOnly pipeline to takeAll operations requesting for “html” tuples, and have the ReadOnly reaction executed for each of the “htm” tuples returned by the HTML2HTM reaction. Also, the reactions can be designed independently of each other and independently of applications agents, and can be changed/update at any time, without affecting the code of the application agents.
class ModifiedOnly implements Reactivity { private Date visit; // date of the last visit public ModifiedOnly() // set the last visit { visit = new Date(); } public Entry[ ] reaction(Space s, Entry InputTuples [ ], Entry Template, Operation Op, Identity Id) { // for each matching tuple (if any) for (int i = 0; (InputTuples!=null) && (i<InputTuples.length); i++) // if this document was // NOT modified since last visit if (InputTuples[i].ModificationTime.before(visit)) // it is not returned to the agent InputTuples[i] = null; // set the time of the last visit visit = new Date(); // return only the updated tuples // (null elements are purged) return compactArray(InputTuples); } // end of method reaction } // end of class ModifiedOnly

in the meta-level tuple space, to express that the reaction in the object HTML2HTM_instance has to be triggered when any agent issues a readAll operation by providing the template template (null, ”html", null, null, null).
class HTML2HTM implements Reactivity { public Entry [ ] reaction(Space s, Entry InputTuples [ ], Entry Template, Operation Op, Identity Id) // no match already occurred // if the site has only “htm” files { // modifies the extension in the template ((FileTuple)Template).Extension = “htm”; // require matching with new extension Entry [ ] result = s.readAll(Template, null, NO_WAIT); for (int i=0; i < result.length; i++) // change back the extensions in found tuples ((FileTuple)result[i]).Extension = “html”; return result; } // end of method reaction } // end of class HTML2HTM

Figure 4. The HTML2HTM reaction As a second example, when an agent tries to perform an unauthorized takeAll operation on the “html” tuples, the system administrator can decide not to raise any exception, and to let the agent read the content of the matching tuples without deleting them. To this purpose, (s)he can install a reaction that transparently transforms any disruptive takeAll operation, performed by a foreign agent on the FileTuple tuples, into a non-disruptive readAll operation. This reaction is implemented by the ReadOnly class in Figure 5 and can be installed by writing the 4-ple (ReadOnly_instance, (null, “html”, null, null, null), takeAll, null) in the meta-level tuple space.

Figure 6. The ModifiedOnly reaction Application-Dependent Coordination in MARS. As described in Section 3.2, agents can avoid duplicated work on the same site by retrieving information only about the files that have been modified since the last visit. To this end, any agent that visits a site can install a stateful reaction that stores the information about the time of the visit. Then, if further agents of the same application visit again the site and try to access the FileTuple tuples, the reaction provides for returning to it only the tuples related to the files which have been modified. This reaction, implemented by the ModifiedOnly reaction class shown in Figure 6, can be installed by making agents write the 4-ple
(ModifiedOnly_instance, (null, “html”, null, null), readAll,

specific_app_id) in the meta-level specific_app_id is the local identifier

application, making the application. Again, application-specific reactions can be pipelined in a harmless way with the previously described reactions and it can be independently designed and changed without affecting other application components.

tuple space, where for the agent of that reaction affect only that

4.4

The MARS Security Model

MARS assumes that the mobile agent system – like most of the available systems – provides for agent identification and authentication before allowing any agent to execute on one node. On this basis, the main security mechanism provided by MARS is the association of Access Control Lists (ACLs) to tuple spaces and enclosed tuples. Such ACLs define who can do what on tuple spaces and on specific tuples, and the system administrator can decide whether a given operation performed by a given agent on a given tuple is authorized or not. The access control policy based on ACL can then be complemented with a specific security-oriented programming of the tuple space, as described in Subsection 3.1. A similar ACL-based security policy is applied with regard to the meta-level tuple space. This can be used to allow/deny agents to install and uninstall reactions in the meta-level tuple space. At a finer level, one can control which set of access events an agent can influence via reactions, so as to guarantee that an external agent cannot influence – by installing/uninstalling reactions – the activities of other agents but those of its specific application. In other words, an agent must not be allowed to influence those coordination activities occurring in a different application context. To this end, if an unauthorized agent installs a reaction that would potentially apply to agents external to its specific application, the security mechanisms guarantee that the reaction indeed apply only to that specific application agents. For example, if the ModifiedOnly reaction of Figure 6 is installed by an agents writing in the metalevel tuple space the 4-ple (ModifiedOnly_instance, (null, “html”, null, null), readAll, null) (in which the last null field specifies the reaction has to apply to all agents) MARS actually writes the tuple (ModifiedOnly_instance, (null, “html”, null, null), readAll, specific_app_id), in which the last specific_app_id field is the local identifier of the agent of that application.

5.

Related Work

A few of the proposals in the area of Internet agents explicitly focus on coordination models suited to mobility. Also, to our knowledge, none of these proposals explicitly

introduce concepts somehow related to the one of contextdependent coordination. The T Spaces project at IBM [10] defines Linda-like tuple spaces to be used as general-purpose information repositories. T Spaces recognizes the limits of the basic Linda model and integrates a peculiar form of programmability, by enabling new complex primitives (i.e., queries) to be added to a tuple space. This approach makes T Spaces less usable in the open Internet environment, since it requires application agents either to be aware of the operations available in a given tuple space or to somehow dynamically acquire this knowledge. Also, T Spaces does not define architecture conceived to meet the problem of mobility: agents can refer to multiple tuple spaces, whether local or remote, and access them in a location-unaware way. The TuCSoN model [17], developed in the context of an affiliated research project, adopts an architectural model very similar to that of MARS, and enhances it by making it possible for agents to refer to remote tuple spaces via URLs, as an Internet service. This enforces networkawareness and virtual mobility without forcing actual agent mobility. However, in our opinion, this is likely to increase the complexity of the agent, which has to explicitly handle the URLs references to remote tuple space. With regard to the tuple space model, TuCSoN resembles MARS in its full programming capability of tuple spaces, but it defines logic tuple spaces where both tuples and tuple space behaviors are expressed in terms of untyped first-order logic terms, and where unification is the basic patternmatching mechanism. The LIME model faces the problem of handling interactions in the presence of mobility in a more general way, also including mobile users and devices [18]. Each “agent”, whether a software agent, an Internet node, or a physical mobile device, owns and carries on in its movement a tuple space. The agent-owned tuple space is the only medium provided to the agent itself for interactions. Whenever the agent keeps in touch (i.e., gets connected) with another agent, the tuple spaces owned by each of the agents merge together, thus allowing to interact via the merged tuple space. A limited form of reactivity is provided to automatically move tuples across tuple spaces, and to notify agents about the events occurring in their tuple space. Thus, LIME naturally promotes a primitive form of context-dependent coordination: the effect of an agent accessing to its own-tuple space can be very different depending on whether the tuple space is currently merged with other tuple spaces and on which are the specified rules for tuple flowing across tuple spaces. The model of Law-governed interactions, described in [15], addresses the problem of making peer-to-peer coordination within a group of non-mobile agents obey to a set of specified laws. An agent can initiate a group, and fix

the laws to be respected by other agents willing to enter and interact within the group. These laws are typically security-oriented, and express which operations the agents are allowed to perform, and in which order. To enforce these laws, the model dynamically associates a controller process to each agent that joins the group. The controller process intercepts all messages to from the agent and, by coordinating with other controllers, checks their compatibility with the enforced laws. Although the Lawgoverned interaction model does not address in any way the problems related to agent mobility and does not explicitly identify environment-dependent and applicationdependent coordination issues, it has the full potential for enforcing context-dependent coordination in systems of non-mobile agents interacting in a peer-to-peer way.

Computer, Vol. 33, No. 2, pp. 82-89, Feb. 2000. [4] G. Cabri, L. Leonardi, F. Zambonelli, “MARS: a Programmable Coordination Architecture for Mobile Agents”, IEEE Internet Computing, Vol. 4, No. 4, 2000. [5] L. Cardelli, A. D. Gordon, “Mobile Ambients”, Theoretical Computer Science, Vol. 240, No. 1, July 2000. [6] Y. Demazeau, A.C. Rocha Costa, “Populations and Organizations in Open Multi-Agent Systems”, 1st National Symposium on Parallel and Distributed Artificial Intelligence, 1996. [7] E. Denti, A. Natali, A. Omicini, “On the Expressive Power of a Language for Programmable Coordination Media”, Proceedings of the ACM Symposium on Applied Computing, ACM, 1998. [8] T. Finin at al., “KQML as an Agent Communication Language”, 3rd International Conference on Information Knowledge and Management, November 1994. [9] A. Fuggetta, G. Picco, G. Vigna, “Understanding Code Mobility”, IEEE Transactions on Software Engineering, Vol. 24, No. 5, pp. 352-361, May 1998. [10] “T Spaces: the Next Wave”, IBM System Journal, Vol. 37, No. 3, pp. 454-474, 1998. [11] N. R. Jennings, "On Agent-Based Software Engineering", Artificial Intelligence, Vol. 117, No. 2, pp. 277-296, 2000. [12] N. M. Karnik, A. R. Tripathi, “Design Issues in MobileAgent Programming Systems”, IEEE Concurrency, Vol. 6, No. 3, pp. 52-61, July-September 1998. [13] E. A. Kendall, “Role Modelling for Agent Systems Analysis, Design and Implementation”, IEEE Concurrency, 8(2):34-41, April-June 2000. [14] D. B. Lange, M. Oshima, Programming and Deploying Java? Mobile Agents with Aglets?, Addison-Wesley, Reading (MA), August 1998. [15] N.H. Minsky, V. Ungureanu, “Law-Governed Interaction: A Coordination & Control Mechanism for Heterogeneous Distributed Systems”, ACM Transactions of Software Engineering and Methodology, Vol. 9, No. 3, pp. 273-305, July 2000. [16] A.L. Murphy, G.P. Picco, “Reliable Communications for Highly-Mobile Agents”, 1st International Symposium on Agent Systems and Applications, Palm Springs (CA), IEEE CS Press, October 1999. [17] A. Omicini, F. Zambonelli, “Coordination for Internet Application Development”, Journal of Autonomous Agents and Multi-Agent Systems, Vol. 2, No. 3, pp. 251-269, September 1999. [18] G.P. Picco, A.M. Murphy, G.-C. Roman, “LIME: Linda Meets Mobility”, 1999 International Conference on Software Engineering, Los Angeles , ACM Press, 1999. [19] J. White, “Mobile Agents”, in Software Agents, AAAI Press, Menlo Park (CA), pp. 437-472, 1997. [20] F. Zambonelli, N. R. Jennings, A. Omicini, M. J. Wooldridge, “Agent-Oriented Software Engineering for Internet Applications”, in Coordination of Internet Agents, Springer, 2001.

6.

Conclusions and Work in Progress

This paper has introduced the concept of contextdependent coordination for mobile agents, and has shown how this concept can be effectively implemented by exploiting the notion of programmable tuple spaces. Defining a framework in which agent coordination may easily be represented and may be tuned to the specific needs of both applications and environments, can simplify application design and management and may represent an important driving force towards the successful deployment of Internet applications based on mobile agents. Several issues not addressed by this paper still needs to be analyzed: (i) coordination infrastructures must be somehow integrated with Agent Communication Languages [8], to let agents interact in terms of high-level, knowledge-based, information; (ii) role models [11, 13], due to their importance in the analysis and design of multiagent applications, have to be better integrated in the model; (iii) more specific software-engineering methodologies [20] must be defined to help in developing agent-based applications and in devising whether and how to exploit agent mobility and context-dependency.

Acknowledgements
Work supported by the Italian MURST in the project “MUSIQUE – Infrastructure for QoS in Web Multimedia Services with Heterogeneous Access” and by the University of Modena and Reggio Emilia with a found for young researchers.

References
[1] S. Ahuja, N. Carriero, D. Gelernter, “Linda and Friends”, IEEE Computer, Vol. 19, No. 8, pp. 26-34, August 1986. [2] J. Baumann, F. Hohl, K. Rothermel, M. Stra?er, “Mole Concepts of a Mobile Agent System”, The World Wide Web Journal, Vol. 1, No. 3, pp. 123-137, 1998. [3] G. Cabri, L. Leonardi, F. Zambonelli, “Mobile-Agent Coordination Models for Internet Applications”, IEEE


相关文档

更多相关文档

Reggio Emilia Approach
The Role of the Human Teacher in Learning Environments of the Future
R. Posture classification in a multi-camera indoor environment
ENVIRONMENTAL CARCINOGENESIS Environmental and Genetic Risk Factors for Childhood Leukemia
HOUSING QUALITY AND CHILDREN’S
电脑版