Exploiting Agent-Oriented Programming for Building Advanced Web 2.0 Applications Mattia Minotti Andrea Santi Alessandro Ricci University of Bologna DEIS, University of Bologna DEIS, University of Bologna Cesena, Italy Cesena, Italy Cesena, Italy Email: mattia.minotti@studio.unibo.it Email: a.santi@unibo.it Email: a.ricci@unibo.it Abstract—We believe that agent-oriented programming lan- JaCa and – more generally – agent-oriented programming a guages and multi-agent programming technologies provide an suitable paradigm for tackling main complexities of software effective level of abstraction for tackling the design and pro- applications, advanced Web applications in this case, that gramming of mainstream software applications, besides being techniques effective for dealing with (Distributed) Artificial – we argue – are not properly addressed by mainstream Intelligence problems. In this paper we support this claim in programming languages, such as object-oriented ones. In that, practice by discussing the use of a platform integrating two main this work extends a previous one [12] where we adopted a agent programming technologies – Jason agent programming Java-based framework called simpA [20] to this end, replaced language and CArtAgO environment programming framework in this paper Jason so as to exploit the features provided by – to the development of Web 2.0 applications. Following the cloud computing perspective, these kinds of applications will the Belief-Desire-Intention (BDI) architecture. more and more replace desktop applications, exploiting the Web The remainder of the paper is organised as follows. First, we infrastructure as a common distributed operating system, raising provide a brief overview of JaCa (Section II) programming however challenges that are not effectively tackled – we argue model and platform. Then, we discuss the use of JaCa for – by mainstream programming paradigms, such as the object- developing Web 2.0 applications (Section III), remarking the oriented one. advantages compared to existing state-of-the art approaches. To evaluate the approach, we describe the design and imple- I. I NTRODUCTION mentation of a case study (Section IV), and we conclude the The value of Agent-Oriented Programming (AOP) [21] – in- paper by discussing related and future work (Section V). cluding Multi-Agent Programming (MAP) – is often remarked and evaluated in the context of Artificial Intelligence (AI) II. AGENT-O RIENTED P ROGRAMMING FOR M AINSTREAM and Distributed AI problems. This is evident, for instance, by A PPLICATION D EVELOPMENT – T HE JaCa A PPROACH considering existing agent programming languages (see [6], An application in JaCa is designed and programmed as [7] for comprehensive surveys) – whose features are typically a set of agents which work and cooperate inside a com- demonstrated by considering AI toy problems such as block mon environment. Programming the application means then worlds and alike. Besides this view, we argue that the level programming the agents on the one side, encapsulating the of abstraction introduced by AOP is effective for organizing logic of control of the tasks that must be executed, and and programming software applications in general, starting the environment on the other side, as first-class abstraction from those programs that involve aspects related to reactivity, providing the actions and functionalities exploited by the asynchronous interactions, concurrency, up to those involving agents to do their tasks. More specifically, in JaCa Jason [5] different degrees of autonomy and intelligence. In that context, is adopted as programming language to implement and execute an important example is given by Web 2.0 applications, the agents and CArtAgO [18] as the framework to program which share more and more features with desktop applications, and execute the computational environments where agents are combining their better user experience with all the benefits situated. provided by the Web, such as distribution, openness and Being a concrete implementation of an extended version accessibility. Applications of this kind are at the core of the of AgentSpeak(L) [16], Jason adopts a BDI (Belief-Desire- cloud computing vision. Intention)-based computational model and architecture to de- In this paper we show this idea in practice by describing fine the structure and behaviour of individual agents. In that, a platform for developing Web 2.0 applications using agent agents are implemented as reactive planning systems: they run programming technologies, in particular Jason for program- continuously, reacting to events (e.g., perceived changes in the ming agents and CArtAgO for programming the environments environment) by executing plans given by the programmer. where agents work. We refer to the integrated use of Jason Plans are courses of actions that agents commit to execute and CArtAgO as JaCa and its application for building Web so as to achieve their goals. The pro-active behaviour of 2.0 application as JaCa-Web. Besides describing the plat- agents is possible through the notion of goals (desired states form, our aim here is to discuss the key points that make of the world) that are also part of the language in which plans 55 are written. Besides interacting with the environment, Jason extended to manage also (Java) objects, so as to work with data agents can communicate by means of speech acts. exchanged by performing actions and processing percepts. On the environment side, CArtAgO – following the A&A A full description of Jason language/platform and meta-model [13], [19] – adopts the notion of artifact as first- CArtAgO framework – and their integration – is out of the class abstraction to define the structure and behaviour of such scope of this paper: the interested reader can find details in computational environments and the notion of workspace as a literature [18], [17] and on Jason and CArtAgO open-source logical container of agents and artifacts. Artifacts explicitly web sites12 . represent the resources and tools that agents may dynami- cally instantiate, share and use, encapsulating functionalities III. P ROGRAMMING W EB 2.0 A PPLICATIONS WITH JaCa designed by the environment programmer. In order to be used In this section, we describe how the features of JaCa can be by the agents, each artifact provides of a usage interface exploited to program complex Web 2.0 applications, providing composed by a set of operations and observable properties. benefits over existing approaches. First, we sketch the main Operations correspond to the actions that the artifact makes complexities related to the design and programming of modern it available to agents to interact with such a piece of the and future web applications; then we describe how these are environment; observable properties define the observable state addressed by JaCa-Web, which is a framework on top of of the artifact, which is represented by a set of information JaCa to develop such a kind of applications. items whose value (and value change) can be perceived by agents as percepts. Besides observable properties, the execu- A. Programming Future Web Applications: Complexities tion of operations can generate signals perceivable by agents as percepts, too. As a principle of composability, artifacts can be Due to network speed problems overcoming and machine assembled together by a link mechanism, which allows for an computational power increasing, the client-side of so-called artifact to execute operations over another artifact. CArtAgO rich web applications is constantly evolving in terms of com- provides a Java-based API to program the types of artifacts that plexity. Web 2.0 applications share more and more features can be instantiated and used by agents at runtime, and then with desktop applications in order to combine their better an object-oriented data-model for defining the data structures user experience with all Web benefits, such as distribution, in actions, observable properties and events. openness and accessibility. One of the most important features Finally, the notion of workspace is used to define the of Web 2.0 is a new interaction model between the client topology of complex environments, that can be organised user interface of a Web browser and the server-side of the as multiple sub-environments, possibly distributed over the application. Such rich Web applications allow the client to network. By default, each workspace contains a predefined send multiple concurrent requests in an asynchronous way, set of artifact created at boot time, providing basic actions to avoiding complete page reload and keeping the user interface manage the set of artifacts in the workspace – for instance, live and responding. Periodic activities within the client-side to create, lookup, link together artifacts – to join multiple of the applications can be performed in the same fashion, with workspaces, to print message on the console, and so on. clear advantages in terms of perceived performance, efficiency JaCa integrates Jason and CArtAgO so as to make the and interactivity. use of artifact-based environments by Jason agents seamless. So the more complex web apps are considered, the more To this purpose, first, the overall set of external actions that a the application logic put on the client side becomes richer, Jason agent can perform is determined by the overall set of eventually including asynchronous interactions – with the user, artifacts that are actually available in the workspaces where with remote services – and possibly also concurrency – due to the agent is working. So, the action repertoire is dynamic and the concurrent interaction with multiple remote services. This can be changed by agents themselves by creating, disposing situation is exemplified by cloud computing applications, such artifacts. Then, the overall set of percepts that a Jason as Google doc3 . agent can observe is given by the observable properties and The direction of decentralizing responsibilities to the client observable events of the artifacts available in the workspace at is evident also by considering the new HTML standard 5.0, runtime. Actually an agent can explicitly select which artifacts which enriches the set of API and features that can be used to observe, by means of a specific action called focus. By ob- by the web application on the client side4 . Among the others, serving an artifact, artifacts’ observable properties are directly some can have a strong impact on the way an application mapped into beliefs in the belief-base, updated automatically is designed: it is the case of the Web Worker mechanism5 , each time the observable property changes its value. So a which makes it possible to spawn background workers running Jason agent can specify plans reacting to changes to beliefs scripts in parallel to their main page, allowing for thread-like that concern observable properties or can select plan according operation with message-passing as coordination mechanism. to the value of beliefs which refer to observable properties. 1 http://jason.sourceforge.net Artifacts’ signals instead are not mapped into the belief base, 2 http://cartago.sourceforge.net but processed as non persistent percepts possibly triggering 3 http://docs.google.com plans—like in the case of message receipt events. Finally, the 4 http://dev.w3.org/html5/spec/ Jason data-model – essentially based on Prolog terms – is 5 http://www.whatwg.org/specs/web-workers/current-work/ 56 prime-app-workspace primeService1 checkPrime HTTP numGen RemotePrimeService myPage PrimeSearcher current 8 maxnum 100 nprimes 4 nextNum incPrimes primeService2 User checkPrime PrimeSearcher checkPrime JaCa-Web Artifacts Jason CArtAgO Web tech (JavaScript, Java Virtual Machine LiveConnect, ...) Browser Fig. 1. An abstract overview of a JaCa-Web application, referring in particular to the toy example described in the paper. In evidence: (Top) the workspace with the agents (circles) and artifacts (rounded square); among the artifacts, myPage and primeService1 enable and rule the interaction with the external environment sources, namely the human user and the remote HTTP service; (Bottom) the layers composing the JaCa-Web platform, which includes – on top of the Java Virtual Machine and browser/web infrastructure – Jason and CArtAgO sub-system and then a pre-defined library of artifacts (JaCa-Web artifacts) specifically designed for the Web context. Another one is cross-document messaging6 , which defines B. An Agent-Oriented Programming Approach based on JaCa mechanisms for communicating between browsing contexts in By exploiting JaCa, we directly program the Web 2.0 HTML documents. application as a normal JaCa agent program, composed by Besides devising enabling mechanisms, a main issue is then a workspace with one or multiple agents working within an how to design and program applications of this kind [11]. artifact-based environment including a set of pre-defined type A basic and standard way to realise the client side of web of artifacts specifically designed for the Web context domain app is to embed in the page scripts written in some scripting (see Fig. 1). Generally speaking, agents are used to encapsulate language – such as JavaScript. Originally such scripts were the logic of control and execution of the tasks that characterise meant just to perform check on the inputs and to create the Web 2.0 app, while artifacts are used to implement the visual effects. The problem is that scripting languages – like environment needed for executing the tasks, including those JavaScript – have not been designed for programming in the coordination artifacts that can ease the coordination of the large, so using them to organize, design, implements complex agents’ work. As soon as the page is downloaded by the programs is hard and error-prone. browser, the application is launched – creating the workspace, To address the problems related to scripting languages, the initial set of agents and artifacts. higher-level approaches have been proposed, based on frame- Among the pre-defined types of artifact available in the works that exploit mainstream object-oriented programming workspace, two main ones are the Page artifact and the languages. A main example is Google Web Toolkit (GWT)7 , HTTPService artifact. Page provides a twofold functionality to which allows for developing client-side apps with Java. This agents: (i) to access and change the web page, internally ex- choice makes it possible to reuse and exploit all the strength ploiting specific low-level technology to work with the DOM of mainstream programming-in-the-large languages that are (Document Object Model) object, allowing for dynamically typically not provided by scripting languages—an example updating its content, structure, and visualisation style; (ii) to is strong typing. However it does not provide significant make events related to user’s actions on the page observable to improvement for those aspects that are still an issue for OO agents as percepts. An application may either exploit directly programming languages, such as concurrency, asynchronous Page or define its own extension with specific operations and events and interactions, and so on. observable properties linked to the specific content of the We argue then that these aspects can be effectively cap- page. HTTPService provides basic functionalities to interact tured by adopting an agent-oriented level of abstraction and with a remote HTTP service, exploiting and hiding the use of programmed by exploiting agent-oriented technologies such as sockets and low-level mechanisms. Analogously to Page, this JaCa: in next section we discuss this point in detail. kind of artifact can be used as it is – providing actions to do HTTP requests – or can be extended providing an higher-level 6 http://dev.w3.org/html5/postmsg/ application specific usage interface hiding the HTTP level. 7 http://code.google.com/webtoolkit/ To exemplify the description of these elements and of JaCa- 57 00 !setup. Web programming in the overall, in the following we consider 01 02 +!setup a toy example of Web 2.0 app, in which two agents are used 03 <- focusByName("MyPage"); to search for prime numbers up to a maximum value which 04 makeArtifact("primeService1", "RemotePrimeService"); can specified and dynamically changed by the user through the 05 makeArtifact("numGen","NumGen"). web page. As soon as an agent finds a new prime number, a 06 07 +start field on the the web page reporting the total number of values 08 <- focusByName("primeService1"); is updated. 09 focusByName("numGen"); 10 !!checkPrimes. The environment (shown in Fig. 1) includes – besides 11 the artifact representing the page, called here myPage – an 12 +!checkPrimes 13 <- nextNum(Num); artifact called numGen, functioning as a number generator, 14 !checkNum(Num). shared and used by agents to get the numbers to verify, 15 16 +!checkNum(Num): maxnum(Max) & Num <= Max and two artifacts, primeService1 and primeService2, 18 <- checkPrime(Num); providing the (same) functionality that is verifying if a number 18 !checkPrimes. 19 is prime. 20 +!checkNum(Num) <- maxnum(Max) & Num > Max. myPage is an instance of MyPage extending the basic Page 21 22 +is_prime(Num) <- incPrimes. artifact so as to be application specific, by: (i) defining an 23 observable property maxnum whose value is directly linked to 24 +stop <- .drop_intention(checkPrimes). the related input field on the web page; (ii) generating start and stop signals as soon as the page button controls start Fig. 2. Jason source code of a prime searcher agent. and stop are pressed; (ii) defining an operation incPrimes that updates the output field of the page reporting the actual public class MyPage extends PageArtifact { number of prime numbers found. protected void setup() { numGen is an instance of the NumGen artifact (see Fig. 3), defineObsProperty("maxnum",getMaxValue()); //Operation for event propagation which provides an action getNextNum to generate a new linkEventToOp("start","click","startClicked"); number – retrieved as output (i.e. action feedback) parameter. linkEventToOp("stop","click","stopClicked"); linkEventToOp("maxnum","change","maxnumChange"); The two prime number service artifacts provide the } same usage interface, composed by a checkPrime(num: @OPERATION void incPrimes(){ Elem el = getElementById("primes_found"); integer) action, which generates an observable event el.setValue(el.intValue()+1); is_prime(num: integer) if the number is found } @INTERNAL_OPERATION private void startClicked(){ to be prime. One artifact does the computation locally signal("start"); (LocalPrimeService); the other one, instead – which is } @INTERNAL_OPERATION private void stopClicked(){ an instance of RemotePrimeService, extending the pre- signal("stop"); defined HTTPService artifact – provides the functionality by } @INTERNAL_OPERATION private void maxnumChange(){ interacting with a remote HTTP service. updateObsProperty("maxnum",getMaxValue()); Fig. 2 shows the source code of one of the two agents. } private int getMaxValue(){ After having set up the tools needed to work, the agent waits return getElementById("maxnum").intValue(); to perceive a start event generated by the page. Then, it } } starts working, repeatedly getting a new number to check – by executing a getNextNum – until the maximum number is public class RemotePrimeService extends HTTPService { achieved. The agent knows such a maximum value by means @OPERATION void checkPrime(double n){ of the maxnum page observable property—which is mapped HTTPResponse res = doHTTPRequest(serverAddr,"isPrime",n); onto the related agent belief. The agent checks the number if (res.getElem("is_prime").equals("true")){ by performing the action checkPrime and then reacting signal("is_prime",n); } to is_prime(Num: integer) event, updating the page } by performing incPrimes. If a stop event is perceived – } which means that the user pressed the stop button on the Web public class NumGen extends Artifact { page – the agent promptly reacts and stops working, dropping void init(){ defineObsProperty("current",0); } its main intention. @OPERATION void nextNum(OpFeedbackParam res){ int v = getObsProperty("current").intValue(); A final note about implementation: Java applet technology updateObsProperty("current",++v); is used to run the full application stack (including Jason res.set(v); } and CArtAgO) in the browser, using signed applets so to } avoid limitations imposed by the sandbox model. LiveConnect technology8 is exploited to enable a bi-direction interaction Fig. 3. Artifacts’ definition in CArtAgO: MyPage and between the applet and the web page resources (DOM, scripts). RemotePrimeService extending respectively PageArtifact and HTTPService artifact types which are available by default in 8 https://jdk6.dev.java.net/plugin2/liveconnect/ JaCa-Web workspaces, and NumGen to coordinate number generation and sharing. 58 C. Key points other side, basic low-level mechanisms to interact and exploit the Web infrastructure are wrapped inside artifacts, whose We have identified three key points that, in our opinion, functionalities are seamlessly exploited by agents in terms of represent main benefits of adopting agent-oriented program- actions (operations) and percepts (observable properties and ming and, in particular, the JaCa-Web programming model, events). Also, application specific artifacts – such as NumGen for developing applications of this kind. – can be designed to both encapsulate shared data structures First, agents are first-class abstractions for mapping possibly useful for agents’ work and regulate their access by agents, concurrent tasks identified at the design level, so reducing functioning as a coordination mechanism. the gap from design to implementation. The approach allows for choosing the more appropriate concurrent architecture, IV. A C ASE S TUDY allocating more tasks to the same kind of agent or defining To stress the features of agent-oriented programming and multiple kind of agents working concurrently. This allows test-drive the capabilities of the JaCa-Web framework, we for easily programming Web 2.0 concurrent applications, that developed a real-world Web application – with features that are able to exploit parallel hardware on the client side (such go beyond the ones that are typically found in current Web as multi-core architectures). In the example, two agents are 2.0 app. The application is about searching products and used to fairly divide the overall job and work concurrently, comparing prices from multiple services, a “classic” problem exploiting the number generator artifact as a coordination tool ton the Web. to share the sequence of numbers. Actually, changing the We imagine the existence of N services that offer product solution by using a single agent or more than two agents would lists with features and prices, codified in some standard not require any substantial change in the code. machine-readable format. The client-side in the Web applica- A second key point provided by the agent control architec- tion needs to search all services for a product that satisfies a set ture is the capability of defining task-oriented computational of user-defined parameters and has a price inferior to a certain behaviours that straightforwardly integrate the management of user-defined threshold. The client also needs to periodically asynchronous events generated by the environment – such as monitor services so as to search for new offerings of the the input of the user or the responses retrieved from remote same product. A new offering satisfying the constraints should services – and the management of workflows of possibly be visualised only when its price is more convenient than articulated activities, which can be organized and structured the currently best price. The client may finish its search and in plans and sub-plans. This makes it possible to avoid the monitoring activities when some user-defined conditions are typical problems produced by the use of callbacks – that can met—a certain amount of time is elapsed, a product with be referred as asynchronous spaghetti code – to manage events a price less than a specified threshold is find, or the user within programs that need – at the same time – to have one interrupts the search with a click on a proper button in the or multiple threads of control. page displayed by the browser. Finally, if such an interruption In the prime searcher agent shown in the example, for took place, by pressing another button it must be possible to instance, on the one hand we use a plan handling the let the search continue from the point where it was blocked. checkPrimes goal to pro-actively search for prime num- Typically applications of this kind are realised by im- bers. The plan is structured then into a subgoal checkNum to plementing all the features on the server side, without – process the number retrieved by interacting with the number however – any support for long-term searching and monitoring generator. Then, the plan executed to handle this subgoal capabilities. In the following, we describe a solution based on depends on the dynamic condition of the system: if the number JaCa-Web, in which responsibilities related to the long-term to process is greater than the current value of the maxnum search and comparison are decentralised into the client side of page observable property (i.e. of its related agent belief), then the application, improving then the scalability and quality of no checks are done and the goal is achieved; otherwise, the service for the users. number is checked by exploiting a prime service available in the environment and the a new checkPrimes goal is A. Application Design issued to go on exploring the rest of the numbers. The user The solution includes two kinds of agents (see Fig. 4): a can dynamically change the value of the maximum number to UserAssistant agent – which is responsible of setting up the explore, and this is promptly perceived by the agents which application environment and manage interaction with the user can change then their course of actions accordingly. On the – and multiple ProductFinder agents, which are responsible to other hand, reactive plans are used to process asynchronous periodically interact with remote product services to find the events from the environment, in particular to process incoming products satisfying the user-defined parameters. To aggregate results from prime services (line 22) and user input to stop the data retrieved from services and coordinate the activities of research (line 24). the UserAssistant and ProductFinder we introduce a Product- Finally, the third aspect concerns the strong separation of Directory artifact, while a MyPage page artifact and multiple concerns which is obtained by exploiting the environment as instances of ProductService artifacts are used respectively by first class abstraction. Jason agents, on the one side, encap- the UserAssistant and ProductFinder to interact with the user sulates solely the logic and control of tasks execution; on the and with remote product services. 59 Fig. 4. The architecture of the client-side Web application sample in terms of agent, artifacts, and their interactions. UA is the UserAgent, PFs are the ProductFinder agents, PD is the ProductDirectory artifact and finally Services are the ProductService artifacts // ProductFinder agent More in detail, the UserAssistant agent is the first agent booted on the client side, and it setups the application environ- ... ment by creating the ProductDirectory artifact and spawning +searchState("start") a number of ProductFinder agents, one for each service to <- focus("service1"); !!search. monitor. Then, by observing the MyPage artifact, the agent monitors user’s actions and inputs. In particular, the web +!search: keywords(Keywords) <- requestProducts(Keywords,ProductList); page provides controls to start, stop the searching process and !processProducts(ProductList, to specify and change dynamically the keywords related to ProductsToAdd, ProductsToRemove); the product to search, along with the conditions to possibly addProducts(ProductsToAdd); terminate the process. Page events are mapped onto start removeProducts(ProductsToRemove); .wait({+keywords(_)},5000,_); and stop observable events generated by MyPage, while !search. specific observable properties – keywords and termination +searchState("stop") conditions – are used to make it observable the input infor- <-.drop_intention(search). mation specified by the user. The UserAssistant reacts to these observable events and Fig. 5. A snippet of ProductFinder agent’s plans. to changes to observable properties, and interacts with Pro- ductFinder agents to coordinate the searching process. The interaction is mediated by the ProductDirectory artifact, remote product service by means of a private ProductService which is used and observed by both the UserAssistant artifact, which extends a HTTPService artifact providing an and ProductFinders. In particular, this artifact provides a operation (requestProducts) to directly perform high- usage interface with operations to: (i) dynamically update level product-oriented requests, hiding the HTTP level. the state and modality of the searching process – in par- ticular startSearch and stopSearch to change the B. Implementation value of a searchState observable property – useful The source code of the application can be consulted on to coordinate agents’ work – and changeBasePrice, the JaCa-Web web site9 , where the interested reader can changeKeywords to change the value of the base price find also the address of a running instance that can be used and the keywords describing the product, which are stored in a for tests. Here we just report a snippet of the ProductFinder keyword observable property; (ii) aggregate product informa- agents’ source code (Fig. 5), with in evidence (i) the plans tion found by ProductFinders – in particular addProducts, used by the agent to react to changes to the search state removeProducts, clearAllProducts to respectively property perceived from the ProductDirectory artifact - adding add and remove a product, and remove all products found so and removing a new search goal, and (ii) the plan used far. Besides searchState and keywords, the artifact has to achieve that goal, first getting the product list by means further observable properties, bestProduct, to store and of the requestProducts operation and then updating the make it observable the best product found so far. Finally, each ProductFinders periodically interact with a 9 http://jacaweb.sourceforge.net 60 ProductDirectory accordingly by adding new products and environment in order to reach a user-defined goal, and nego- removing products no more available. It is worth noting the tiating, collaborating, and interacting with each other during use of the keywords belief – related to the keywords their activities. So, a main future work accounts for extending observable property of the ProductDirectory artifact – in the the JaCa-Web platform with Semantic Web technologies: to context condition of the plan to automatically retrieve and this purpose, existing works such as JASDL [10] and the NUIN exploit updated information about the product to search. project [8] will be main references. V. R ELATED W ORKS AND C ONCLUSION R EFERENCES [1] JADE gateway agent (JADE 4.0 api) – http://jade.tilab.com/doc/api/jade/ To conclude, we believe that agent-oriented programming – wrapper/gateway/jadegateway.html. including multi-agent programming – would provide a suitable [2] Agent Oriented Software Pty. JACK intelligent agents webbot man- level of abstraction for tackling the development of com- ual – http://www.aosgrp.com/documentation/jack/webbot manual web/ index.html#thejackwebbotarchitecture. plex software applications, extending traditional programming [3] F. L. Bellifemine, G. Caire, and D. Greenwood. Developing Multi-Agent paradigms such as the Object-Oriented to deal with aspects Systems with JADE. Wiley, 2007. such as concurrency, reactiveness, asynchronous interaction [4] T. Berners-Lee, J. Hendler, and O. Lassila. The Semantic Web. Scientific American, 2001. managements, dynamism and so on. In this paper, in particular, [5] R. Bordini, J. Hübner, and M. Wooldridge. Programming Multi-Agent we discussed the advantages of applying such an approach to Systems in AgentSpeak Using Jason. John Wiley & Sons, Ltd, 2007. the development of Web 2.0 advanced applications, exploiting [6] R. e. a. Bordini, editor. Multi-Agent Programming: Languages, Plat- forms and Applications (vol. 1). Springer, 2005. the JaCa integrated platform. [7] R. e. a. Bordini, editor. Multi-Agent Programming: Languages, Plat- Concerning the specific application domain, several frame- forms and Applications (vol. 2). Springer Berlin / Heidelberg, 2009. works and bridges have been developed to exploit agent tech- [8] I. Dickinson. BDI Agents and the Semantic Web: Developing User- Facing Autonomous Applications. PhD thesis, University of Liverpool, nologies for the development of Web applications. Main exam- September 2006. ples are the Jadex Webbridge [14], JACK WebBot [2] and the [9] J. Hendler. Agents and the Semantic Web. IEEE Intelligent Systems, JADE Gateway Agent [1]. The Webbridge Framework enables 16(2):30–37, 2001. [10] T. Klapiscak and R. H. Bordini. JASDL: A practical programming ap- a seamless integration of the Jadex BDI agent framework [15] proach combining agent and semantic web technologies. In Declarative with JSP technology, combining the strength of agent-based Agent Languages and Technologies VI, volume 5397/2009 of LNCS, computing with Web interactions. In particular, the framework pages 91–110, Berlin, Heidelberg, 2009. Springer-Verlag. [11] T. Mikkonen and A. Taivalsaari. Web applications: spaghetti code for extends the the Model 2 architecture – which brings the the 21st century. Technical report, Mountain View, CA, USA, 2007. Model-View-Controller (MVC) pattern in the context of Web [12] M. Minotti, G. Piancastelli, and A. Ricci. An agent-based program- application development – to include also agents, replacing ming model for developing client-side concurrent web 2.0 applications. In J. Filipe and J. Cordeiro, editors, Web Information Systems and the controller with a bridge to an agent application, where Technologies, volume 45 of Lecture Notes in Business Information agents react to user requests. JACK WebBot is a framework Processing. Springer Berlin Heidelberg, 2010. on top of the JACK BDI agent platform which supports the [13] A. Omicini, A. Ricci, and M. Viroli. Artifacts in the A&A meta-model for multi-agent systems. Autonomous Agents and Multi-Agent Systems, mapping of HTTP requests to JACK event handlers, and the 17 (3), Dec. 2008. generation of responses in the form of HTML pages. Using [14] A. Pokahr and L. Braubach. The webbridge framework for building WebBot, you can implement a web application which makes web-based agent applications. pages 173–190, 2008. [15] A. Pokahr, L. Braubach, and W. Lamersdorf. Jadex: A BDI reasoning use of JACK agents to dynamically generate web pages in engine. In R. Bordini, M. Dastani, J. Dix, and A. E. F. Seghrouchni, response to user input. Finally, the JADE Gateway Agent is editors, Multi-Agent Programming. Kluwer, 2005. a simple interface to connect any Java non-agent application [16] A. S. Rao. Agentspeak(l): BDI agents speak out in a logical computable language. In MAAMAW ’96: Proceedings of the 7th European workshop – including Web Applications based on Servlets and JSP – to on Modelling autonomous agents in a multi-agent world, pages 42–55. an agent application running on the JADE platform [3]. Springer-Verlag New York, Inc., 1996. All these approaches explore the use of agent technologies [17] A. Ricci, M. Piunti, L. D. Acay, R. Bordini, J. Hübner, and M. Das- tani. Integrating artifact-based environments with heterogeneous agent- on the server side of Web Applications, while in our work programming platforms. In Proceedings of 7th International Conference we focus on the client side, which is what characterises Web on Agents and Multi Agents Systems (AAMAS08), 2008. 2.0 applications. So – roughly speaking – our agents are [18] A. Ricci, M. Piunti, M. Viroli, and A. Omicini. Environment pro- gramming in CArtAgO. In R. H. Bordini, M. Dastani, J. Dix, and running not on a Web server, but inside the Web browser, A. El Fallah-Seghrouchni, editors, Multi-Agent Programming: Lan- so in a fully decentralized fashion. Indeed, these two views guages, Platforms and Applications, Vol. 2, pages 259–288. Springer, can be combined together so as to frame an agent-based way 2009. [19] A. Ricci, M. Viroli, and A. Omicini. The A&A programming model & to conceive next generation Web applications, with agents technology for developing agent environments in MAS. In M. Das- running on both the client and server side. tani, A. El Fallah Seghrouchni, A. Ricci, and M. Winikoff, editors, Finally, the use of agents to represent concurrent and Programming Multi-Agent Systems, volume 4908 of LNAI, pages 91– 109. Springer Berlin / Heidelberg, 2007. interoperable computational entities already sets the stage for [20] A. Ricci, M. Virolil, and G. Piancastelli. simpA: A simple agent-oriented a possible evolution of Web 2.0 applications into Semantic Java extension for developing concurrent applications. In M. Dastani, Web applications [4]. From the very beginning [9], research A. E. F. Seghrouchni, J. Leite, and P. Torroni, editors, Languages, Methodologies and Development Tools for Multi-Agent Systems, volume activity on the Semantic Web has always dealt with intelligent 5118 of LNAI, pages 176–191, Durham, UK, 2007. Springer-Verlag. agents capable of reasoning on machine-readable descriptions [21] Y. Shoham. Agent-oriented programming. Artificial Intelligence, of Web resources, adapting their plans to the open Internet 60(1):51–92, 1993. 61