Software Agents
ECEG-7521
Agent-based System
Frameworks
Surafel Lemma Abebe (Ph. D.)
Outline
• Introduction
• Requirements for MAS frameworks
• FIPA standardization
• Example framework
Surafel Lemma Abebe (Ph. D.) 2
Introduction
• Definitions
– Software architecture
• Refers to high-level structures of a software system
• Defined as the set of structures needed to reason
about the software system, which comprises the
software element, the relationships between them, and
the properties of both elements and relations
– Agent platform
• Is a technological architecture providing the
environment in which agents can operate to achieve
their goals
Surafel Lemma Abebe (Ph. D.) 3
Introduction…
• Definitions…
– Framework
• Is a software providing generic functionality that can be
selectively changed by additional user-written code, thus
providing application specific software
• Software framework
– Is a universal, reusable software platform used to develop
applications, products, and solutions
– Includes supported programs, compilers, code libraries, tool sets
and APIs
– Agent tool
• Is a term used to include all software technologies that
implement (some of the) agent notions, including platforms,
frameworks, goal specific software, and tailored solutions
Surafel Lemma Abebe (Ph. D.) 4
Requirements for MAS frameworks
• Requirements (infrastructure needs)
– Components
• Refer to the elements that comprise a MAS framework
– Desired properties
• What the framework should support and accommodate
– General criteria
• Non-functional requirements
– Usage capabilities
• Tools and process support
Surafel Lemma Abebe (Ph. D.) 5
Requirements…
• Required components
– Execution Engine (EE)
• A MAS framework should have a mechanism to execute and
control the MAS operation
– Communication Languages (CL)
• A MAS framework should provide support for Agent
Communication Languages (ACLs) and their underlying
support bases (e.g., belief knowledge bases for MAS based
on KQML, FIPA, etc.)
– Mobility (MO)
• A MAS framework should facilitate the mobility of MAS
design and execution across environments
Surafel Lemma Abebe (Ph. D.) 6
Requirements…
• Required components…
– Security (SEC)
• A MAS framework should provide an inherent support for MAS
security
– Resource Description and Discovery (RDD) Services (RDDS)
• A MAS framework should provide services for resources (such as
agent, services, teams, markets, and capabilities) description, offering,
and discovery
– Simulator and Experimenter (SE)
• A MAS framework should provide means for testing and exploring
MAS applications’ behavior before they are deployed
– Data Collector and Monitoring (DCM)
• A MAS framework should provide means for collecting data regarding
applications’ execution, to facilitate analysis of their performance
Surafel Lemma Abebe (Ph. D.) 7
Requirements…
• Required properties
– Openness (OPEN)
• A MAS framework should be able to accommodate
agents that are heterogeneous across dimensions (e.g.,
architecture, resources used, interactivity, and scale)
– Scalability (SCL)
• A MAS framework should support the scalability of
MAS in terms of execution and design
Surafel Lemma Abebe (Ph. D.) 8
Requirements…
• General criteria required
– Usability (USA)
• A MAS framework should provide means to easily learn its usage and
limitations
– Support (SUP)
• A MAS framework should continuously be developed and evolved
– Use
• To gain further confidence in adopting a MAS framework, it is
preferable that it would have a large number of developed
applications
– Standardization (STD)
• It is preferable that a MAS framework would comply with a standard
• Adhering to a standard will benefit from many components,
architectures, languages, interfaces, and would facilitate
interoperability of the MASs
Surafel Lemma Abebe (Ph. D.) 9
Requirements…
• Required usage capabilities
– Design Methodologies (DM)
• It is preferable that a MAS framework would be accompanied with
systematic engineering methods for the design and construction of
MAS
– Integrated Development Environments (IDEs)
• It is preferable that a MAS framework would be provided along
with an IDE which is specialized for the construction, operation,
and use of MAS
• The IDE may consist of a debugger, a testing environment,
simulation, etc.
– Templates (TEMP)
• It is preferable that a MAS framework would be provided along
with a set of templates that better facilitate the development of
the appropriate agent types
Surafel Lemma Abebe (Ph. D.) 10
FIPA standardization
• FIPA
– Foundation for Intelligent Physical Agent
– Provides a specification of a generic reference model
for MAS infrastructure
Surafel Lemma Abebe (Ph. D.) 11
FIPA standardization…
• Components in agent platform
– According to FIPA, an agent platform should include the following
components
– Agents
• Computational processes implementing agent characteristics such as autonomy
and proactiveness
– Directory facilitator (DF)
• Provides yellow pages services
• Services include registration, deregistration, modification, and search
– Agent management system (AMS)
• Manages and monitors all agents’ lifecycles and provide the control (e.g.,
scheduling and messaging) for the entire platform
• Capabilities
– Suspend agents, terminate agents, create agents, resume agents’ execution, invoke agents,
execute agents, and handle resource management
– Message transport system (MTS)
• Is responsible for communication between agents that reside on different
platforms
Surafel Lemma Abebe (Ph. D.) 12
JADE
• Overview
– JADE (Java Agent DEvelopment) Framework
• Is a framework to develop and run multi-agent systems in compliance
with the FIPA specifications
– Developed by Telecom Italia @TILab
– Distributed under LGPL
– Can be downloaded from http://jade.tilab.com
– Some references
• JADE administrator guide
– http://jade.tilab.com/doc/administratorsguide.pdf
• JADE programmer guide
– http://jade.tilab.com/doc/programmersguide.pdf
• Tutorials
– http://jade.tilab.com/doc/tutorials/JADEProgramming-Tutorial-for-
beginners.pdf
Surafel Lemma Abebe (Ph. D.) 13
JADE…
• Overview…
– Includes
• Runtime environment
– Environment where JADE agents can “live”
– Must be active on a given host before one or more agents can
be executed on the host
• Library
– Classes that programmers can use to develop their agents
• Graphical tools
– Allows administrating and monitoring the activity of running
agents
Surafel Lemma Abebe (Ph. D.) 14
JADE…
• Overview…
– Includes…
• Graphical tools… - Remote Management Agent (RMA)
Surafel Lemma Abebe (Ph. D.) 15
JADE…
• Overview…
– Agent development
• JADE does not provide an official tool
– Non-official tools are available
– Suggested Eclipse plugin EJADE
• Main features
– 1-click agent deployment
– Launch/Shutdown RMA
– Specify startup parameters
– Agent testing
• Download from http://selab.fbk.eu/dnguyen/ejade/
Surafel Lemma Abebe (Ph. D.) 16
JADE…
• Containers and platforms
– Container
• Running instance of JADE runtime
environment
• Can contain several agents
– Platform
• Set of active containers
• In a platform a single special Main Container must always be active
Surafel Lemma Abebe (Ph. D.) 17
JADE…
• Containers and platforms…
– Main container
• All other containers register themselves with this container
• Holds two special agents AMS and DF
• AMS (Agent Management System)
– Provides the naming service
» Ensures that each agent in the platform has a unique name
– Represents the authority in the platform
» Create/kill agents
• DF (Directory Facilitator)
– Provides a yellow page service
Surafel Lemma Abebe (Ph. D.) 18
JADE…
• JADE agent
– Identified by a unique name
– Can communicate only when they know each other’s name
– Agent identification
• Complete agent name
– <local-name>@<platform-name>
– The complete name must be globally unique
• Platform name
– Default: <main-host>:<main-port>/JADE
– A different name can be set with the -name option when you run an
agent
• Within the same platform, agents can be referred to using their
local name only
Surafel Lemma Abebe (Ph. D.) 19
JADE…
• Creating agent class
– Create a class by extending the jade.core.Agent class
– Implement setup()
• Includes agent initialization
• Actual job an agent has to do is carried out within behaviors
– Agent identifiers
• Used to identify each agent
• Represented as an instance of the jade.core.AID class
• getAID () method of the Agent class allows retrieving the agent
identifier
• AID object includes a globally unique name plus a number of
addresses
• Name format
<name>@<platform-name>
Surafel Lemma Abebe (Ph. D.) 20
JADE…
• Creating agent class…
– Example
Surafel Lemma Abebe (Ph. D.) 21
JADE…
• Passing arguments to agents
– Agents may get start-up arguments specified on
the command line
Surafel Lemma Abebe (Ph. D.) 22
JADE…
• Agent termination
– To make it terminate, its doDelete() method must
be called
– takeDown() method
• Invoked just before an agent terminates and
• Is intended to include agent clean-up operations
Surafel Lemma Abebe (Ph. D.) 23
JADE…
• Agent termination…
– Example
• What does the following code do?
Surafel Lemma Abebe (Ph. D.) 24
JADE…
• Agent behavior
– Used to execute the actual job of an agent
– Behavior
• Represents a task that an agent can carry out
• Implemented as an object of a class that extends
jade.core.behaviours.Behaviour
– Should implement
» action() method
• Defines the operations to be performed when the behavior is in
execution
» done() method
• Specifies whether or not a behavior has completed and have to be
removed from the pool of behaviors an agent is carrying out
• In order to make an agent execute the task implemented by behavior
object, add the behavior using
addBehaviour()
• Behavior can be added in setup() or any other behavior
Surafel Lemma Abebe (Ph. D.) 25
JADE…
• Agent behavior…
– Path of execution
Surafel Lemma Abebe (Ph. D.) 26
JADE…
• Agent behavior…
– Two types of behaviors
• Simple and composite
– Simple behavior
• One shot behavior
– Completed immediately
– action () method is executed only once
jade.core.behaviours.OneShotBehaviour
• Cyclic behavior
– Behaviors that never complete
– action() method executes the same operation each time it is called
jade.core.behaviours.CyclicBehaviour
– Operation defined in action() is performed repetitively forever, until the
agent carrying out the behavior terminates
Surafel Lemma Abebe (Ph. D.) 27
JADE…
• Agent behavior…
– Simple behavior…
• Generic behavior
– Embeds a status and executes different operations depending
on that status
– Complete when a given condition is met
– Implements the done() method
Surafel Lemma Abebe (Ph. D.) 28
JADE…
• Agent behavior…
– Composite behaviors
• Used to model a complex task, i.e., a task made by
composing a number of other tasks (behaviours)
– jade.core.behaviours.CompositeBehaviour models behaviors
• Is only a common interface
• Does not provide any scheduling of the children
Surafel Lemma Abebe (Ph. D.) 29
JADE…
• Agent behavior…
– Composite behaviors
• Sequential behavior
– Models a complex task
whose sub-tasks are
executed sequentially
– Extend the class
jade.core.behaviours.
SequentialBehaviour
– After executing the
children the behaviour
ends
Surafel Lemma Abebe (Ph. D.) 30
JADE…
• Agent behavior…
– Composite behaviors…
• Parallel behavior
– Models a complex task whose sub-tasks are executed concurrently
– Extends class jade.core.behaviours.ParallelBehaviour
– Terminates when a particular condition on its sub-behaviours is met
» When all children are done (constant ParallelBehaviour.WHEN_ALL)
» When any child is done (constant ParallelBehaviour.WHEN_ANY)
» When N children are terminated
• Use the constructor ParallelBehaviour(int endCondition)
• FSM (Finite state Machine) behavior
– Models a complex task whose sub-tasks correspond to the activities
performed in the states of a finite state machine
– Class jade.core.behaviours.FSMBehaviour
Surafel Lemma Abebe (Ph. D.) 31
JADE…
• Agent behavior… -Behavior model
Surafel Lemma Abebe (Ph. D.) 32
JADE…
• Agent behavior…
– Time-driven behaviors
• Sometimes an agent acts in function of the current
time
– At 12.00AM have lunch
– Each 30 seconds tell another agent the current time
• JADE provides ready-to-use behaviors
– WakerBehaviour
» One shot task executed once after a given timeout
elapsed
– TickerBehaviour
» Cyclic task to be executed periodically
Surafel Lemma Abebe (Ph. D.) 33
JADE…
• Agent communication
– JADE agents have communication capabilities
• Adopted paradigm is asynchronous message passing
– Each agent has a mailbox (the agent message queue)
• JADE posts into the mailbox the messages sent by other agents
• Whenever a message is posted in the message queue the receiving
agent is notified
• The programmer decides when to get the message from the
message queue
Surafel Lemma Abebe (Ph. D.) 34
JADE…
• Agent communication…
– ACL language
• Messages exchanged by JADE agents have a format specified by the ACL
language
• Defined by FIPA standard for agent interoperability
• Has a number of fields
– sender
– receivers
– performative – the communicative intention
» REQUEST
• Sender wants the receiver to perform an action
» INFORM
• Sender wants the receiver to be aware of a fact
» QUERY_IF
• Sender wants to know whether or not a given condition holds
» CFP (call for proposal), PROPOSE, ACCEPT_PROPOSAL, REJECT_PROPOSAL
• Sender and receiver are engaged in a negotiation
Surafel Lemma Abebe (Ph. D.) 35
JADE…
• Agent communication…
– ACL language…
• Fields…
– content
» Actual information included in the message
– language
» Syntax used to express the content
– ontology
» Vocabulary of the symbols used in the content and their meaning
– conversation-id, reply-with, in-reply-to, reply-by
» Fields used to control several concurrent conversations and to
specify timeouts for receiving a reply
• A message is implemented as an object of the class
jade.lang.acl.ACLMessage
– Provides set and get methods for handling all fields of a message
Surafel Lemma Abebe (Ph. D.) 36
JADE…
• Agent communication…
– ACL message fields…
Surafel Lemma Abebe (Ph. D.) 37
JADE…
• Agent communication…
– Sending message
• Requires
– Filling the fields of an ACLMessage object
– Call send() of the Agent class
• The code below informs an agent whose nickname is
Peter that “Today it’s raining”
Surafel Lemma Abebe (Ph. D.) 38
JADE…
• Agent communication…
– Receive message
• The JADE runtime automatically posts messages in the
receiver’s private message queue as soon as they arrive
• An agent can pick up messages from its message queue
by means of the receive() method
– Returns
» First message in the message queue (removing it)
» null if the message queue is empty
Surafel Lemma Abebe (Ph. D.) 39
JADE…
• Agent communication…
– Blocking receive
• receive() in previous slide executes even if there is no
message in the queue
– Not a good programming style. Why?
• Solution 1
– Use the block() method
» Marks the behavior as “blocked” so that the agent doesn’t
schedule it for execution anymore
» When a new message is inserted in the agent’s message
queue, all blocked behaviors become available for execution
Surafel Lemma Abebe (Ph. D.) 40
JADE…
• Agent communication…
– Blocking receive…
• Solution 2
– Use the blockingReceive() method instead of receive()
– Does not return until there is a message in the agent’s
message queue
Surafel Lemma Abebe (Ph. D.) 41
JADE…
• Agent communication…
– Selecting messages with given characteristics from message
queue
• receive() method returns the first message in the message queue and
removes it
• Problem
– How can one be sure that the first message picked is the message intended
for that behaviour?
• Solution
– Read only certain messages by specifying proper “templates”
– Use jade.lang.acl.MessageTemplate parameter in the receive() method
» receive() method returns the first message (if any) matching it, while
ignores all non-matching messages
Surafel Lemma Abebe (Ph. D.) 42
JADE…
• Agent communication…
– Yellow pages
• How do you look for someone providing a service?
– Either you know a service provider...
– ...or you use yellow pages
• How does an agent look for a service?
– Either it knows another agent that provides that service...
– ...or it uses yellow pages
• How do you let other people know you want to offer a
service?
– Contact the yellow pages owner and ask for publishing an
advert
Surafel Lemma Abebe (Ph. D.) 43
JADE…
• Agent communication…
– Yellow pages…
• How do you let others know the services you provide?
– Contact the yellow page owner and register the services...
– ...so that others can find your services
• JADE
– Yellow pages system implemented via a particular agent called Directory
Facilitator (DF)
» Each FIPA compliant platform hosts a default DF agent whose local name is
“df”
Surafel Lemma Abebe (Ph. D.) 44
JADE…
• Agent communication…
– Directory facilitator (DF)
• Interaction with the DF is done using ACL messages
• Ontology and language that the DF “understands” are
specified using FIPA specification
• JADE provides jade.domain.DFService class to support the
interaction
– Publish and search services
– Provides static utility methods that facilitate the interactions with
the DF
» register()
» modify()
» deregister()
» search()
Surafel Lemma Abebe (Ph. D.) 45
JADE…
• Agent communication…
– Directory facilitator (DF) – publishing services
• Information required about the agent (for registration)
– AID, and possibly list of languages and ontologies that the other
agents need to know to interact with it and list of service
descriptions
jade.domain.FIPAAgentManagement.DFAgentDescription
– Service information provided using class ServiceDescription
» Service type, service name, language and ontologies
required to exploit the service and service specific properties
• When an agent terminates it is a good practice to de-register
published services
Surafel Lemma Abebe (Ph. D.) 46
JADE…
• Agent communication…
– Directory facilitator (DF) – publishing services…
Surafel Lemma Abebe (Ph. D.) 47
JADE…
• Agent communication…
– Directory facilitator (DF) – searching services
• An agent wishing to search for services must provide the DF
with a template description
• Result of the search is the list of all the descriptions that
match the provided template
– A description matches the template if all the fields specified in
the template are present in the description with the same values
Surafel Lemma Abebe (Ph. D.) 48