peer-to-peer and agent-based computing Agent-Based Computing: tools, languages and case studies (Cont’d) Agent Programming Languages • Agent-oriented programming languages – Not essential, BUT make life easier… • Do you know of a specific functionality that can only be implemented with a particular programming language? – Special-purpose programming languages increase productivity as they offer higher-level constructs • Particular aspects of the targeted domain are easier to explore • Agent-oriented programming languages are useful – However, there are many out there and many more are appearing… – Let’s look at some of them! peer-to-peer and agent-based computing 2 AgentSpeak • Influential abstract programming language • Uses the BDI agent model (we’ll see more about it) – Beliefs: what the agent believes about the environment – Desires: what the agent needs to achieve – Intentions: plans to fulfil the desires peer-to-peer and agent-based computing 3 AgentSpeak Architecture peer-to-peer and agent-based computing 4 AgentSpeak Control Loop 1. Agent receives events which are either – External (from the environment or from sensors) – Internally generated Events (news and existing ones) are beliefs 2. Agent looks for plans that match events – Matching plans become desires 3. Agent chooses one plan from its desires to execute – Chosen plan is an intention 4. Execute chosen plan – During execution of plan, new events arise – go to 1 peer-to-peer and agent-based computing 5 AgentSpeak: Beliefs • Beliefs represent information the agent has – About the environment – About its own internal state • Encoded as ground first-order logic predicates sensor(temperature, 30) sensor(smoke, low) sensor(movement, detected) status(light, on) status(door, closed) status(window, open) peer-to-peer and agent-based computing 6 AgentSpeak: Plans • Created off-line (manually or via planning systems) • Provide agents with a description of the actions it should perform: – How to respond to events (e.g., if fire detected, then enact the plan to put out fire and alert fire brigade) – How to achieve goals (e.g., how to book a flight from Dundee to Paris) • Plan structure: – Trigger condition: an event the plan can handle – Context: conditions under which plan can be used – Body: actual actions comprising the plan peer-to-peer and agent-based computing 7 AgentSpeak: Plans (Cont’d) • Format: TriggeringEvent : Context <- Body • Meaning: – If TriggeringEvent arises and – Context holds in the current set of beliefs then – Execute Body peer-to-peer and agent-based computing 8 AgentSpeak: Events • • • • Achieve goal P: +!P Drop goal P: -!P Add new belief B: +B Drop belief B: -B peer-to-peer and agent-based computing 9 AgentSpeak: “Hello World” /* Initial goals */ !start. Agent has a single initial goal /* Plans */ +!start : true <- .print("hello world."). There is one single plan: • if you have acquired goal “start” then • when “true” holds (it always does) • carry out the single step plan “print(“hello world”) peer-to-peer and agent-based computing 10 Jason • An interpreter of AgentSpeak in Java • Development environment for MASs • Free downloads: – http://jason.sourceforge.net • Integrated with JADE (distributed execution) • Eclipse plug-in peer-to-peer and agent-based computing 11 Java Extensions for Agent Programming • Various extensions to Java – Agent-specific constructs/built-ins – JACK, JADE and JASON are Java extensions! • There are, however, APIs which retain the syntax and “object-orientedness” of Java • Agent Building and Learning Environment (ABLE) – IBM’s agent toolkit – Java interfaces and base classes defining a library of JavaBeans called AbleBeans, including • Reading and writing text and database data, • Rule-based inferencing using Boolean and fuzzy logic, • Machine learning techniques (e.g., neural networks, Bayesian classifiers, and decision trees). peer-to-peer and agent-based computing 12 Case Study 1: Softbots • Software robots (Softbots) – Intelligent software agents that use software tools and services on a person's behalf – User communicates what she wants accomplished (the goals), and softbots dynamically determine how to satisfy the person’s request • Tool use is one of the hallmarks of intelligence – Softbots rely on the same tools and utilities available to human computer users – Tools for sending mail, printing files, searching the Web… • Popular Softbots interact with a wide range of software tools and services through the WWW peer-to-peer and agent-based computing 13 Case Study 1: MetaCrawler • WWW search services operated by the Univ. of Washington – 1995–1997 – Licensed to Go2Net, now InfoSpace, in 1997. • Single, central interface for WWW document searching peer-to-peer and agent-based computing 14 Case Study 1: MetaCrawler (Cont’d) • Upon receiving a query: 1. It posts the query to multiple search engines in parallel, then 2. It performs sophisticated pruning on the responses returned • MetaCrawler prunes as much as 75% of the returned responses as irrelevant, outdated, or unavailable peer-to-peer and agent-based computing 15 Case Study 1: MetaCrawler (Cont’d) • Current version (www.metacrawler.com) peer-to-peer and agent-based computing 16 Case Study 2: Calendar Agent • Retsina Semantic Web Calendar Agent – Developed at Carnegie-Melon’s Intell. Software Agents Lab – Interoperability between RDF-based calendar descriptions on the web, and Personal Information Manager (PIM) Systems such as Microsoft's Outlook – Home page: http://www.cs.cmu.edu/~softagents/cal/ • Schedules can be: – Browsed and imported by the user manually – Shared and imported autonomously by agents • Assists users in keeping calendar “up-to-date” – Higher fidelity model of user’s schedule – Minimal cost on the user’s time • Supports meeting scheduling – Agents negotiate meeting times based on user’s schedule and preferences peer-to-peer and agent-based computing 17 Case Study 2: Calendar Agent (Cont’d) • Schedules and events described on the web in RDF, using ontologies, and linked to individual's contact information (e.g., their home page). • Consists of – Distributed Meeting Scheduling Engine and – RETSINA Semantic Web Calendar Parser. • Agent – Assists in organising and scheduling meetings between several individuals, – Coordinates these based on existing schedules maintained by MS Outlook. peer-to-peer and agent-based computing 18 Case Study 2: Calendar Agent (Cont’d) • Agent interface and importing schedules onto Outlook peer-to-peer and agent-based computing 19 Case Study 3: Robot Teams • Teams of robots must coordinate their actions and collaborate – Example: robots playing football – Each robot is an autonomous agent • Robocup: yearly competition of robot teams – http://www.robocup.org – Sony AIBO Legged League • Football matches between teams of autonomous quadruped robots made by Sony Corporation. – Sony AIBO's are publicly available and can be programmed peer-to-peer and agent-based computing 20 Further reading • A Survey of Programming Languages and Platforms for Multi-Agent Systems, Bordini et. al., 2006, available at http://www.informatica.si/PDF/30-1/02_BordiniA%20Survey%20of%20Programming%20Languages%20and %20Platforms...pdf • Logics and Agent Programming Languages, Logan, B. and Alechina, N., ESSLLI 2009, available at http://www.agents.cs.nott.ac.uk/events/lapl09/ • JASON examples: http://jason.sourceforge.net/wp/examples/ • IBM’s ABLE: http://publib.boulder.ibm.com/infocenter/iseries/v5r3/ind ex.jsp?topic=%2Frzahx%2Findex.html peer-to-peer and agent-based computing 21