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