FIPA platform - ICAR-CNR

Download Report

Transcript FIPA platform - ICAR-CNR

FIPA Agents and Platform
M. Cossentino
Abstraction level
Paradigm shift in programming
agent
object
procedural
assembler
time
How agent technology will progress over
time according to Agentlink II
Source:
Agentlink II
Roadmap
Past and future
Source:
Agentlink II
Roadmap
Past and future
Source:
Agentlink II
Roadmap
Agent-related concepts
• Platform
• Communication
• Ontology
• Not specifically agent concepts:
– services
– applications
Where can you find agents today
•
•
•
•
•
•
•
•
•
distributed artificial intelligence,
robotics,
artificial life (also in video game),
distributed object computing,
human-computer interaction,
intelligent and adaptive interfaces,
intelligent search and filtering,
information retrieval,
etc.
Different kind of agents
An example of categorization
• Autonomous agents
– Biological agents
– Computational agents
• Software agents
– Task specific agents
– Entertainment agents
– Viruses
• Artificial life agents
– Robotic agents
… others to come
Different kinds of agents
Another categorization:
•
•
•
•
•
•
•
Mobile agents
Interface agents
Collaborative agents
Information agents
Reactive agents
Hybrid agents
Heterogeneous agents
What is an agent
Perhaps the most general way in which the term agent is used is to denote a hardware
or (more usually) software-based computer system that enjoys the following
properties:
• autonomy: agents operate without the direct intervention of humans or others, and
have some kind of control over their actions and internal state;
• social ability: agents interact with other agents (and possibly humans) via some
kind of agent-communication language [Genesereth and Ketchpel, 1994];
• reactivity: agents perceive their environment, (which may be the physical world, a
user via a graphical user interface, a collection of other agents, the INTERNET, or
perhaps all of these combined), and respond in a timely fashion to changes that
occur in it;
• pro-activeness: agents do not simply act in response to their environment, they
are able to exhibit goal-directed behaviour by taking the initiative.
From Intelligent Agents: Theory and Practice of M. Wooldridge and N. Jennings
(http://www.csc.liv.ac.uk/~mjw/pubs/ker95/ker95-html.html)
BDI Agents
• ALL agents (except for purely reactive agents) maintain an internal
representation of their world.
– There is an explicit mental state
– Can be modified by some form of symbolic reasoning.
• An example: BDI agents (BDI = Belief, Desire, Intention)
– a set of beliefs about the world;
– a set of goals that the agent is currently trying to achieve (Desires)
– a library of plans describing how to achieve goals and how to react to
changes in beliefs
– an intention structure; describing how the agent is currently achieving its
goals and reacting to changes in beliefs.
What is FIPA
• FIPA (Foundation for Intelligent Physical Agents) is
a non-profit organization aimed at producing
standards for the interoperation of heterogeneous
software agents
www.fipa.org
Agent: FIPA definition
• An agent is a computational process that
implements the autonomous, communicating
functionality of an application. Typically, agents
communicate using an Agent Communication
Language.
FIPA Agents
• Agents communicate by exchanging messages
which represent speech acts, and which are
encoded in an agent-communication-language.
• Services provide support services for agents. In
addition to a number of standard services including
agent-directory-services and message-transportservices the FIPA Abstract Architecture defines a
general service model that includes a servicedirectory-service.
FIPA Agent: Relationships to Other Elements
•
Agent has an agent-name
•
Agent may have agent-attributes
•
Agent has an agent-locator, which lists the transport-descriptions for that agent
•
Agent may be sent messages via a transport-description, using the transport
corresponding to the transport-description
•
Agent may send a transport-message to one or more agents
•
Agent may register with one or more agent-directory-services
•
Agent may have an agent-directory-entry, which is registered with an agent-directoryservice
•
Agent may modify its agent-directory-entry as registered by an agent-directory-service
•
Agent may deregister its agent-directory-entry from an agent-directory-service.
•
Agent may search for an agent-directory-entry registered within an agent-directory-service
•
Agent is addressable by the mechanisms described in its transport-descriptions in its
agent-directory-entry
Concrete implementation of the FIPA Agent
• an agent may be realized in a variety of ways, for example
as a Java component, a COM object, a self-contained Lisp
program, or a TCL script.
• It may execute as a native process on some physical
computer under an operating system, or be supported by
an interpreter such as a Java Virtual Machine or a TCL
system.
• The relationship between the agent and its computational
context is specified by the agent lifecycle.
Agents
(FIPA) State-machine agent
Agents: a software engineering
point of view
• An agent is a subsystem
– High decoupling with other subsystems (agents)
– High coherence of internal classes (behaviors of the same agent)
– It offers services to other agents
• FIPA agents are communication oriented
– High Standardization in communications provide interoperability:
• Ontology
• Agent Interaction Protocols (and communicative acts)
• Content language
PASSI Agent
An agent may
occupy several
functional roles to
achieve its goals
In playing a role
the agent uses
one or more of its
tasks.
Each task is
composed of
several
elementary
behaviors
Agent
-Goal
-Decisions
-Actions
-Relationships
Role
<<usage>>
-Sub-goal
1
Task
Action
-Purpose
1
1..*
0..*
The instance of an
agent class
It is the software
implementation of an
autonomous entity
capable of pursuing an
objective through its
autonomous decisions,
actions and social
relationships.
The function
temporarily
assumed by the
agent in the
society while
pursuing a subgoal
A series of elementary
pieces of behavior
(actions) necessary for
a specific purpose. Each
task carries out one of
the agent’s decisions/
actions/ social
relationships
Elementary
behavior
Platform
Platforms
• What is a platform
– A place where agents live
• not always needed
• Platform responsibilities
– Agent management
• creation – termination
• security
– Agent communication services
– Agent directory services
Communications
(conversations)
Agents’ interactions (FIPA point of view)
•
Agents communicate by exchanging messages which represent
speech acts2, and which are encoded in an agentcommunication-language.
•
The simplest for of speech act (we can refer to it as a message)
is:
–
–
<i, act (j, C)>
Where:
•
•
•
•
•
i is the originator of the speech act (we can refer to it as a message),
act is the name of the act (it communicates the speaker’s intention to the hearer)
j is the target
C the semantic content
Examples of communicative acts1 (also called performatives)
–
1FIPA
Query, Inform, Request, Agree, Refuse
Communicative Act Library Specification. Foundation for Intelligent Physical Agents,
Document FIPA00037 (2000). http://www.fipa.org/specs/fipa00037/.
2Searle, J.R., Speech Acts. Cambridge University Press, 1969.
Messages and performatives
•
•
•
•
•
•
•
•
•
Is the door open?
Open the door (for me)
OK! I’ll open the door
The door is open
I am unable to open the door
I will not open the door
Say when the door becomes open
Anyone wants to open the door?
I can open the door for you..at a
price
• Door? What’s that? Don’t
understand...
•
•
•
•
•
•
•
•
•
query
request
agree
inform
failure
refuse
Subscribe
cfp
Propose
• Notunderstood
A layered model
One conversation can be composed of
several messages, each one addressing
one different performative (or
communicative act)
Conversations
• Conversations are composed by one or more
messages
• They are ruled by agent interaction protocols (AIP,
discussed later)
• Given a message (and its specific performative),
the AIP defines which is the set of performatives
that could be associated to the following messages
• If a message does not comply to this rule, the
agent could not understand it
Message elements
contains
Message
expressed in
1..n
Communicative
Act
has a
0..n contains
Performative
Content
Agent Communication Language
0..n contains
Ontology Name
FIPA-ACL
KQML
Components of a message
Parameter
Category of Parameters
performative
Type of communicative acts
sender
Participant in communication
receiver
Participant in communication
reply-to
Participant in communication
content
Content of message
language
Description of Content
encoding
Description of Content
ontology
Description of Content
protocol
Control of conversation
conversation-id
Control of conversation
reply-with
Control of conversation
in-reply-to
Control of conversation
reply-by
Control of conversation
A layered model
Content and Content language
• The content denotes the content of the message;
equivalently denotes the object of the action.
• The content language denotes the language in
which the content is expressed.
• FIPA content languages:
– SL, CCL, KIF, RDF
A layered model
Agent communication Language
Message
Expressed in an
Agent-communication-language
Unique names,
regardless of transport
• The structure of a
message is a key-valuetuple and is written in an
Message content
agent-communicationlanguage, such as FIPA
Expressed in a content language
ACL.
May reference an ontology
• The content of the
message is expressed in
a content-language,
such as KIF, SL or RDF.
• The content-language may reference an ontology,
which grounds the concepts being discussed in the
content.
Sender: Agent-name
Receiver: Agent-name
ACL message example
ACL message
Begin message structure
Communicative act type
Message parameter
(inform
:sender agent1
:receiver hpl-auction-server
:content
(price (bid good02) 150)
:in-reply-to round-4
:reply-with bid04
:language sl
:ontology hpl-auction
)
Message content expression
Parameter expression
A layered model
Transport Message
• When a message is sent it is transformed into a payload, and included in a
transport-message.
• The payload is encoded using the encoding-representation appropriate for the
transport.
Transport-message
Payload
Message
Message-encoding
Sender: agent name
Receiver: agent name
Message
Addressing and
more attributes
Sender: agent name
Receiver: agent name
Envelope
Sender:
transport-description
Receiver: transport-description
Additional attributes:
X
Y
Payload
Message
Message content
Message content
Message content
A layered model
Message Transport Protocol
• Each agent has an agent-name. This agent-name is
unique and unchangeable.
• Each agent has one or more transport-descriptions,
which are used by other agents to send a transportmessage.
• Each transport-description correlates to a particular
form of message transport, such as IIOP, SMTP, or
HTTP.
• A transport-message is a message expressed in a
format (or encoding) that is appropriate to the transport
being used.
• A set of transport-descriptions can be held in a locator.
Example of transport description
Directory entry for agent “ABC”
Agent-name: ABC
Locator :
Transporttype
Transport-specific-address
Transport-specificproperty
HTTP
http://www.whiz.net/abc
(none)
SMTP
[email protected]
(none)
A layered model
Out of our
scope
Ontology
Ontology
• Concepts
(categories,
entities of the
domain)
• Predicates
(assertions on
properties of
concepts)
• Actions
Searched_book
(that agents can
perform in the
domain).
Book_in_stock
Agents Interaction Protocols
(AIP)
Message Content Languages
A proposition in RDF
Proposition:
"The statement 'W. Richard Stevens is the author of TCP/IP Illustrated' is true".
author
TCP/IP Illustrated
W. Richard Stevens
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:fipa=http://www.fipa.org/schemas/fipa-rdf0#">
<fipa:Proposition>
<rdf:subject>TCP/IP Illustrated</rdf:subject>
<rdf:predicate
rdf:resource="http://description.org/schema#author"/>
<rdf:object>W. Richard Stevens</rdf:object/>
<fipa:belief>true</fipa:belief>
</fipa:Proposition>
</rdf:RDF>
A communication (ACL+RDF+Request AIP)
Scenario:
Mary requests John to open door 1 and door 2 and then wants John to inform her if he performed the action and
what the result is.
Message 1: Request from Mary to John containing the description of the action,
Message 2: Inform from John to Mary, referring to the action and stating the completion of the action.
(request
:sender Mary
:receiver John
:content (
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#“
xmlns:fipa="http://www.fipa.org/schemas#">
<fipa:Action rdf:ID="JohnAction1">
<fipa:actor>John</rdf:actor>
<fipa:act>open</rdf:act>
<fipa:argument>
<rdf:bag>
<rdf:li>door1</rdf:li>
<rdf:li>door2</rdf:li>
</rdf:bag>
</fipa:argument>
</fipa:Action>
</rdf:RDF>)
:language fipa-rdf0)
A communication (ACL+RDF+Request AIP)
(inform
:sender John
:receiver Mary
:content (
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntaxns#"
xmlns:fipa="http://www.fipa.org/schemas#">
<rdf:Description about="#JohnAction1">
<fipa:done>true</fipa:done>
<fipa:result>doors closed</fipa:result>
</rdf:Description>
</rdf:RDF> )
:language fipa-rdf0)
The FIPA Platform
The FIPA platform
• Agent Management System (AMS)
– The AMS provides white-page and life-cycle service, maintaining a directory of agent
identifiers (AID) and agent state.
– Each agent must register with an AMS in order to get a valid AID.
• Directory Facilitator (DF)
– the agent who provides the default yellow page service in the platform.
• Message Transport System (MTS)
– the software component controlling all the exchange of messages within the platform,
including messages to/from remote platforms.
– also called Agent Communication Channel (ACC)
Agents interactions
 Agent Communication Channel : All agents have
access to at least one ACC. The ACC is the default
communication method that connects all agents within an
AP and between AP’s.
Software
Agent
Agent Platform
Agent
Management
System
Directory
Facilitator
Internal Platform Message Transport
ACC
ACC
Other topics
• Agents
• Services
• Directory services
– Starting/ finding an agent
• See FIPA-presentation.doc
The FIPA platform implementation
The operating shell
Jade Behaviors
An Example
• Sender agent
• Receiver agent
AgentSender
AgentSender.SendBehavior
AgentReceiver
my3StepBehaviour
AgentReceiver.
setup
AgentSender.
setup
addBehaviour
addBehaviour
my3StepBehaviour.
action
SendBehaviour.
action
(Performative,
ontology, content
language, content)
send( msg (Inform, "", "", FirstInform )
op1
This is not common in
PASSI
send( msg(Inform, "", PlainText,
SecondInform) )
op2
send( msg(Inform, "", PlainText,
ThirdInform) )
send( msg(Inform, ReceiveTest, PlainText, ThirdInform) )
op3
AgentSender.
done
my3StepBehaviour.
done
PASSI syntax:
(AIP, Performative,
Ontology)
Agent Sender
public class AgentSender extends Agent {
class SendBehaviour extends SimpleBehaviour {
private boolean finished = false;
public SendBehaviour (Agent a) {
super(a);}
public void action() {
try{
System.out.println("\nEnter responder
agent name (e.g. da0@myhost:1099/JADE): ");
BufferedReader buff = new BufferedReader
(new InputStreamReader(System.in));
String responder = buff.readLine();
AID r = new AID();
r.setName(responder);
ACLMessage msg = new
ACLMessage(ACLMessage.INFORM);
msg.setSender(getAID());
msg.addReceiver(r);
msg.setContent("FirstInform");
send(msg);
System.out.println("\nFirst INFORM sent");
doWait(5000);
msg.setLanguage("PlainText");
msg.setContent("SecondInform");
send(msg);
System.out.println("\nSecond INFORM sent");
doWait(5000);
// same that second
msg.setContent("\nThirdInform");
send(msg);
System.out.println("\nThird INFORM sent");
doWait(1000);
msg.setOntology("ReceiveTest");
msg.setContent("FourthInform");
send(msg);
System.out.println("\nFourth INFORM sent");
finished = true;
myAgent.doDelete();
}catch (IOException ioe){ioe.printStackTrace();}
}
public boolean done(){
return finished;}
}
protected void setup() {
SendBehaviour mysendbehaviour = new
SendBehaviour(this);
addBehaviour(mysendbehaviour);
}
}
Agent Receiver 1/2
public class AgentReceiver extends Agent {
class my3StepBehaviour extends SimpleBehaviour {
final int FIRST = 1;
final int SECOND = 2;
final int THIRD = 3;
private int state = FIRST;
private boolean finished = false;
public my3StepBehaviour (Agent a) {
super(a);
}
public void action() {
switch (state){
case FIRST: {if (op1()) state = SECOND;
else state= FIRST; break;}
case SECOND:{op2(); state = THIRD; break;}
case THIRD:{op3(); state = FIRST; finished = true;
break;}
}
}
public boolean done() {
return finished;
}
public int onEnd() {
reset();
myAgent.addBehaviour(this);
return 0;
}
public void reset() {
super.reset();
finished = false;
state = FIRST;
}
private boolean op1(){
MessageTemplate m1 =
MessageTemplate.MatchPerformative(ACLMessage.INFORM);
MessageTemplate m2 =
MessageTemplate.MatchLanguage("PlainText");
MessageTemplate m3 =
MessageTemplate.MatchOntology("ReceiveTest");
MessageTemplate m1andm2 =
MessageTemplate.and(m1,m2);
MessageTemplate notm3 = MessageTemplate.not(m3);
MessageTemplate m1andm2_and_notm3 =
MessageTemplate.and(m1andm2, notm3);
System.out.println( "\nAgent "+getLocalName()+" in state
FIRST.op1 is waiting for a message matching the
template ");
//The agent waits for a specific message. If it doesn't
arrive the behaviour is suspended until a new message
arrives.
ACLMessage msg = receive(m1andm2_and_notm3);
if (msg!= null){
System.out.println("\nAgent "+ getLocalName() + "
received the following message in state
FIRST.op1: ");
System.out.println(msg.toString());
return true;
}
else
{
System.out.println("\nNo message matching the
template received in state FIRST.op1. Blocking
the behaviour");
block();
return false;
}
} // End of op1
Agent Receiver 2/2
private void op2(){
System.out.println("\nAgent "+ getLocalName() + " in state
SECOND.op2 is waiting for any message in next 5000
msec");
//Using a blocking receive causes the block of all the
//behaviours
ACLMessage msg = blockingReceive(5000);
if(msg != null) {
System.out.println("\nAgent "+ getLocalName() + "
received the following message in state
SECOND.op2: ");
System.out.println(msg.toString());
}
else{
System.out.println("\nNo message
received in
state SECOND.op2");
}
} // End of op2
private void op3(){
MessageTemplate m1 =
MessageTemplate.MatchPerformative(ACLMessage.INFORM);
MessageTemplate m2 =
MessageTemplate.MatchLanguage("PlainText");
MessageTemplate m3 =
MessageTemplate.MatchOntology("ReceiveTest");
MessageTemplate m1andm2 =
MessageTemplate.and(m1,m2);
MessageTemplate m1andm2_and_m3 =
MessageTemplate.and(m1andm2, m3);
System.out.println("\nAgent: "+getLocalName()+" in state
THIRD.op3 is blocked waiting for a message matching the
template");
//blockingReceive and template
ACLMessage msg =
blockingReceive(m1andm2_and_m3);
if (msg!= null)
System.out.println("\nAgent "+ getLocalName() +
"
received the following message in state THIRD.op3:
"+msg.toString());
else
System.out.println("\nNo message received in state
THIRD.op3");
} // End of op3
} // End of my3StepBehaviour class (the agent behaviour)
protected void setup() {
my3StepBehaviour mybehaviour = new
my3StepBehaviour(this);
addBehaviour(mybehaviour);
}
} // End of agent
MAS References
•
•
•
•
Agentlink Roadmap: www.agentlink.org
Intelligent Agents: Theory and Practice. M. Wooldridge,
N. Jennings (http://www.csc.liv.ac.uk/~mjw/pubs/ker95/
ker95-html.html)
Objects and Agents Compared. J. Odell.
(http://www.jot.fm/issues/issue_2002_05/column4)
Searle, J.R., Speech Acts. Cambridge University Press,
1969.
Ontology References
• What are ontologies and why do we need them.
B. Chandrasekaran et al.
(http://portal.acm.org/citation.cfm?id=630436&dl=ACM&coll=portal)
• Ontologies from AI Topics library of AAAI.
http://www.aaai.org/AITopics/html/ontol.html
• Ontology Development 101: A Guide to Creating Your First
Ontology. Natalya F. Noy and Deborah L. McGuinness.
(http://www.ksl.stanford.edu/people/dlm/papers/ontology101/ontology
101-noy-mcguinness.html)
• Designing Ontology with RDF in PASSI. M. Cossentino
• Modeling XML Vocabularies with UML. D. Carlson.
(http://www.xml.com/pub/a/2001/08/22/uml.html)
• RDF (Resource Description Framework). W3C Consortium.
(http://www.w3.org/RDF/)
FIPA References
•
FIPA website: www.fipa.org
•
FIPA Abstract Architecture
(http://www.fipa.org/repository/architecturespecs.html)
•
Agent Interaction Protocols
(http://www.fipa.org/repository/ips.php3)
•
Communication Content Languages
(http://www.fipa.org/repository/cls.php3)
•
(Design) Methodology Technical Committee:
(http://www.fipa.org/activities/methodology.html)
•
Communicative Act Library Specification:
(http://www.fipa.org/specs/fipa00037/)
JADE References
• JADE (Java Agent DEvelopment Framework)
(http://sharon.cselt.it/projects/jade/)
• Jade Tutorial:
http://www.iro.umontreal.ca/~vaucher/Agents/Jade/
JadePrimer.html
• AgentFactory: http:// mozart.csai.unipa.it/af