3APL - A Programming Language for Cognitive Agents
by Mehdi Dastani, Frank Dignum and John-Jules Meyer
The 3APL project (An Abstract Agent Programming Language) aims at developing a programming language to implement cognitive agents and the high level control of cognitive robots.
Many complex applications, such as electronic auctions, electronic markets, or autonomous robots, can be analyzed more intuitively and directly in terms of interacting cognitive agents using high-level concepts such as beliefs, goals, desires, intentions, obligations, actions, plans, and communication. Various tools, specification languages, and architectures are proposed to analyze, specify, and design such cognitive agent systems. However, there has been considerably less attention to developing programming languages for cognitive agents that provide programming constructs to implement high-level concepts directly. This is the objective of the 3APL project.
The 3APL project is carried out at Utrecht University (Institute of Information and Computing Sciences, Intelligent Systems Group) and is partially supported by the Dutch Research Council NWO. The work is closely related to other ongoing research projects such as epistemic and dynamic logics within our group, and AgentSpeak(L) and Golog/Congolog projects outside our group. Although the aim of the AgentSpeak(L) project, carried out at the Australian Artificial Intelligence Institute, was similar to that of 3APL, only a limited set of cognitive concepts can be implemented by their proposed programming language. The aim of Golog/Congolog, under way at Toronto University and Aachen University of Technology, is to develop a programming language to implement the high level control of cognitive robots in dynamic and unpredictable environments. While 3APL provides programming constructs to implement a large set of cognitive concepts, Golog/Congolog concentrates on programming constructs, such as sensing and planning, which are essential for dynamic and unpredictable environments.
The 3APL project has developed a programming language for implementing cognitive agents with beliefs, observations, actions, goals, communication, and reasoning rules. In particular, agents' observations and beliefs can be implemented in 3APL by a subset of first-order predicate language (prolog-like facts and rules). The actions are implemented as triples consisting of action name together with pre- and post-conditions. The pre- and post-conditions of actions are belief formulae indicating the condition under which the action can be performed and the effect of the action after it is performed, respectively. The goals that can be implemented in 3APL are procedural or to-do goals, which can be implemented by expressions of an imperative language. These expressions are formed by applying constructs such as sequence, test, conditional choice, and recursion to actions and belief formulae. Communication can be implemented by the pre-defined send-message action. Finally, reasoning rules can be used to implement the generation of goals, the revision of actions that are blocked, the revision of goals that are not achievable, the optimization of goals, etc.
We have also developed an interpreter that executes 3APL programs. The interpreter implements the so-called deliberation process that involves many activities such as applying reasoning rules, selecting goals to be achieved and actions to be executed. The interpreter is implemented in JAVA. A JAVA class, called 3APL Class, has been developed. This class has private attributes that represent cognitive concepts such as beliefs, goals, basic actions, and practical reasoning rules. The 3APL class has two main methods: one method for the creation of the 3APL object through which the programmed cognitive concepts are parsed and represented by the corresponding private attributes, and one method for the actual execution of the object. The latter method corresponds to the deliberation cycle of 3APL. The architecture of the cognitive agents that can be programmed by 3APL is illustrated in Figure 1.
The 3APL Agent Architecture.
Different applications require different deliberation processes, ie there is no single universal deliberation process. Therefore, the deliberation process of cognitive agents should be controlled by the programmer. This implies that the deliberation process itself should be programmable. We have thus designed two programming languages: an object-level and a meta-level language. The object-level language has been recently extended with programming constructs to implement declarative (to-be) goals and plans. The meta-level language includes terms that refer to object-level entities such as goals, actions, plans, and rules, and imperative programming constructs to implement how to process the object-level entities. The current state of the 3APL project provides the formal specification of the syntax and semantics of the two programming languages. The semantics of these languages are defined in terms of transition systems.
We have used 3APL to implement the high level control of moving robots. This is achieved by extending the object-level language with physical actions. One problem with physical actions is that their post-conditions are not known beforehand. We have coupled the 3APL interpreter to the control software (ARIA) of activmedia robots. This coupling translates 3APL basic actions to robot actions, and uses the robot's sensor information to set the post-conditions of the physical actions. Several future activities are planned, including the extension of the interpreter to execute the declarative goals and the meta-level programs, and setting communication between agents according to the FIPA (Foundation for Intelligent Physical Agents) standards. Moreover, we are implementing an agent platform that can be installed on various machines. Agents from different platforms can communicate. Various materials including the current interpreter, some examples of 3APL programs, and various publications are available on the project web page.
Project web page: http://www.cs.uu.nl/3apl/
Mehdi Dastani, University of Utrecht, The Netherlands
Tel: +31 30 253 3599