Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An...

28
Java Agent Development Environment (JADE) • Jade is a platform for running agents; it supports: – An asynchronous agent programming model – Communication between agents either on the same or different platforms – Mobility, security, and other utilities

Transcript of Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An...

Page 1: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

Java Agent Development Environment (JADE)

• Jade is a platform for running agents; it supports:– An asynchronous agent programming model– Communication between agents either on the

same or different platforms– Mobility, security, and other utilities

Page 2: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

Jade Architecture

• Distributed Architecture– Multiple Hosts– Multiple Processes– Multiple “Agent Containers”

• Agent Containers– One java process per container– Transparent to agents– Main container hosts platform services– Linked together using Java RMI

Page 3: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.
Page 4: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.
Page 5: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.
Page 6: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

JADE

Basic Concepts• Container: a running instance of the JADE

running environment containing several agents– A single Main Container must always be

active in a platform and all other containers register with it as soon as they start

– You do not have to know how the JADE runtime environment works, but just need to start it before executing your agents

Page 7: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

Main Container

Holds two special agents• Agent Management system (AMS) that

provides the naming service; name, ensure uniqueness, create/destroy agents

• Directory Facilitator (DF) that provides a Yellow Pages service by means of which an agent can find other agents providing the services he requires in order to achieve his goals

Page 8: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

Main Container Responsibilities

• Managing the container table (CT), which is the registry of the object references and transport addresses of all container nodes composing the platform

• Managing the agent descriptor table (GADT), which is the registry of all agents present in the platform, including their current status and location

• Hosting the AMS and the DF

Page 9: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

JADE toolkit

• Platform Runtime– Agent lifecycle– Message transport– Service agents

• Agent Support– Internal scheduling– Decoding and understanding communication

• Debugging– Tracing Messages– Examining Agent State

Page 10: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

Platform Services

• Implemented as agents• AMS: Agent Management Service

– “White Pages”– Maintains set of agents on a platform

• DF: Directory Facilitator– “Yellow Pages”– Provides a service directory– Maps service descriptions to Agent Identifiers– Agents can add/modify/delete entries for themselves

Page 11: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

Interacting with Directory Facility

By exchanging ACL messages using FIPA-agent-management ontology.

• Publish and Subscribe– Publish: create instance of DFAgentDescription

class and call the register( ) static method, then use setup( ) method

• Search for servicesPrimer:

http://www.iro.umontreal.ca/~vaucher/Agents/Jade/JadePrimer.html

Page 12: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

JADE main distribution

• jadeBIN.zip

• jadeDOC.zip

• jadeExamples.zip

• jadeSrc.zip

First set local Java CLASSPATH (pg 36 Tb)

GUI provided by Remote Monitoring Agent

Page 13: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

JADE Packages

• jade.core– jade.core.event; implements the distributed

event notification service– jade.core.management; implements the

distributed agent life-cycle management service

– jade.core.messaging; implements the message distribution service

– jade.core.mobility; implements the mobilitity and cloning service

– ……

Page 14: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

JADE Packages

• jade.content and its sub-packages contain the collection of classes that support creating and manipulating expressions according to a given content and ontology

• jade.domain contains the implementation of the AMS and DF agents

• jade.language.acl• jade.proto• jade.tools

• …

Page 15: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

Message Transport Service (MTS)

• By default, JADE always starts HTTP-based MTP with the initialization of a main container.

• Whenever an incoming connection is established and a valid message received over that connection , the MTP routes the message to its final destination.

• Using command-line options, any number of MTPs can be activated (see Table 3.2)

Page 16: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

Internal Message Transport Protocol (IMPT)

• Used exclusively for exchanging messages between agents living in different containers of the same platform

• The RMI-IMPT; when a non-main container boots up it locates the RMI registry on the specified main container host and looks up the object reference of the main container. It the invokes the remot method addNode ( ) of the main container to join the platform and refisters its own reference with the main container.

Page 17: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

Admin and Debugging Tools• In jadeTools.jar

– Remote Monitoring Agent (RMA) is a system tool that implements a graphical platform management console

– DummyAgent is useful for sending custom ACL messages to test the behavior of an other agent

– Sniffer Agent is for debugging, or for documenting dialogs between agents– Introspector Agent for debugging the behavior of a single agent– Lo Manager Agent simplifies the dynamic and distributed management of the

logging facility by providing a graphical interface that allows the logginglevels of each component of the Jade platform to be changed at run-time

– Event notification service manages the distributed notification of all the events generated by each node of the platform

• Platform-type• Message Transport Protocol type• Message-passing type• Agent-internal type

Page 18: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

Creating Agents

Extend the class jade.core.Agent and implement the setup( ) method; see page 6 of Jade Tutorial at http://jade.tilab.com/doc/JADEProgramming-Tutorial-for-beginners.pdf

• Identifiers

• Termination

• Passing arguments to an agent

Page 19: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

Internal Agent Architecture

• Agent is a single-threaded Java program• Has tasked-based programming model

– Set of Behaviours– Scheduled by the Agent– Tasks operate in parallel– Allows explicit coordination between tasks– Single-threaded

• Send/Receive messages through API– Decoding/Encoding message content

Page 20: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

Behaviours

• Each agent has a set of active behaviours• Each behaviour should achieve a single task or sub-

task– “Send this message”– “Buy X”

• Behaviors are Java objects• A behaviour runs until it is finished• Should behave fairly—yield control, not block• All active behaviours get executed with equal

frequency

Page 21: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

Agent’s Behaviour

A behavior represents a task that an agent can carry out and is implemented as an object of a class that extends: jade.core.behaviours.Behaviour

• Each class extending Behaviour must implement the action( ) method

• Scheduling of behaviours in an agent is cooperative; when method is called, it runs until it returns. Allows for single Java thread per agent, and eliminates synchronization issues.

• Three types of behaviours: One-shot, cyclic, conditional

Page 22: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

Behaviour Scheduling• Behaviours do work in steps• Once behaviour is activated, it is run until it finishes (or

for ever)• Agent Scheduling loop

– Next behaviour selected from all “active

behaviours” in agent– Exectuted in round-robin fashion:– All active behaviours get executed equally often

• Behaviours have to be fair– Should yield control– Should never block or wait inside behaviour logic

Page 23: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

Simple Behaviours

• Scheduler calls action() method to do next step of behaviour

• Scheduler calls done() method to determing if behaviour has finished

• One shot behaviours do all work in a single invocation of “action()”, done() then always returns true.

• Reentrant behaviours do some work in each invocation of “action()” then return

Page 24: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

Complex Behaviour• Complex Behaviour has child behaviours

which may be simple or complex• When Complex behaviour is active:• Behaviour decides which children are active.• Agent Scheduler runs active children• Simple behaviours actually implement tasks• Complex behaviours decide which tasks are

necessary

Page 25: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

Sequential and Parallel

• Child behaviours are activated in order added.– First behaviour is run until completed, then

next and so on.– Complex behaviour finishes when last child

does.• All child behaviours are activated simultaneously

– Behaviour can exit:– When first child completes– When all children complete

Page 26: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

Agent Communication• It is asynchronous message passing• Each agent has mailbox where messages sent by

other agent’s are posted• Messages have a format specified by FIPA’s Agent

Communication Language (ACL)– Fields: Sender, receiver, performatives, content, ontology,

control (conversation-id, reply-with,..)

• Message implemented as an object of the jade.lang.acl.ACLMessage classthat provides get and set methods for handling all fields of a message

Page 27: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

Communication

• All communication is message based

• Platform routes messages between agents

• Agents construct and decode messages internally

• No explicit link between initiation and response

Page 28: Java Agent Development Environment (JADE) Jade is a platform for running agents; it supports: –An asynchronous agent programming model –Communication between.

Jade Ontologies

• Ontology provides description of concepts in the world and relationships between them

• Mapping between objects described by ontology and Java objects

• Protege is an Ontology Editor that– Allows you to design and query ontologies.– You will use it to extend the ontology given with the

coursework.– Beangenerator plugin generates java code for your

ontology– Use these objects in your messages