SlideShare a Scribd company logo
1 of 106
Java Agent DEvelopment
Framework
2
What is JADE?
 A software framework
 that simplifies the implementation of multi-agent systems
 The middle-ware for Multi-Agent System (MAS)
 target users: agent programmers for MAS
 agent services
• life-cycle, white-page, yellow-page, message transport
 tools to support debugging phase
• remote monitoring agent, dummy agent, sniffer agent
 designed to support scalability
• (from debugging to deployment)
• from small scale to large scale
 Implements Foundation for Intelligent Physical Agents (FIPA).
 Fully implemented in Java
 distributed under LPGL
3
What is JADE for?
JADE is a platform for running agents
 To support:
 An asynchronous agent programming model
 Communication between agents either on the same or
different platforms
 Mobility, security, and other utilities
 Develop custom applications to exploit Agent metaphor
 Hook agent framework to JAVA GUI applications
4
Advantages of JADE
 Support for mobile devices
 Graphical runtime environment
 FIPA compliant
 Strong development team
 Open source
 Ontologies
 Predefined interaction protocols as specified by FIPA
 New interaction protocols can be easily introduced
5
Why is JADE Important?
 JADE Hides FIPA From The Programmer!
 No need to implement the Agent Platform and Agent Services
 No need to implement agent-management ontology and
functionalities
 An agent is registered with the Agent Platform
 It is given a name and a unique address
 The Agent class provides a simplified interface to access the services of
the Directory Facilitator (registration, searching, …)
 No need to implement Message Transport and Parsing
 Automatically (and possibly efficiently) done by the framework when
sending/receiving messages
 Interaction Protocols must only be extended via handle methods
6
What is FIPA?
 Founded as a non profit Swiss organization in 1996
 Goal
 Define a full set of standards for implementing systems within which
agents could execute (agent platforms)
 Specifying how agents should communicate and interact
 A number of standards were proposed, however, never gained
commercial support
 Agent platforms adopting the "FIPA standard"
 The JADE agent programming platform
 The Spyse agent programming platform
 JACK (Agent Oriented Software Group)
 The April Agent Platform and Language
 FIPA is currently an IEEE standards committee
 FIPA2000 is the current approved FIPA specifications
7
Agent Management Model
 The Agent Platform supports the
Message Transport System.
 The Message Transport Service
is the default communication
method between agents on
different Agent Platforms.
 The Agent Platform supports
routing tasks.
Agent Platform
Agent Platform
Agent
Management
System
Directory
Facilitator
Message Transport System
Agent
Software
Message Transport System
8
Agent Management
 Agent Management System (AMS) and Directory Facilitator (DF) have a common
subset of actions:
 Register
• JADE automatically calls the register and deregister methods with the default AMS
respectively
 Deregister
• But JADE provides control to do these tasks programmatically for special cases.
 Search
• Directory Facilitator (DF) is the agent who provides the default yellow page service,
provides the capability to search agents with specific capability
 modify
• AMS supports the modification of the agents during run-time
9
FIPA Agent Execution Model
 Agent is autonomous
 It completely controls its thread of execution
• Private proxy of the life-cycle manager
 It decides itself when to read received messages and which messages to
read/serve
• The transport mechanism fills a private queue but it does not call the agent code (no
automatic callback)
 Agent needs concurrency
 Can engage in multiple simultaneous conversations
 Can execute several concurrent tasks
10
Agent Naming
 Agent is identified through an extensible collection of parameter-value pairs, called an
Agent Identifier (AID).
 AID comprises:
 A name.
 Other parameters, such as transport addresses, name resolution service addresses, and so on.
 The name of an agent is immutable; the other parameters in the AID of an agent can be
changed.
 A given agent may support many methods of communication and can put multiple transport
address values in the :addresses parameter of an AID.
 a globally unique name.
 By default JADE composes this name as the concatenation of the local name – i.e. the agent
name provided on the command line – plus the '@' symbol, plus the home agent platform identifier
– i.e. <hostname> ':' <port number of the JADE RMI registry> '/' 'JADE')
 i.e. GITIAgent@JadeServer:1099/JADE
11
Agent Lifecycle
12
JADE states
 AP_INITIATED : the Agent object is built, but hasn't
registered itself yet with the AMS,
 AP_ACTIVE : the Agent object is registered with the AMS,
 AP_SUSPENDED : the Agent object is currently stopped.
 AP_WAITING : the Agent object is blocked,
 AP_DELETED : the Agent is definitely dead.
 AP_TRANSIT: a mobile agent enters this state while it is
migrating
 AP_COPY: this state is internally used by JADE for agent
being cloned.
 AP_GONE: this state is internally used by JADE when a
mobile agent has migrated
13
Agent Communications - Messaging
 Message transport protocols
 IIOP
 HTTP
 Three encodings
 String encoding
 bit-efficient encoding
 XML
 Each message protocol supports the three kinds encoding
 Only the message envelope depends on transport protocol.
 Abstract Frame-based envelope syntax, mapped to protocol-dependent concrete
syntaxes.
14
Message Structure
 A message is made up of two parts:
 envelope expressing transport information
 body comprising the ACL message of the agent communication.
 For message interpretation by an agent:
 ACL semantics are defined only over the ACL message delivered in
the message body of a FIPA message.
 Information in the message envelope is supporting information only.
How and if this information is used to by an agent is undefined by
FIPA.
15
How much of FIPA is hidden by JADE?
 No need to implement the Agent Platform
 AMS, DF, and ACC executed at start-up
 No need to implement agent-management ontology and functionalities
 An agent is registered with the AP within its constructor
• it is given a name and an address
 The Agent class provides a simplified interface to access the services of the DF
(registration, searching, …)
 No need to implement Message Transport and Parsing
 automatically (and possibly efficiently) done by the framework when
sending/receiving messages
 Interaction Protocols must only be extended via handle methods
16
Open Source
 JADE is available in Open Source under LGPL license from
 The latest version of JADE is 3.5 released June 2007
17
LIST OF ACRONYMS AND ABBREVIATED TERMS
 ACL - Agent Communication Language
 AID - Agent Identifier
 AMS - Agent Management Service. According to the FIPA architecture, this is the agent that is
responsible for managing the platform and providing the white-page service.
 AP - Agent Platform
 DF - Directory Facilitator. According to the FIPA architecture, this is the agent that provides the
yellow-page service.
 FIPA - Foundation for Intelligent Physical Agents
 GUID - Globally Unique Identifier
 HTML - Hyper Text Markup Language
 HTTP - Hypertext Transmission Protocol
 IDL - Interface Definition Language
 IIOP - Internet Inter-ORB Protocol
 IOR - Interoperable Object Reference
 MTP - Message Transport Protocol. According to the FIPA architecture, this component is
responsible for handling communication with external platforms and agents.
 ORB - Object Request Broker
 RMA - Remote Monitoring Agent. In the JADE platform, this type of agent provides a graphical
console to monitor and control the platform and, in particular, the life-cycle of its agents.
 RMI - Remote Method Invocation
18
Terminology
19
Agent Communication Language (ACL)
 Semantically defined standard vocabulary and syntax
 Agent exchange
 String-based messages
 An ACL Message
 Structured message, targeted for flexible communication
 Performative (INFORM, QUERY, REFUSE, …)
 Addressing
– To
– From
 ConversationID – Used to link messages in same conversation
 In reply to – Sender uses to help distinguish answers
 Reply with – Another field to help distinguish answers
 Reply by – Used to set a time limit on an answer
 Language – Specifies which language is used in the content
 Ontology – Specifies which ontology is used in the content
 Protocol – Specifies the protocol
 Content – This is the main content of the message
20
Agent Communication Example
INFORM
:sender antagent
:receiver bob martin
:protocol status
:co protocol status
:conversation_id example6
:reply_with 275
:reply_by wed 3pm
conversation_id example6
:reply_with 275 :reply_by wed 3pm
:language lisp
:ontology ant
:content (target
(project “1hour”)
(platform “computer15”)
(author “sean”))
(time “8/07/01 4pm”)
(message “build failed”)
(target “compile”)
)
Primary Intent
Inform, Request, Failure,
Refuse, ...
Addressing
broadcast, forwarding, ...
Dialogue Coordination
expected vs exceptional response
Detailed action or request
problem specific
language, ontology, request
21
Content Language (CL)
 Defines
 proper syntax for content expressions
 number of operators such as the logical connectors AND and OR
 Semantic Language (SL)
 Describes actions, propositions, and identifying expressions
 Well Formed Formulas, logical operators built in to SL. In addition there are
some interesting existential quantifiers such as B, "believes", and U,
"uncertain".
22
Agents and Agency
 What is an Agent?
 There seem to be as many definitions as there are users of it
 Dictionary:
a·gent n.
1. One that acts or has the power or authority to act.
2. One empowered to act for or represent another: an author's agent; an insurance
agent.
3. A means by which something is done or caused; instrument.
4. A force or substance that causes a change: a chemical agent; an infectious agent.
5. A representative or official of a government or administrative department of a
government: an FBI agent.
6. A spy.
7. Linguistics. The noun or noun phrase that specifies the person through whom or the
means by which an action is effected.
23
Motivation
 Most important development in IT in past 10 years?
 How to build software in a dynamic, open, culturally diverse
world?
 Intelligent personal assistants
24
Are these agents?
 Web crawler
 Virus
 Email handler
25
The Agent Metaphor

Human surrogate/servant

Emphasis on communication

Autonomy

Persistence
26
Parent technologies
 artificial intelligence
 software engineering
 distributed systems
 organisational science
 databases
 economics
 game theory
 artificial life
27
What is an agent?
 Software agents are small, efficient pieces of code that
combine the job execution properties of a scripting
language with the communications capabilities of
objects. Agents carry out specific, repetitive, and
predictable tasks on behalf of a computer user,
business process, or software application. And like
software objects, agents have programmable
properties and behaviours.
from the WWW in 1996
28
What is an Agent?
“encapsulated computer system, situated in some
environment, and capable of flexible autonomous
action in that environment in order to meet its
design objectives” (Wooldridge)
• control over internal state and over own behavior
• experiences environment through sensors and acts
through effectors
• reactive: respond in timely fashion to environmental
change
• proactive: act in anticipation of future goals
29
Why agents are useful
 Ability to perform in an open, dynamic,
unpredictable environment
 Potential for exploiting the Internet
 Ease of interfacing with legacy software
 Aid to model a complex environment
 Potential for more intelligent software
30
Agent Advantages

‘Natural’ Abstraction level

Easy to specify knowledge (for analysts)

Useful breakdown of problems

Modularity

Coping with legacy systems
31
What agents are not

Wizards

Scripting languages

Programming languages

Neural Networks

Pure rule-based systems

Objects
32
What About Human Agents?
 Some characteristics of human agents
 carries out some task for someone else (master/slave)
 is given goals but has considerable leeway on how to achieve these goals
 probably moves around
 observes features of her or his environment
 interacts with, and perhaps changes to some extent, his or her environment
of objects and (possibly) other agents
 has a memory to store instructions, goals and other information
 (hopefully) exhibits some intelligence
 Keywords
 goals, observations, autonomy, intelligence, mobility
33
How About Software Agents?
 Artificial Intelligence Agents
 First to use agent term in the computer world
 Usually individual 'creatures' living in an environment where they
interact in some way
 Agents are more or less autonomous
 Most AI agents do not interact with other agents in the same
environment
 Exhibit some kind of intelligence
 A good example: robot interacting with a real world environment
34
Example of An Ideal Agent
 Imagine an autonomous automatic pilot controlling an aircraft
 Goal of safely landing at some airport.
 Requires:
 Pro-activeness
• Plan how to achieve this goal (may include pre-compiled plans)
• Generate subsidiary goals (e.g., ascend to an altitude of 30,000 feet,
then proceed due north at a speed of 400 knots . . . ).
 Autonomous
• Execute its plans, but not blindly
• Maintains local state
• Responds appropriately if unforeseen circumstances (e.g., a change in
weather conditions, a fault in the aircraft, a request from airtraffic
control)
 Reactiveness
• Can not spend hours deliberating, must respond in a timely manner
 Social ability
• Auto-pilot cooperates with air-traffic controllers and perhaps other
aircraft in order to achieve its goals
35
Trends in the Agent World
 Agent standards
 FIPA, JAS, OMG
 Agent initiatives
 Agentcities
 TILAB and Motorola: JADE/LEAP for mobility
 Robust agent platforms
 JADE + J2EE -> BlueJADE
 Fledgling work on Semantic Web
 DAML + OIL
36
References
 Agent technology
 FIPA: http://www.fipa.org
 JADE: http://jade.cselt.it/
 BlueJADE: https://sourceforge.net/projects/bluejade/
 Agentcities: http://www.agentcities.net http://www.agentcities.org
 CoABS GRID http://www.java-agent.org/
 AI technology
 Weka: http://www.cs.waikato.ac.nz/~ml/weka
 Lucene: http://jakarta.apache.org/lucene/docs/index.html
 Jess: http://herzberg.ca.sandia.gov/jess/
 Agent groups
 Utah: http://www.cs.utah.edu/arg
 Santa Cruz: http://www.soe.ucsc.edu/research/agents
 UMBC:
 DARPA http://agents.umbc.edu
37
Protocol: Allowed Message Patterns
Martin
PA
Bob
PA
ANT
Agent
Ant
Listener
Bob
Notification
Agent
SUBSCRIBE project ...
INFORM project
CONFIRM ...
Standards
contract-net,
auctions,
planning,
negotiation,
management, ….
Tools
State Machines
Workflow
UML
Models
Meetings
Organizations
Context
CANCEL project ...
AGREE
REFUSE
DISCONFIRM ...
INFORM project
INFORM project
PROPOSE note
ACCEPT-PROPOSAL
REJECT-PROPOSAL
38
JADE Intro
 Introduction to JADE concepts
39
Mapping Theory into Design
 Agents are autonomous.
 Agents are social entities.
 Messages are speech acts, not
invocations.
 An agent can say “no” and “I don’t
care”.
 Agents are active objects.
 Intra-agent concurrency is
needed.
 Asynchronous messaging must
be used.
 Peer-To-Peer messaging (built
over distributed objects
Client/Server interactions).
40
JADE API
 The JADE framework includes a library of interaction
protocols and generic agent behaviours, that must be
customized for the specific application needs in order to
create the agent capabilities
 Quite Complex 100+ classes
 Don't need to know most of it
 Examples give you most of what you need
 Key Classes:
 jade.core.Agent: base class for agents
 jade.core.behaviours.* : Behaviours
 jade.lang.acl.ACLMessage: Message class
 jade.core.AID: Agent identifer
41
Network protocol stack
JRE JRE JRE
Jade Main-container Jade Agent Container Jade Agent Container
Jade distributed Agent Platform
ApplicationAgent
ApplicationAgent
ApplicationAgent
ApplicationAgent
ApplicationAgent
ApplicationAgent
ApplicationAgent
ApplicationAgent
ApplicationAgent
Host 1 Host 2 Host 3
JADE Agent Platform
42
Intra-Container
Message Transport
(Java events)
White page
service
Agent
Management
System
Yellow page
service
Directory
Facilitator
Agent Communication Channel
Inter-Containers
Message Transport
(Java RMI)
Inter-Platforms
Message Transport
(IIOP)
local cache of
agent addresses
JADE Agent Container
Note: The internal architecture of a JADE main container is similar,
but it does not contain the AMS, the DF, and the IIOP modules.
43
JADE Communication
 Every agent has a private queue of ACL messages created
and filled by the JADE communication sub-system
 Designed as a chameleon to achieve the lowest cost for
message passing
 the mechanism is selected according to the situation
 the overheads depend on the receiver’s location and the cache status
44
JADE Communication
Message Dispatcher
AGENT CONTAINER
Message Dispatcher
AGENT CONTAINER (FE)
Message Dispatcher
AGENT CONTAINER
Java RMI
Agent2
event
Local
cache
Agent
Global
Descriptor
Table
event Agent3
Agent1
Agent
Container
Table
45
Communication Model
 Library of interaction protocols
 Framework directly supports parsing
 Envelope parser (in JADE 2.0)
 Agent Communications Language (ACL) parser
 Content Language (CL) parser
• including support for uuencoded Java serialization
 Ontology checker
 Framework can be extended by the user
 Support to define/save/load new ontologies
 Interface for CL Parser/Encoder
 Automatically used by the framework
46
Agent Execution Model
 Agent is autonomous
 it completely controls its thread of execution
private proxy of the life-cycle manager
 it decides itself when to read received messages and which messages to
read/serve
the transport mechanism fills a private queue but it does not call the agent code
(no automatic callback)
 Agent needs concurrency
 can engage multiple simultaneous conversations
 can execute several concurrent tasks
Java multi-thread or/and
JADE behaviours with cooperative scheduling
one thread-per-agent rather than one thread-per-task/conversation
47
Agent Tasking Model
 JADE uses the Behaviour abstraction to model the agent tasks
 An agent can instantiate at run time new behaviours according to its
needs and capabilities
 Keeps the number of threads required to run the agent platform small
 Does not prevent the programmer from using one thread-per-task
implementation (no specific support is given for this case: Java multi-
thread is considered sufficient)
48
Generic JADE agent
private inbox of
ACL messages
scheduler of
behaviours
patternmatching
timeout-
based
blocking-based
polling-based
life-cycle
manager
accessmode
application
dependent
agent resources
beliefs
capabi-
lities
behaviour1
behaviour2
behaviourn
…
active
agent behaviours
(i.e. agent intentions)
JADE library of
interaction protocols
and of generic
agent behaviours
49
Concurrency in JADE
 Different containers on the same platform
 1 JVM per container
 Different agents on the same container
 run in a pre-emptive multi-threaded environment scheduled by the JAVA Virtual
Machine
 Different behaviours on the same agent
 scheduled cooperatively
• every behaviour must release the control to allow the other behaviours to be
executed
• no stack to be saved, more effort to the programmer
• JADE scheduler carries out a round-robin non-preemptive policy among all
behaviours in the ready queue
 Behaviours can be composed into a tree
• every Behaviour is a Finite State Machine
– one state per execution time slot
50
Behaviour-Based
Concurrency Model
 Multithreaded inter-agent
scheduling.
 Behaviour abstraction
 Composite for structure
 Chain of Responsibility for
scheduling.
 No context saving.
x:SequentialBehaviour y:SequentialBehaviour
x1:SimpleBehaviour x2:SimpleBehaviour y1:SimpleBehaviour y2:SimpleBehaviour
1 2
:Agent
1.1 1.2 2.1 2.2
run()
mainLoop()
b1 = schedule()
Exc. handler
run()
mainLoop()
Exc. handler
run()
mainLoop()
Exc. handler
run()
mainLoop()
b2 = schedule()
Exc. handler
b1.action() b1.done()?
a) b) c) d)
run()
mainLoop()
Exc. handler
run()
mainLoop()
Exc. handler
b2.action() b2.done()?
e) f)
51
Scalability in JADE
 Configuration of a platform
 From one MAS on a single host
• single-host platform
 To one agent on a single host
• agent platform on a cluster of hosts
 Configuration can be changed at run-time
• Hot restarting is possible thanks to the local caches
–Agent is referred by name => no need to get new
reference
 The agent container front end is the bottle-neck but it is involved
only when strictly necessary
52
Communication Overheads
 Same container
• No remote invocations
• ACL message object is cloned
 Same Agent Platform, different container, cache hit
• One RMI call, the ACL message object is serialized and unserialized by
RMI run time
 Same Agent Platform, different container, cache miss
• Two RMI calls (update the cache, send the message), the ACL
message object is serialized and unserialized by RMI run time
 Different platforms
• CORBA remote invocation through IIOP
• Double marshalling from Java object to Java String to IIOP byte stream
(sender side)
• Double unmarshalling from IIOP byte stream to Java String to Java
object (receiver platform side)
53
JADE Support Tools
 Administration tools.
 RMA Management Agent.
• White pages GUI.
• Agent life cycle handling.
 Directory Facilitator GUI.
• Yellow pages handling.
 Development tools.
 DummyAgent.
• Endpoint Debugger.
 Message Sniffer.
• Man-in-the-middle.
54
JADE Support Tools
55
Agent Management Model
 The main difference is the ACC is not
an agent.
 The ACC supports the Message
Transport System.
 The Message Transport Service is
the default communication method
between agents on different APs.
 The ACC also supports AP routing
tasks.
Agent Platform
Agent Platform
Agent
Management
System
Directory
Facilitator
Message Transport System
Agent
Software
Message Transport System
56
Jade Toolkit
 Platform Runtime
 Agent lifecycle
 Message transport
 Service agents
 Agent Support
 Internal scheduling
 Decoding and understanding communication
 Debugging
 Tracing Messages
 Examining Agent State
57
JADE Platform
JADE Platform
Container
Agent
Agent
Agent
Container
Agent
Agent
Computer A Computer B
58
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
59
Distributed Architecture
JADE Platform
Container
Agent
Agent
Agent
Container
Agent
Agent
JADE Platform
Container
Agent
Agent
JADE Platform
Container
Agent
Agent
Agent
Message
60
Platform Services
 Implemented as agents
 Agent Management Service (AMS)
 “White Pages”
 Maintains set of agents on a platform
 Directory Facilitator (DF)
 “Yellow Pages”
 Provides a service directory
 Maps service descriptions to Agent Identifiers
 Agents can add/modify/delete entries for themselves
61
 JADE based applications are made by one or more Agents
 A JADE agent is mapped onto an user defined Java class, that must
subclass Agent class in jade.core package.
 Agent activities are mapped onto user defined subclasses of
Behaviour class in jade.core.behaviours package.
JADE Programming Model
62
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
63
Agent Class
 The agent name is an Agent Identifier, represented by AID
class
 The name attribute is a globally unique identifier.
 The full name of an agent is no longer composed of the
concatenation of its local name and the platform IIOP
address
 FIPA does not allow to distinguish between the local name and its
home AP address.
 The method, getAID(), returns the agent AID.
64
JADE Agent
 Your agent should inherit from Agent
 See JADE API docs for inherited methods
 Everything begins with setup:
protected void setup () { … }
 This is where you initialize and addBehaviours to handle the processing
 Other useful methods:
 protected void takeDown() { … } // cleanup
 public void addBehaviour(Behaviour b)
 public final ACLMessage blockingReceive(MessageTemplate pattern, long millis)
 public final ACLMessage receive(MessageTemplate pattern)
 public final void send(ACLMessage msg)
65
Behaviours
 Behaviour not Behavior (British spelling)
 Each agent has a set of active behaviours
 Each behaviour should achieve a single task or sub-task
 “Send this message”
 “Buy X”
 A behaviour
 Runs until it is finished
 Should behave fairly—yield control, not block
 No infinite loops
 All active behaviours get executed with equal frequency
 Can create composite behaviours
66
Basic Behaviour Model
 Round-robin scheduling of all behaviours in the run queue
 When message arrives, all blocked behaviours are added to run queue
 Next behaviour selected from all “active behaviours”
 All active behaviours get executed equally often
 Primary methods:
 public abstract void action()
• Each time the behaviour has a turn, action is called
 public abstract boolean done()
• When action is finished this is called to determine if we put back into run
queue or leave in list of finished behaviours
• Returns false while working or true when finished
 public void block()
• Tells to move to blocked queue when the action exits
 public void block(long millis)
• Adds ability to wait until woken up or timeout
67
Predefined Behaviours
 You define action yourself
 SimpleBehaviour
 You define done() yourself
 CyclicBehaviour
 You may NOT define done()
 ‘done’ is permanently set to return false
 OneShotBehaviour
 You may NOT define done()
 ‘done’ is permanently set to return true
68
Behaviours
Behaviour
action()
done()
Simple Behaviour CompositeBehaviour
<<protected>> preAction()
<<protected>> postAction()
<<protected>> bodyAction()
addBehaviour()
removeBehaviour()OneShotBehaviour CyclicBehaviour
SequentialBehaviour
<<protected>> bodyAction()
Abstract
class
Abstract - simple
not composable
no interruption
Abstract – com-
poses children;
interruptable
ParallelBehaviour
<<protected>> bodyAction()
FSMBehaviour
<<protected>> bodyAction()
Finite State
Machine
done =
true
done =
false
69
Assigning Behaviour
Agent class, which must be extended by agent programmers
exposes two methods:
addBehaviour(Behaviour) and removeBehaviour(Behaviour),
which allow to manage the ready tasks queue of a specific
agent.
Behaviours and sub-behaviours can be added whenever is
needed, and not only within Agent.setup() method. Adding
abehaviour should be seen as a way to spawn a new
(cooperative) execution thread within the agent
70
Example of a Behaviour
public class my3StepBehaviour extends OneShotBehaviour{
private int state = 1;
private boolean finished = false;
public void action() {
switch (state) {
case 1: { op1(); state++; return; }
case 2: { op2(); state++; return; }
case 3: { op3(); state=1; finished = true; return; }
}
}
public boolean done() {
return finished;
}
}
71
Composite Behaviours
 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
72
Adding Behaviour to an Agent
addBehaviour(new TickerBehaviour(this, 1000) {
protected void onTick() {
System.out.println("Agent "+myAgent.getLocalName()+":
tick="+getTickCount());
}
});
73
Adding WakerBehaviour
addBehaviour(new WakerBehaviour(this, 10000) {
protected void handleElapsedTimeout() {
System.out.println("Agent "+myAgent.getLocalName()+":
It's wakeup-time. Bye...");
myAgent.doDelete();
}
});
74
Adding CycleBehaviour
addBehaviour( new CyclicBehaviour( this ) {
public void action() {
ACLMessage msg = receive(
MessageTemplate.MatchPerformative(
ACLMessage.INFORM ) );
if (msg != null) {
if
(HostAgent.GOODBYE.equals( msg.getContent() )) {
…….
75
Complex Behaviours: Sequential
 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.
76
Complex Behaviours: Parallel
 All child behaviours are activated simultaneously
 Behaviour can exit:
 When first child completes (conditionally dependent)
 When all children complete
77
class ParallelBehaviour
This class is a CompositeBehaviour that executes its sub-
behaviours concurrently and terminates when a particular
condition on its sub-behaviours is met. Proper constants to
be indicated in the constructor of this class are provided to
create a ParallelBehaviour that ends when all its sub-
behaviours are done,
78
Complex Behaviours:
Finite State Machine
 Deterministic FSM.
 Sub-behaviours are states
 Current state is active behaviour
 Transitions occur depending on outcome of last behaviour
79
Complex Behaviours: Protocols
 Off-the shelf implementation of interaction protocols
 Does sending/receiving messages for you
 Checks protocol compliance
 Each place where agent can act in protocol is a sub-
behaviour (or a callback)
 Just need to plug in logic to implement agent decisions
 Built internally using FSM behaviours
80
Example Agent
 Example1
 SimpleReceiverAgent
• Same as sender but uses SimpleReceiverBehaviour
 SimpleReceiverBehaviour
• CyclicBehaviour
• Checks to see if message has arrived and prints if it does
• Does a block(500) to stop busy waiting
• Could use blockingReceive or block()
81
Execute the behaviour in a dedicated Thread
public class ThreadedAgent extends Agent {
private ThreadedBehaviourFactory tbf = new
ThreadedBehaviourFactory();
protected void setup() {
// Create a normal JADE behaviour
Behaviour b = new OneShotBehaviour(this) {
public void action() {
// Perform some blocking operation that can take a long time
}
};
myAgent.addBehaviour(tbf.wrap(b));
}
}
82
Agent Communications
83
Agent Communication
 All communication is message-based unlike Remote
Procedure Calls (RPC)
 No explicit link between initiation and response
 Platform Routes messages between agents
 Agent constructs and decodes messages internally
84
Constructing a Message
 Create Message Object (ACLMessage)
 Set performative
 Set sender and recipients
 Set message attributes
 Fill content (from java objects)
85
Message Structure
 Envelope
 Constructed/Interpreted by platform
 Routing: Indicates sender and recipients of message and where the message has been
 ACL Message
 Performative (REQUEST/INFORM)
 Set of standard attributes
• Language of message body
• Conversation ID
• Ontology used in message
 Body
• Interpreted by agents
• Conforms to some content language and Ontology
86
Message Content
 Content of message complies with Content Language (CL)
and Ontology
 Semantic Language (SL)
 SL0: Objects, Actions, Results
 SL1: Basic Logical Operators, Predicates AND/OR/NOT
 SL2: Higher-level modalities: Belief, Intention, Goal
 Objects in language are described by Ontology
87
Hosts under
Test
JAVA
Java RMI
JADE PLATFORM
Hosts under
Test
Hosts under
Test
Hosts under
Test
JADE
LUS
Main container
Main
Platform
Host
containers
Command Messages
Status/Reports/Event Messages
Network
Jade Messaging Architecture
88
Agent
Instrumentation : Underlying Technology
Out-of-band
Network
Host under Test
SUT
logs
SUT
logs
SUT
logs
SUT
logs
Master
Sql dataflow
Storage
Service
TestNetwork
JADE
PLATFORM
Agent
Agent Agent
Agent
LogsJade Agent
Host under Test
Host under Test
Host under Test
Sniffers
89
JADE Platform Control/Status display
90
JADE Sniffer Agent
Sniffer Agent is basically a FIPA-compliant Agent with
sniffing features.
91
Introspector Agent
This tool allows to monitor and control the life-cycle of a running agent and its
exchanged messages
92
Ontology
 Ontology provides description of concepts in the world and
relationships between them
93
Event
type:
Room
features: ….
address: ...
Time
zone:
day:
hour:
where when
Person
email
role
project
Organizer
….
Participant
….
priority:...
with
by
Multiple
oneOf:
allOf:
at
*
*
*
Ontology: Terms & Relationships
Standards
Shopping, Events,
Travel, People,
Organizations, Roles,
Context, …
Tools & Models
UML, XML,
AUML, DAML,
OIL, RDF,
Protégé, ...
94
Ontology Description
Common vocabulary of agreed upon definitions and
relationships between those definitions, to describe
a particular subject domain.
E.g.:
Agent management
ontology
UMTS wireless technology ontology
Cinema ontology
Weather ontology
IEEE Standard Upper Ontology
95
W3C.org
 An ontology defines the terms used to describe and
represent an area of knowledge. Ontologies are used by
people, databases, and applications that need to share
domain information (a domain is just a specific subject area
or area of knowledge, like medicine, tool manufacturing, real
estate, automobile repair, financial management, etc.).
Ontologies include computer-usable definitions of basic
concepts in the domain and the relationships among them
(note that here and throughout this document, definition is
not used in the technical sense understood by logicians).
They encode knowledge in a domain and also knowledge
that spans domains. In this way, they make that knowledge
reusable.
96
W3C.org Concepts
 Classes (general things) in the many domains of interest
 The relationships that can exist among things
 The properties (or attributes) those things may have
97
W3C.org
Ontologies are usually expressed in a logic-based language,
so that detailed, accurate, consistent, sound, and
meaningful distinctions can be made among the classes,
properties, and relations. Some ontology tools can perform
automated reasoning using the ontologies, and thus provide
advanced services to intelligent applications such as:
conceptual/semantic search and retrieval, software agents,
decision support, speech and natural language
understanding, knowledge management, intelligent
databases, and electronic commerce.
The End
99
More on Behaviours
 Suppose that we want two agents that talk back and forth to each
other
 Have one be the initiator and start the conversation
• Could imagine other ways of doing this – first one to start becomes the
initiator
 To simplify things, we have one agent and use it twice
• So, we do a condition to see if it is the initiator or not
• The code is nearly identical and thus creating another whole agent program
seems like a waste
 Example2 provides the code
 See next slide for an illustration of how it works
100
Exchange Messages
 Me (initiator)
 Send message
 Wake up:
• If message, remember that you
have seen it
• If no message and seen a
message, send a reply
 Go back to sleep for 5
seconds
 Message traffic
 0 - Send
 0 - Sleep 5
 5 - Sleep 5
 10 - Sleep 5
 10 – Receive
 10 – Sleep 5
 15 – Send
 15 – Sleep 5
 …
 You
 Not initiator, so don’t send
 Wake up:
• If message, remember that you
have seen it
• If no message and seen a
message, send a reply
 Go back to sleep for 10
seconds
 Message traffic
 0 - Receive
 0 - Sleep 10
 5 –
 10 - Send msg
 10 – Sleep 10
 10 –
 15 – Receive
 15 – Sleep 10
 …
101
A Different Approach
 Question – what if you wanted to use two behaviours?
 One responsible for sending answers
 One responsible for receiving the message
 Is this the same exact model as example2?
 Receiver
ACLMessage msg = receive();
if (msg != null) {
// process message
receivedMessage = true;
}
block();
 Sender
// Did I wake up too early?
<<do some computation on time>>
if (!tooEarly) {
if (receivedMessage) {
sendMessage();
}
block(fulltime);
} else {
<<compute how much time left to wait>>
block(timeLeft);
}
Only wakes up
when a
message
arrives
Wakes on
message arrival
or time out
finished.
102
Exchange Messages - 2
 Me (Initiator)
 Send message
 Wake up:
• If message, remember that you
have seen it
• If no message and seen a
message, send a reply
 Go back to sleep for 5
seconds
 Message traffic
 0 - Send
 0 - Sleep 5
 5 - Sleep 5
 10 - Sleep 5
 10 – Receive
 10 – Sleep 5
 15 – Send
 15 – Sleep 5
 …
 You
 Not initiator, so don’t send
 Wake up:
• If message, remember that you
have seen it
• If no message and seen a
message, send a reply
 Go back to sleep for 10
seconds
 Message traffic
 0 - Receive
 0 - Sleep 10
 5 –
 10 - Send msg
 10 – Sleep 10
 10 –
 15 – Receive
 15 – Sleep 10
 …
103
104
BankServerAgent
ACLMessage msg = receive();
if (msg == null) { block(); return; }
try { Object content = msg.getContentObject(); switch (msg.getPerformative())
{ case (ACLMessage.REQUEST):
if (action instanceof CreateAccount) addBehaviour(new
HandleCreateAccount(myAgent, msg)); else if (content instanceof
MakeOperation) addBehaviour(new HandleOperation(myAgent, msg));
... }
105
JADE
 Java Agent Development Environment
 Standards Based - FIPA (Foundation for Intelligent Physical
Agents)
 http://www.fipa.org/
 Non-profit association
 Purpose to promote the success of emerging agent-based
applications, services, and equipments
 FIPA has over 65 member companies
106
FIPA Agent Platform
 Must Provide
 Life Cycle Management
 White Page Service
 Yellow Page Service
 Message Transport Service
 Optionally Provides
 Ontology Service
 Human Agent Interaction
 Agent Software Integration

More Related Content

What's hot

Intelligence artificielle et système multi-agent
Intelligence artificielle et système multi-agentIntelligence artificielle et système multi-agent
Intelligence artificielle et système multi-agentNoureddine Djebbari
 
SPADE: Agents based on XMPP
SPADE: Agents based on XMPPSPADE: Agents based on XMPP
SPADE: Agents based on XMPPJavier Palanca
 
DevOps à l'échelle: ce que l'on a fait, ce que l'on a appris chez Societe Gen...
DevOps à l'échelle: ce que l'on a fait, ce que l'on a appris chez Societe Gen...DevOps à l'échelle: ce que l'on a fait, ce que l'on a appris chez Societe Gen...
DevOps à l'échelle: ce que l'on a fait, ce que l'on a appris chez Societe Gen...Adrien Blind
 
Introduction to Prometheus
Introduction to PrometheusIntroduction to Prometheus
Introduction to PrometheusJulien Pivotto
 
Une approche multi-agents pour la détection de contours
Une approche multi-agents pour la détection  de contoursUne approche multi-agents pour la détection  de contours
Une approche multi-agents pour la détection de contoursSlim Namouchi
 
Datadogoverview.pptx
Datadogoverview.pptxDatadogoverview.pptx
Datadogoverview.pptxssuser8bc443
 
Process Orchestration with Flowable and Spring Boot
Process Orchestration with Flowable and Spring BootProcess Orchestration with Flowable and Spring Boot
Process Orchestration with Flowable and Spring BootChavdar Baikov
 
Développement Android
Développement AndroidDéveloppement Android
Développement AndroidFranck SIMON
 
Continuous Deployment Practices, with Production, Test and Development Enviro...
Continuous Deployment Practices, with Production, Test and Development Enviro...Continuous Deployment Practices, with Production, Test and Development Enviro...
Continuous Deployment Practices, with Production, Test and Development Enviro...Amazon Web Services
 
Introduction au Framework AngularJs
Introduction au Framework AngularJsIntroduction au Framework AngularJs
Introduction au Framework AngularJsRadhoueneRouached
 
Distributed system coordination by zookeeper and introduction to kazoo python...
Distributed system coordination by zookeeper and introduction to kazoo python...Distributed system coordination by zookeeper and introduction to kazoo python...
Distributed system coordination by zookeeper and introduction to kazoo python...Jimmy Lai
 
Kafka pub sub demo
Kafka pub sub demoKafka pub sub demo
Kafka pub sub demoSrish Kumar
 
옵저버빌러티(Observability) 확보로 서버리스 마이크로서비스 들여다보기 - 김형일 AWS 솔루션즈 아키텍트 :: AWS Summi...
옵저버빌러티(Observability) 확보로 서버리스 마이크로서비스 들여다보기 - 김형일 AWS 솔루션즈 아키텍트 :: AWS Summi...옵저버빌러티(Observability) 확보로 서버리스 마이크로서비스 들여다보기 - 김형일 AWS 솔루션즈 아키텍트 :: AWS Summi...
옵저버빌러티(Observability) 확보로 서버리스 마이크로서비스 들여다보기 - 김형일 AWS 솔루션즈 아키텍트 :: AWS Summi...Amazon Web Services Korea
 
Presentation bpel
Presentation bpelPresentation bpel
Presentation bpelAnasse Ej
 
Ch3 sma-architectures-2012
Ch3 sma-architectures-2012Ch3 sma-architectures-2012
Ch3 sma-architectures-2012Sofia Zahid
 

What's hot (20)

Agents intelligents
Agents intelligentsAgents intelligents
Agents intelligents
 
Intelligence artificielle et système multi-agent
Intelligence artificielle et système multi-agentIntelligence artificielle et système multi-agent
Intelligence artificielle et système multi-agent
 
SPADE: Agents based on XMPP
SPADE: Agents based on XMPPSPADE: Agents based on XMPP
SPADE: Agents based on XMPP
 
DevOps à l'échelle: ce que l'on a fait, ce que l'on a appris chez Societe Gen...
DevOps à l'échelle: ce que l'on a fait, ce que l'on a appris chez Societe Gen...DevOps à l'échelle: ce que l'on a fait, ce que l'on a appris chez Societe Gen...
DevOps à l'échelle: ce que l'on a fait, ce que l'on a appris chez Societe Gen...
 
Introduction to Prometheus
Introduction to PrometheusIntroduction to Prometheus
Introduction to Prometheus
 
Apache Zookeeper
Apache ZookeeperApache Zookeeper
Apache Zookeeper
 
Prometheus monitoring
Prometheus monitoringPrometheus monitoring
Prometheus monitoring
 
Une approche multi-agents pour la détection de contours
Une approche multi-agents pour la détection  de contoursUne approche multi-agents pour la détection  de contours
Une approche multi-agents pour la détection de contours
 
Datadogoverview.pptx
Datadogoverview.pptxDatadogoverview.pptx
Datadogoverview.pptx
 
Process Orchestration with Flowable and Spring Boot
Process Orchestration with Flowable and Spring BootProcess Orchestration with Flowable and Spring Boot
Process Orchestration with Flowable and Spring Boot
 
Développement Android
Développement AndroidDéveloppement Android
Développement Android
 
Continuous Deployment Practices, with Production, Test and Development Enviro...
Continuous Deployment Practices, with Production, Test and Development Enviro...Continuous Deployment Practices, with Production, Test and Development Enviro...
Continuous Deployment Practices, with Production, Test and Development Enviro...
 
Introduction au Framework AngularJs
Introduction au Framework AngularJsIntroduction au Framework AngularJs
Introduction au Framework AngularJs
 
Programmation sous Android
Programmation sous AndroidProgrammation sous Android
Programmation sous Android
 
Distributed system coordination by zookeeper and introduction to kazoo python...
Distributed system coordination by zookeeper and introduction to kazoo python...Distributed system coordination by zookeeper and introduction to kazoo python...
Distributed system coordination by zookeeper and introduction to kazoo python...
 
Kafka pub sub demo
Kafka pub sub demoKafka pub sub demo
Kafka pub sub demo
 
Mastering GC.pdf
Mastering GC.pdfMastering GC.pdf
Mastering GC.pdf
 
옵저버빌러티(Observability) 확보로 서버리스 마이크로서비스 들여다보기 - 김형일 AWS 솔루션즈 아키텍트 :: AWS Summi...
옵저버빌러티(Observability) 확보로 서버리스 마이크로서비스 들여다보기 - 김형일 AWS 솔루션즈 아키텍트 :: AWS Summi...옵저버빌러티(Observability) 확보로 서버리스 마이크로서비스 들여다보기 - 김형일 AWS 솔루션즈 아키텍트 :: AWS Summi...
옵저버빌러티(Observability) 확보로 서버리스 마이크로서비스 들여다보기 - 김형일 AWS 솔루션즈 아키텍트 :: AWS Summi...
 
Presentation bpel
Presentation bpelPresentation bpel
Presentation bpel
 
Ch3 sma-architectures-2012
Ch3 sma-architectures-2012Ch3 sma-architectures-2012
Ch3 sma-architectures-2012
 

Similar to All about agents jade

My research proposal slides.
My research proposal slides.My research proposal slides.
My research proposal slides.Bu Sawoo
 
The April Agent Platform
The April Agent PlatformThe April Agent Platform
The April Agent PlatformLuigi Ceccaroni
 
Research Final Defense slides.
Research Final Defense slides. Research Final Defense slides.
Research Final Defense slides. Bu Sawoo
 
The april agent platform 2002 agentcities, lausanne
The april agent platform 2002 agentcities, lausanneThe april agent platform 2002 agentcities, lausanne
The april agent platform 2002 agentcities, lausanneLuigi Ceccaroni
 
Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...IndicThreads
 
Building scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thriftBuilding scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thriftTalentica Software
 
Final Defense slide of my research.
Final  Defense slide of my research. Final  Defense slide of my research.
Final Defense slide of my research. Bu Sawoo
 
Building Killer RESTful APIs with NodeJs
Building Killer RESTful APIs with NodeJsBuilding Killer RESTful APIs with NodeJs
Building Killer RESTful APIs with NodeJsSrdjan Strbanovic
 
Ijaprr vol1-3-10-14prajguru
Ijaprr vol1-3-10-14prajguruIjaprr vol1-3-10-14prajguru
Ijaprr vol1-3-10-14prajguruijaprr_editor
 
Ijaprr vol1-3-10-14prajguru
Ijaprr vol1-3-10-14prajguruIjaprr vol1-3-10-14prajguru
Ijaprr vol1-3-10-14prajguruijaprr
 
Mainframe Architecture & Product Overview
Mainframe Architecture & Product OverviewMainframe Architecture & Product Overview
Mainframe Architecture & Product Overviewabhi1112
 

Similar to All about agents jade (20)

My research proposal slides.
My research proposal slides.My research proposal slides.
My research proposal slides.
 
The April Agent Platform
The April Agent PlatformThe April Agent Platform
The April Agent Platform
 
Research Final Defense slides.
Research Final Defense slides. Research Final Defense slides.
Research Final Defense slides.
 
The april agent platform 2002 agentcities, lausanne
The april agent platform 2002 agentcities, lausanneThe april agent platform 2002 agentcities, lausanne
The april agent platform 2002 agentcities, lausanne
 
Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...
 
Building scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thriftBuilding scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thrift
 
Final Defense slide of my research.
Final  Defense slide of my research. Final  Defense slide of my research.
Final Defense slide of my research.
 
Java Profiling
Java ProfilingJava Profiling
Java Profiling
 
Building Killer RESTful APIs with NodeJs
Building Killer RESTful APIs with NodeJsBuilding Killer RESTful APIs with NodeJs
Building Killer RESTful APIs with NodeJs
 
6. The grid-COMPUTING OGSA and WSRF
6. The grid-COMPUTING OGSA and WSRF6. The grid-COMPUTING OGSA and WSRF
6. The grid-COMPUTING OGSA and WSRF
 
PROFESSIONAL PROFILE
PROFESSIONAL PROFILEPROFESSIONAL PROFILE
PROFESSIONAL PROFILE
 
xcfgdfbn
xcfgdfbnxcfgdfbn
xcfgdfbn
 
Ijaprr vol1-3-10-14prajguru
Ijaprr vol1-3-10-14prajguruIjaprr vol1-3-10-14prajguru
Ijaprr vol1-3-10-14prajguru
 
Ijaprr vol1-3-10-14prajguru
Ijaprr vol1-3-10-14prajguruIjaprr vol1-3-10-14prajguru
Ijaprr vol1-3-10-14prajguru
 
Mainframe Architecture & Product Overview
Mainframe Architecture & Product OverviewMainframe Architecture & Product Overview
Mainframe Architecture & Product Overview
 
dot NET Framework
dot NET Frameworkdot NET Framework
dot NET Framework
 
Simrat Resume
Simrat ResumeSimrat Resume
Simrat Resume
 
Net Interview questions
Net Interview questionsNet Interview questions
Net Interview questions
 
Sip and the java platforms
Sip and the java platformsSip and the java platforms
Sip and the java platforms
 
Sap
SapSap
Sap
 

More from Aryan Rathore

Programming agents without a programming language
Programming agents without a programming languageProgramming agents without a programming language
Programming agents without a programming languageAryan Rathore
 
Lifelike computer characters
Lifelike computer charactersLifelike computer characters
Lifelike computer charactersAryan Rathore
 
Introduction to the agents
Introduction to the agentsIntroduction to the agents
Introduction to the agentsAryan Rathore
 
How might people interact with agents
How might people interact with agentsHow might people interact with agents
How might people interact with agentsAryan Rathore
 
Good user interface principles
Good user interface principlesGood user interface principles
Good user interface principlesAryan Rathore
 
Direct manipulation versus agents predictables
Direct manipulation versus agents predictablesDirect manipulation versus agents predictables
Direct manipulation versus agents predictablesAryan Rathore
 
Direct manipulation to delegation
Direct manipulation to delegationDirect manipulation to delegation
Direct manipulation to delegationAryan Rathore
 
Designing agents as if people mattered
Designing agents as if people matteredDesigning agents as if people mattered
Designing agents as if people matteredAryan Rathore
 
interface agents metaphors with characters
interface agents metaphors with charactersinterface agents metaphors with characters
interface agents metaphors with charactersAryan Rathore
 
Agents that reduce work and information overload
Agents that reduce work and information overloadAgents that reduce work and information overload
Agents that reduce work and information overloadAryan Rathore
 
Agents for information sharing and coordination
Agents for information sharing and coordinationAgents for information sharing and coordination
Agents for information sharing and coordinationAryan Rathore
 

More from Aryan Rathore (13)

Software agents
Software agentsSoftware agents
Software agents
 
Programming agents without a programming language
Programming agents without a programming languageProgramming agents without a programming language
Programming agents without a programming language
 
Lifelike computer characters
Lifelike computer charactersLifelike computer characters
Lifelike computer characters
 
Introduction to the agents
Introduction to the agentsIntroduction to the agents
Introduction to the agents
 
How might people interact with agents
How might people interact with agentsHow might people interact with agents
How might people interact with agents
 
Good user interface principles
Good user interface principlesGood user interface principles
Good user interface principles
 
Direct manipulation versus agents predictables
Direct manipulation versus agents predictablesDirect manipulation versus agents predictables
Direct manipulation versus agents predictables
 
Direct manipulation to delegation
Direct manipulation to delegationDirect manipulation to delegation
Direct manipulation to delegation
 
Designing agents as if people mattered
Designing agents as if people matteredDesigning agents as if people mattered
Designing agents as if people mattered
 
interface agents metaphors with characters
interface agents metaphors with charactersinterface agents metaphors with characters
interface agents metaphors with characters
 
Basics of agents
Basics of agentsBasics of agents
Basics of agents
 
Agents that reduce work and information overload
Agents that reduce work and information overloadAgents that reduce work and information overload
Agents that reduce work and information overload
 
Agents for information sharing and coordination
Agents for information sharing and coordinationAgents for information sharing and coordination
Agents for information sharing and coordination
 

Recently uploaded

Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 

Recently uploaded (20)

Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 

All about agents jade

  • 2. 2 What is JADE?  A software framework  that simplifies the implementation of multi-agent systems  The middle-ware for Multi-Agent System (MAS)  target users: agent programmers for MAS  agent services • life-cycle, white-page, yellow-page, message transport  tools to support debugging phase • remote monitoring agent, dummy agent, sniffer agent  designed to support scalability • (from debugging to deployment) • from small scale to large scale  Implements Foundation for Intelligent Physical Agents (FIPA).  Fully implemented in Java  distributed under LPGL
  • 3. 3 What is JADE for? JADE is a platform for running agents  To support:  An asynchronous agent programming model  Communication between agents either on the same or different platforms  Mobility, security, and other utilities  Develop custom applications to exploit Agent metaphor  Hook agent framework to JAVA GUI applications
  • 4. 4 Advantages of JADE  Support for mobile devices  Graphical runtime environment  FIPA compliant  Strong development team  Open source  Ontologies  Predefined interaction protocols as specified by FIPA  New interaction protocols can be easily introduced
  • 5. 5 Why is JADE Important?  JADE Hides FIPA From The Programmer!  No need to implement the Agent Platform and Agent Services  No need to implement agent-management ontology and functionalities  An agent is registered with the Agent Platform  It is given a name and a unique address  The Agent class provides a simplified interface to access the services of the Directory Facilitator (registration, searching, …)  No need to implement Message Transport and Parsing  Automatically (and possibly efficiently) done by the framework when sending/receiving messages  Interaction Protocols must only be extended via handle methods
  • 6. 6 What is FIPA?  Founded as a non profit Swiss organization in 1996  Goal  Define a full set of standards for implementing systems within which agents could execute (agent platforms)  Specifying how agents should communicate and interact  A number of standards were proposed, however, never gained commercial support  Agent platforms adopting the "FIPA standard"  The JADE agent programming platform  The Spyse agent programming platform  JACK (Agent Oriented Software Group)  The April Agent Platform and Language  FIPA is currently an IEEE standards committee  FIPA2000 is the current approved FIPA specifications
  • 7. 7 Agent Management Model  The Agent Platform supports the Message Transport System.  The Message Transport Service is the default communication method between agents on different Agent Platforms.  The Agent Platform supports routing tasks. Agent Platform Agent Platform Agent Management System Directory Facilitator Message Transport System Agent Software Message Transport System
  • 8. 8 Agent Management  Agent Management System (AMS) and Directory Facilitator (DF) have a common subset of actions:  Register • JADE automatically calls the register and deregister methods with the default AMS respectively  Deregister • But JADE provides control to do these tasks programmatically for special cases.  Search • Directory Facilitator (DF) is the agent who provides the default yellow page service, provides the capability to search agents with specific capability  modify • AMS supports the modification of the agents during run-time
  • 9. 9 FIPA Agent Execution Model  Agent is autonomous  It completely controls its thread of execution • Private proxy of the life-cycle manager  It decides itself when to read received messages and which messages to read/serve • The transport mechanism fills a private queue but it does not call the agent code (no automatic callback)  Agent needs concurrency  Can engage in multiple simultaneous conversations  Can execute several concurrent tasks
  • 10. 10 Agent Naming  Agent is identified through an extensible collection of parameter-value pairs, called an Agent Identifier (AID).  AID comprises:  A name.  Other parameters, such as transport addresses, name resolution service addresses, and so on.  The name of an agent is immutable; the other parameters in the AID of an agent can be changed.  A given agent may support many methods of communication and can put multiple transport address values in the :addresses parameter of an AID.  a globally unique name.  By default JADE composes this name as the concatenation of the local name – i.e. the agent name provided on the command line – plus the '@' symbol, plus the home agent platform identifier – i.e. <hostname> ':' <port number of the JADE RMI registry> '/' 'JADE')  i.e. GITIAgent@JadeServer:1099/JADE
  • 12. 12 JADE states  AP_INITIATED : the Agent object is built, but hasn't registered itself yet with the AMS,  AP_ACTIVE : the Agent object is registered with the AMS,  AP_SUSPENDED : the Agent object is currently stopped.  AP_WAITING : the Agent object is blocked,  AP_DELETED : the Agent is definitely dead.  AP_TRANSIT: a mobile agent enters this state while it is migrating  AP_COPY: this state is internally used by JADE for agent being cloned.  AP_GONE: this state is internally used by JADE when a mobile agent has migrated
  • 13. 13 Agent Communications - Messaging  Message transport protocols  IIOP  HTTP  Three encodings  String encoding  bit-efficient encoding  XML  Each message protocol supports the three kinds encoding  Only the message envelope depends on transport protocol.  Abstract Frame-based envelope syntax, mapped to protocol-dependent concrete syntaxes.
  • 14. 14 Message Structure  A message is made up of two parts:  envelope expressing transport information  body comprising the ACL message of the agent communication.  For message interpretation by an agent:  ACL semantics are defined only over the ACL message delivered in the message body of a FIPA message.  Information in the message envelope is supporting information only. How and if this information is used to by an agent is undefined by FIPA.
  • 15. 15 How much of FIPA is hidden by JADE?  No need to implement the Agent Platform  AMS, DF, and ACC executed at start-up  No need to implement agent-management ontology and functionalities  An agent is registered with the AP within its constructor • it is given a name and an address  The Agent class provides a simplified interface to access the services of the DF (registration, searching, …)  No need to implement Message Transport and Parsing  automatically (and possibly efficiently) done by the framework when sending/receiving messages  Interaction Protocols must only be extended via handle methods
  • 16. 16 Open Source  JADE is available in Open Source under LGPL license from  The latest version of JADE is 3.5 released June 2007
  • 17. 17 LIST OF ACRONYMS AND ABBREVIATED TERMS  ACL - Agent Communication Language  AID - Agent Identifier  AMS - Agent Management Service. According to the FIPA architecture, this is the agent that is responsible for managing the platform and providing the white-page service.  AP - Agent Platform  DF - Directory Facilitator. According to the FIPA architecture, this is the agent that provides the yellow-page service.  FIPA - Foundation for Intelligent Physical Agents  GUID - Globally Unique Identifier  HTML - Hyper Text Markup Language  HTTP - Hypertext Transmission Protocol  IDL - Interface Definition Language  IIOP - Internet Inter-ORB Protocol  IOR - Interoperable Object Reference  MTP - Message Transport Protocol. According to the FIPA architecture, this component is responsible for handling communication with external platforms and agents.  ORB - Object Request Broker  RMA - Remote Monitoring Agent. In the JADE platform, this type of agent provides a graphical console to monitor and control the platform and, in particular, the life-cycle of its agents.  RMI - Remote Method Invocation
  • 19. 19 Agent Communication Language (ACL)  Semantically defined standard vocabulary and syntax  Agent exchange  String-based messages  An ACL Message  Structured message, targeted for flexible communication  Performative (INFORM, QUERY, REFUSE, …)  Addressing – To – From  ConversationID – Used to link messages in same conversation  In reply to – Sender uses to help distinguish answers  Reply with – Another field to help distinguish answers  Reply by – Used to set a time limit on an answer  Language – Specifies which language is used in the content  Ontology – Specifies which ontology is used in the content  Protocol – Specifies the protocol  Content – This is the main content of the message
  • 20. 20 Agent Communication Example INFORM :sender antagent :receiver bob martin :protocol status :co protocol status :conversation_id example6 :reply_with 275 :reply_by wed 3pm conversation_id example6 :reply_with 275 :reply_by wed 3pm :language lisp :ontology ant :content (target (project “1hour”) (platform “computer15”) (author “sean”)) (time “8/07/01 4pm”) (message “build failed”) (target “compile”) ) Primary Intent Inform, Request, Failure, Refuse, ... Addressing broadcast, forwarding, ... Dialogue Coordination expected vs exceptional response Detailed action or request problem specific language, ontology, request
  • 21. 21 Content Language (CL)  Defines  proper syntax for content expressions  number of operators such as the logical connectors AND and OR  Semantic Language (SL)  Describes actions, propositions, and identifying expressions  Well Formed Formulas, logical operators built in to SL. In addition there are some interesting existential quantifiers such as B, "believes", and U, "uncertain".
  • 22. 22 Agents and Agency  What is an Agent?  There seem to be as many definitions as there are users of it  Dictionary: a·gent n. 1. One that acts or has the power or authority to act. 2. One empowered to act for or represent another: an author's agent; an insurance agent. 3. A means by which something is done or caused; instrument. 4. A force or substance that causes a change: a chemical agent; an infectious agent. 5. A representative or official of a government or administrative department of a government: an FBI agent. 6. A spy. 7. Linguistics. The noun or noun phrase that specifies the person through whom or the means by which an action is effected.
  • 23. 23 Motivation  Most important development in IT in past 10 years?  How to build software in a dynamic, open, culturally diverse world?  Intelligent personal assistants
  • 24. 24 Are these agents?  Web crawler  Virus  Email handler
  • 25. 25 The Agent Metaphor  Human surrogate/servant  Emphasis on communication  Autonomy  Persistence
  • 26. 26 Parent technologies  artificial intelligence  software engineering  distributed systems  organisational science  databases  economics  game theory  artificial life
  • 27. 27 What is an agent?  Software agents are small, efficient pieces of code that combine the job execution properties of a scripting language with the communications capabilities of objects. Agents carry out specific, repetitive, and predictable tasks on behalf of a computer user, business process, or software application. And like software objects, agents have programmable properties and behaviours. from the WWW in 1996
  • 28. 28 What is an Agent? “encapsulated computer system, situated in some environment, and capable of flexible autonomous action in that environment in order to meet its design objectives” (Wooldridge) • control over internal state and over own behavior • experiences environment through sensors and acts through effectors • reactive: respond in timely fashion to environmental change • proactive: act in anticipation of future goals
  • 29. 29 Why agents are useful  Ability to perform in an open, dynamic, unpredictable environment  Potential for exploiting the Internet  Ease of interfacing with legacy software  Aid to model a complex environment  Potential for more intelligent software
  • 30. 30 Agent Advantages  ‘Natural’ Abstraction level  Easy to specify knowledge (for analysts)  Useful breakdown of problems  Modularity  Coping with legacy systems
  • 31. 31 What agents are not  Wizards  Scripting languages  Programming languages  Neural Networks  Pure rule-based systems  Objects
  • 32. 32 What About Human Agents?  Some characteristics of human agents  carries out some task for someone else (master/slave)  is given goals but has considerable leeway on how to achieve these goals  probably moves around  observes features of her or his environment  interacts with, and perhaps changes to some extent, his or her environment of objects and (possibly) other agents  has a memory to store instructions, goals and other information  (hopefully) exhibits some intelligence  Keywords  goals, observations, autonomy, intelligence, mobility
  • 33. 33 How About Software Agents?  Artificial Intelligence Agents  First to use agent term in the computer world  Usually individual 'creatures' living in an environment where they interact in some way  Agents are more or less autonomous  Most AI agents do not interact with other agents in the same environment  Exhibit some kind of intelligence  A good example: robot interacting with a real world environment
  • 34. 34 Example of An Ideal Agent  Imagine an autonomous automatic pilot controlling an aircraft  Goal of safely landing at some airport.  Requires:  Pro-activeness • Plan how to achieve this goal (may include pre-compiled plans) • Generate subsidiary goals (e.g., ascend to an altitude of 30,000 feet, then proceed due north at a speed of 400 knots . . . ).  Autonomous • Execute its plans, but not blindly • Maintains local state • Responds appropriately if unforeseen circumstances (e.g., a change in weather conditions, a fault in the aircraft, a request from airtraffic control)  Reactiveness • Can not spend hours deliberating, must respond in a timely manner  Social ability • Auto-pilot cooperates with air-traffic controllers and perhaps other aircraft in order to achieve its goals
  • 35. 35 Trends in the Agent World  Agent standards  FIPA, JAS, OMG  Agent initiatives  Agentcities  TILAB and Motorola: JADE/LEAP for mobility  Robust agent platforms  JADE + J2EE -> BlueJADE  Fledgling work on Semantic Web  DAML + OIL
  • 36. 36 References  Agent technology  FIPA: http://www.fipa.org  JADE: http://jade.cselt.it/  BlueJADE: https://sourceforge.net/projects/bluejade/  Agentcities: http://www.agentcities.net http://www.agentcities.org  CoABS GRID http://www.java-agent.org/  AI technology  Weka: http://www.cs.waikato.ac.nz/~ml/weka  Lucene: http://jakarta.apache.org/lucene/docs/index.html  Jess: http://herzberg.ca.sandia.gov/jess/  Agent groups  Utah: http://www.cs.utah.edu/arg  Santa Cruz: http://www.soe.ucsc.edu/research/agents  UMBC:  DARPA http://agents.umbc.edu
  • 37. 37 Protocol: Allowed Message Patterns Martin PA Bob PA ANT Agent Ant Listener Bob Notification Agent SUBSCRIBE project ... INFORM project CONFIRM ... Standards contract-net, auctions, planning, negotiation, management, …. Tools State Machines Workflow UML Models Meetings Organizations Context CANCEL project ... AGREE REFUSE DISCONFIRM ... INFORM project INFORM project PROPOSE note ACCEPT-PROPOSAL REJECT-PROPOSAL
  • 38. 38 JADE Intro  Introduction to JADE concepts
  • 39. 39 Mapping Theory into Design  Agents are autonomous.  Agents are social entities.  Messages are speech acts, not invocations.  An agent can say “no” and “I don’t care”.  Agents are active objects.  Intra-agent concurrency is needed.  Asynchronous messaging must be used.  Peer-To-Peer messaging (built over distributed objects Client/Server interactions).
  • 40. 40 JADE API  The JADE framework includes a library of interaction protocols and generic agent behaviours, that must be customized for the specific application needs in order to create the agent capabilities  Quite Complex 100+ classes  Don't need to know most of it  Examples give you most of what you need  Key Classes:  jade.core.Agent: base class for agents  jade.core.behaviours.* : Behaviours  jade.lang.acl.ACLMessage: Message class  jade.core.AID: Agent identifer
  • 41. 41 Network protocol stack JRE JRE JRE Jade Main-container Jade Agent Container Jade Agent Container Jade distributed Agent Platform ApplicationAgent ApplicationAgent ApplicationAgent ApplicationAgent ApplicationAgent ApplicationAgent ApplicationAgent ApplicationAgent ApplicationAgent Host 1 Host 2 Host 3 JADE Agent Platform
  • 42. 42 Intra-Container Message Transport (Java events) White page service Agent Management System Yellow page service Directory Facilitator Agent Communication Channel Inter-Containers Message Transport (Java RMI) Inter-Platforms Message Transport (IIOP) local cache of agent addresses JADE Agent Container Note: The internal architecture of a JADE main container is similar, but it does not contain the AMS, the DF, and the IIOP modules.
  • 43. 43 JADE Communication  Every agent has a private queue of ACL messages created and filled by the JADE communication sub-system  Designed as a chameleon to achieve the lowest cost for message passing  the mechanism is selected according to the situation  the overheads depend on the receiver’s location and the cache status
  • 44. 44 JADE Communication Message Dispatcher AGENT CONTAINER Message Dispatcher AGENT CONTAINER (FE) Message Dispatcher AGENT CONTAINER Java RMI Agent2 event Local cache Agent Global Descriptor Table event Agent3 Agent1 Agent Container Table
  • 45. 45 Communication Model  Library of interaction protocols  Framework directly supports parsing  Envelope parser (in JADE 2.0)  Agent Communications Language (ACL) parser  Content Language (CL) parser • including support for uuencoded Java serialization  Ontology checker  Framework can be extended by the user  Support to define/save/load new ontologies  Interface for CL Parser/Encoder  Automatically used by the framework
  • 46. 46 Agent Execution Model  Agent is autonomous  it completely controls its thread of execution private proxy of the life-cycle manager  it decides itself when to read received messages and which messages to read/serve the transport mechanism fills a private queue but it does not call the agent code (no automatic callback)  Agent needs concurrency  can engage multiple simultaneous conversations  can execute several concurrent tasks Java multi-thread or/and JADE behaviours with cooperative scheduling one thread-per-agent rather than one thread-per-task/conversation
  • 47. 47 Agent Tasking Model  JADE uses the Behaviour abstraction to model the agent tasks  An agent can instantiate at run time new behaviours according to its needs and capabilities  Keeps the number of threads required to run the agent platform small  Does not prevent the programmer from using one thread-per-task implementation (no specific support is given for this case: Java multi- thread is considered sufficient)
  • 48. 48 Generic JADE agent private inbox of ACL messages scheduler of behaviours patternmatching timeout- based blocking-based polling-based life-cycle manager accessmode application dependent agent resources beliefs capabi- lities behaviour1 behaviour2 behaviourn … active agent behaviours (i.e. agent intentions) JADE library of interaction protocols and of generic agent behaviours
  • 49. 49 Concurrency in JADE  Different containers on the same platform  1 JVM per container  Different agents on the same container  run in a pre-emptive multi-threaded environment scheduled by the JAVA Virtual Machine  Different behaviours on the same agent  scheduled cooperatively • every behaviour must release the control to allow the other behaviours to be executed • no stack to be saved, more effort to the programmer • JADE scheduler carries out a round-robin non-preemptive policy among all behaviours in the ready queue  Behaviours can be composed into a tree • every Behaviour is a Finite State Machine – one state per execution time slot
  • 50. 50 Behaviour-Based Concurrency Model  Multithreaded inter-agent scheduling.  Behaviour abstraction  Composite for structure  Chain of Responsibility for scheduling.  No context saving. x:SequentialBehaviour y:SequentialBehaviour x1:SimpleBehaviour x2:SimpleBehaviour y1:SimpleBehaviour y2:SimpleBehaviour 1 2 :Agent 1.1 1.2 2.1 2.2 run() mainLoop() b1 = schedule() Exc. handler run() mainLoop() Exc. handler run() mainLoop() Exc. handler run() mainLoop() b2 = schedule() Exc. handler b1.action() b1.done()? a) b) c) d) run() mainLoop() Exc. handler run() mainLoop() Exc. handler b2.action() b2.done()? e) f)
  • 51. 51 Scalability in JADE  Configuration of a platform  From one MAS on a single host • single-host platform  To one agent on a single host • agent platform on a cluster of hosts  Configuration can be changed at run-time • Hot restarting is possible thanks to the local caches –Agent is referred by name => no need to get new reference  The agent container front end is the bottle-neck but it is involved only when strictly necessary
  • 52. 52 Communication Overheads  Same container • No remote invocations • ACL message object is cloned  Same Agent Platform, different container, cache hit • One RMI call, the ACL message object is serialized and unserialized by RMI run time  Same Agent Platform, different container, cache miss • Two RMI calls (update the cache, send the message), the ACL message object is serialized and unserialized by RMI run time  Different platforms • CORBA remote invocation through IIOP • Double marshalling from Java object to Java String to IIOP byte stream (sender side) • Double unmarshalling from IIOP byte stream to Java String to Java object (receiver platform side)
  • 53. 53 JADE Support Tools  Administration tools.  RMA Management Agent. • White pages GUI. • Agent life cycle handling.  Directory Facilitator GUI. • Yellow pages handling.  Development tools.  DummyAgent. • Endpoint Debugger.  Message Sniffer. • Man-in-the-middle.
  • 55. 55 Agent Management Model  The main difference is the ACC is not an agent.  The ACC supports the Message Transport System.  The Message Transport Service is the default communication method between agents on different APs.  The ACC also supports AP routing tasks. Agent Platform Agent Platform Agent Management System Directory Facilitator Message Transport System Agent Software Message Transport System
  • 56. 56 Jade Toolkit  Platform Runtime  Agent lifecycle  Message transport  Service agents  Agent Support  Internal scheduling  Decoding and understanding communication  Debugging  Tracing Messages  Examining Agent State
  • 58. 58 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
  • 59. 59 Distributed Architecture JADE Platform Container Agent Agent Agent Container Agent Agent JADE Platform Container Agent Agent JADE Platform Container Agent Agent Agent Message
  • 60. 60 Platform Services  Implemented as agents  Agent Management Service (AMS)  “White Pages”  Maintains set of agents on a platform  Directory Facilitator (DF)  “Yellow Pages”  Provides a service directory  Maps service descriptions to Agent Identifiers  Agents can add/modify/delete entries for themselves
  • 61. 61  JADE based applications are made by one or more Agents  A JADE agent is mapped onto an user defined Java class, that must subclass Agent class in jade.core package.  Agent activities are mapped onto user defined subclasses of Behaviour class in jade.core.behaviours package. JADE Programming Model
  • 62. 62 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
  • 63. 63 Agent Class  The agent name is an Agent Identifier, represented by AID class  The name attribute is a globally unique identifier.  The full name of an agent is no longer composed of the concatenation of its local name and the platform IIOP address  FIPA does not allow to distinguish between the local name and its home AP address.  The method, getAID(), returns the agent AID.
  • 64. 64 JADE Agent  Your agent should inherit from Agent  See JADE API docs for inherited methods  Everything begins with setup: protected void setup () { … }  This is where you initialize and addBehaviours to handle the processing  Other useful methods:  protected void takeDown() { … } // cleanup  public void addBehaviour(Behaviour b)  public final ACLMessage blockingReceive(MessageTemplate pattern, long millis)  public final ACLMessage receive(MessageTemplate pattern)  public final void send(ACLMessage msg)
  • 65. 65 Behaviours  Behaviour not Behavior (British spelling)  Each agent has a set of active behaviours  Each behaviour should achieve a single task or sub-task  “Send this message”  “Buy X”  A behaviour  Runs until it is finished  Should behave fairly—yield control, not block  No infinite loops  All active behaviours get executed with equal frequency  Can create composite behaviours
  • 66. 66 Basic Behaviour Model  Round-robin scheduling of all behaviours in the run queue  When message arrives, all blocked behaviours are added to run queue  Next behaviour selected from all “active behaviours”  All active behaviours get executed equally often  Primary methods:  public abstract void action() • Each time the behaviour has a turn, action is called  public abstract boolean done() • When action is finished this is called to determine if we put back into run queue or leave in list of finished behaviours • Returns false while working or true when finished  public void block() • Tells to move to blocked queue when the action exits  public void block(long millis) • Adds ability to wait until woken up or timeout
  • 67. 67 Predefined Behaviours  You define action yourself  SimpleBehaviour  You define done() yourself  CyclicBehaviour  You may NOT define done()  ‘done’ is permanently set to return false  OneShotBehaviour  You may NOT define done()  ‘done’ is permanently set to return true
  • 68. 68 Behaviours Behaviour action() done() Simple Behaviour CompositeBehaviour <<protected>> preAction() <<protected>> postAction() <<protected>> bodyAction() addBehaviour() removeBehaviour()OneShotBehaviour CyclicBehaviour SequentialBehaviour <<protected>> bodyAction() Abstract class Abstract - simple not composable no interruption Abstract – com- poses children; interruptable ParallelBehaviour <<protected>> bodyAction() FSMBehaviour <<protected>> bodyAction() Finite State Machine done = true done = false
  • 69. 69 Assigning Behaviour Agent class, which must be extended by agent programmers exposes two methods: addBehaviour(Behaviour) and removeBehaviour(Behaviour), which allow to manage the ready tasks queue of a specific agent. Behaviours and sub-behaviours can be added whenever is needed, and not only within Agent.setup() method. Adding abehaviour should be seen as a way to spawn a new (cooperative) execution thread within the agent
  • 70. 70 Example of a Behaviour public class my3StepBehaviour extends OneShotBehaviour{ private int state = 1; private boolean finished = false; public void action() { switch (state) { case 1: { op1(); state++; return; } case 2: { op2(); state++; return; } case 3: { op3(); state=1; finished = true; return; } } } public boolean done() { return finished; } }
  • 71. 71 Composite Behaviours  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
  • 72. 72 Adding Behaviour to an Agent addBehaviour(new TickerBehaviour(this, 1000) { protected void onTick() { System.out.println("Agent "+myAgent.getLocalName()+": tick="+getTickCount()); } });
  • 73. 73 Adding WakerBehaviour addBehaviour(new WakerBehaviour(this, 10000) { protected void handleElapsedTimeout() { System.out.println("Agent "+myAgent.getLocalName()+": It's wakeup-time. Bye..."); myAgent.doDelete(); } });
  • 74. 74 Adding CycleBehaviour addBehaviour( new CyclicBehaviour( this ) { public void action() { ACLMessage msg = receive( MessageTemplate.MatchPerformative( ACLMessage.INFORM ) ); if (msg != null) { if (HostAgent.GOODBYE.equals( msg.getContent() )) { …….
  • 75. 75 Complex Behaviours: Sequential  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.
  • 76. 76 Complex Behaviours: Parallel  All child behaviours are activated simultaneously  Behaviour can exit:  When first child completes (conditionally dependent)  When all children complete
  • 77. 77 class ParallelBehaviour This class is a CompositeBehaviour that executes its sub- behaviours concurrently and terminates when a particular condition on its sub-behaviours is met. Proper constants to be indicated in the constructor of this class are provided to create a ParallelBehaviour that ends when all its sub- behaviours are done,
  • 78. 78 Complex Behaviours: Finite State Machine  Deterministic FSM.  Sub-behaviours are states  Current state is active behaviour  Transitions occur depending on outcome of last behaviour
  • 79. 79 Complex Behaviours: Protocols  Off-the shelf implementation of interaction protocols  Does sending/receiving messages for you  Checks protocol compliance  Each place where agent can act in protocol is a sub- behaviour (or a callback)  Just need to plug in logic to implement agent decisions  Built internally using FSM behaviours
  • 80. 80 Example Agent  Example1  SimpleReceiverAgent • Same as sender but uses SimpleReceiverBehaviour  SimpleReceiverBehaviour • CyclicBehaviour • Checks to see if message has arrived and prints if it does • Does a block(500) to stop busy waiting • Could use blockingReceive or block()
  • 81. 81 Execute the behaviour in a dedicated Thread public class ThreadedAgent extends Agent { private ThreadedBehaviourFactory tbf = new ThreadedBehaviourFactory(); protected void setup() { // Create a normal JADE behaviour Behaviour b = new OneShotBehaviour(this) { public void action() { // Perform some blocking operation that can take a long time } }; myAgent.addBehaviour(tbf.wrap(b)); } }
  • 83. 83 Agent Communication  All communication is message-based unlike Remote Procedure Calls (RPC)  No explicit link between initiation and response  Platform Routes messages between agents  Agent constructs and decodes messages internally
  • 84. 84 Constructing a Message  Create Message Object (ACLMessage)  Set performative  Set sender and recipients  Set message attributes  Fill content (from java objects)
  • 85. 85 Message Structure  Envelope  Constructed/Interpreted by platform  Routing: Indicates sender and recipients of message and where the message has been  ACL Message  Performative (REQUEST/INFORM)  Set of standard attributes • Language of message body • Conversation ID • Ontology used in message  Body • Interpreted by agents • Conforms to some content language and Ontology
  • 86. 86 Message Content  Content of message complies with Content Language (CL) and Ontology  Semantic Language (SL)  SL0: Objects, Actions, Results  SL1: Basic Logical Operators, Predicates AND/OR/NOT  SL2: Higher-level modalities: Belief, Intention, Goal  Objects in language are described by Ontology
  • 87. 87 Hosts under Test JAVA Java RMI JADE PLATFORM Hosts under Test Hosts under Test Hosts under Test JADE LUS Main container Main Platform Host containers Command Messages Status/Reports/Event Messages Network Jade Messaging Architecture
  • 88. 88 Agent Instrumentation : Underlying Technology Out-of-band Network Host under Test SUT logs SUT logs SUT logs SUT logs Master Sql dataflow Storage Service TestNetwork JADE PLATFORM Agent Agent Agent Agent LogsJade Agent Host under Test Host under Test Host under Test Sniffers
  • 90. 90 JADE Sniffer Agent Sniffer Agent is basically a FIPA-compliant Agent with sniffing features.
  • 91. 91 Introspector Agent This tool allows to monitor and control the life-cycle of a running agent and its exchanged messages
  • 92. 92 Ontology  Ontology provides description of concepts in the world and relationships between them
  • 93. 93 Event type: Room features: …. address: ... Time zone: day: hour: where when Person email role project Organizer …. Participant …. priority:... with by Multiple oneOf: allOf: at * * * Ontology: Terms & Relationships Standards Shopping, Events, Travel, People, Organizations, Roles, Context, … Tools & Models UML, XML, AUML, DAML, OIL, RDF, Protégé, ...
  • 94. 94 Ontology Description Common vocabulary of agreed upon definitions and relationships between those definitions, to describe a particular subject domain. E.g.: Agent management ontology UMTS wireless technology ontology Cinema ontology Weather ontology IEEE Standard Upper Ontology
  • 95. 95 W3C.org  An ontology defines the terms used to describe and represent an area of knowledge. Ontologies are used by people, databases, and applications that need to share domain information (a domain is just a specific subject area or area of knowledge, like medicine, tool manufacturing, real estate, automobile repair, financial management, etc.). Ontologies include computer-usable definitions of basic concepts in the domain and the relationships among them (note that here and throughout this document, definition is not used in the technical sense understood by logicians). They encode knowledge in a domain and also knowledge that spans domains. In this way, they make that knowledge reusable.
  • 96. 96 W3C.org Concepts  Classes (general things) in the many domains of interest  The relationships that can exist among things  The properties (or attributes) those things may have
  • 97. 97 W3C.org Ontologies are usually expressed in a logic-based language, so that detailed, accurate, consistent, sound, and meaningful distinctions can be made among the classes, properties, and relations. Some ontology tools can perform automated reasoning using the ontologies, and thus provide advanced services to intelligent applications such as: conceptual/semantic search and retrieval, software agents, decision support, speech and natural language understanding, knowledge management, intelligent databases, and electronic commerce.
  • 99. 99 More on Behaviours  Suppose that we want two agents that talk back and forth to each other  Have one be the initiator and start the conversation • Could imagine other ways of doing this – first one to start becomes the initiator  To simplify things, we have one agent and use it twice • So, we do a condition to see if it is the initiator or not • The code is nearly identical and thus creating another whole agent program seems like a waste  Example2 provides the code  See next slide for an illustration of how it works
  • 100. 100 Exchange Messages  Me (initiator)  Send message  Wake up: • If message, remember that you have seen it • If no message and seen a message, send a reply  Go back to sleep for 5 seconds  Message traffic  0 - Send  0 - Sleep 5  5 - Sleep 5  10 - Sleep 5  10 – Receive  10 – Sleep 5  15 – Send  15 – Sleep 5  …  You  Not initiator, so don’t send  Wake up: • If message, remember that you have seen it • If no message and seen a message, send a reply  Go back to sleep for 10 seconds  Message traffic  0 - Receive  0 - Sleep 10  5 –  10 - Send msg  10 – Sleep 10  10 –  15 – Receive  15 – Sleep 10  …
  • 101. 101 A Different Approach  Question – what if you wanted to use two behaviours?  One responsible for sending answers  One responsible for receiving the message  Is this the same exact model as example2?  Receiver ACLMessage msg = receive(); if (msg != null) { // process message receivedMessage = true; } block();  Sender // Did I wake up too early? <<do some computation on time>> if (!tooEarly) { if (receivedMessage) { sendMessage(); } block(fulltime); } else { <<compute how much time left to wait>> block(timeLeft); } Only wakes up when a message arrives Wakes on message arrival or time out finished.
  • 102. 102 Exchange Messages - 2  Me (Initiator)  Send message  Wake up: • If message, remember that you have seen it • If no message and seen a message, send a reply  Go back to sleep for 5 seconds  Message traffic  0 - Send  0 - Sleep 5  5 - Sleep 5  10 - Sleep 5  10 – Receive  10 – Sleep 5  15 – Send  15 – Sleep 5  …  You  Not initiator, so don’t send  Wake up: • If message, remember that you have seen it • If no message and seen a message, send a reply  Go back to sleep for 10 seconds  Message traffic  0 - Receive  0 - Sleep 10  5 –  10 - Send msg  10 – Sleep 10  10 –  15 – Receive  15 – Sleep 10  …
  • 103. 103
  • 104. 104 BankServerAgent ACLMessage msg = receive(); if (msg == null) { block(); return; } try { Object content = msg.getContentObject(); switch (msg.getPerformative()) { case (ACLMessage.REQUEST): if (action instanceof CreateAccount) addBehaviour(new HandleCreateAccount(myAgent, msg)); else if (content instanceof MakeOperation) addBehaviour(new HandleOperation(myAgent, msg)); ... }
  • 105. 105 JADE  Java Agent Development Environment  Standards Based - FIPA (Foundation for Intelligent Physical Agents)  http://www.fipa.org/  Non-profit association  Purpose to promote the success of emerging agent-based applications, services, and equipments  FIPA has over 65 member companies
  • 106. 106 FIPA Agent Platform  Must Provide  Life Cycle Management  White Page Service  Yellow Page Service  Message Transport Service  Optionally Provides  Ontology Service  Human Agent Interaction  Agent Software Integration