190 likes | 381 Views
Bee-gent Communication. ANTS Meeting, 9/30/99. Overview. What communication “services” does Bee-gent provide? Transport, session, presentation, application services for multi-agent systems How does it do it? “ ACL/XML”, security, directory services, etc. Implementation. What is Provided?.
E N D
Bee-gent Communication ANTS Meeting, 9/30/99
Overview • What communication “services” does Bee-gent provide? • Transport, session, presentation, application services for multi-agent systems • How does it do it? • “ACL/XML”, security, directory services, etc. • Implementation
What is Provided? • Transport – message assembly, ordering • Session – “conversations” • Presentation – format for message exchange • Application – directory services, security, agent migration (this “Agent Systems Interconnect” model lives on top of OSI… mostly)
How are services implemented? • Security: [Weak?] encryption, 64 bit ciphers • Directory “services” • Agents register with one another • Maintained in file, automatically updated • “Setting and consistency management of names are left to designers' responsibility” (Bee-gent tutorial) • Integration with LDAP (?) • ACL + XML = “ACL/XML” • ACL specifies content • XML specifies format
Bee-gents ACL • Pre-defined and user-defined performatives • Types of messages • Designers define meaning of each message type • Expected message content • An ACL message specifies: - Performative - Sender and Reviever - Content (performative-specific) - Protocol - Reply-with - Ontology
Example ACL message… Performative: “Request” Sender: “Mediation Agent” Reciever: “Agent Wrapper” Content: “Agent wrapper should perform action one with null parameters” Protocol: “Request-inform” Reply-with: “Conversation identification 1” Ontology: “Default”
…and XML format <!DOCTYPE request SYSTEM "request.dtd"> <request> <sender>Mediation Agent</sender> <receiver>Agent Wrapper</receiver> <content> <action>act1</action> <actor>Agent Wrapper</actor> <args>null</args> </content> <protocol>Request-inform</protocol> <reply-with>MSG-ID:1</reply-with> <ontology>default</ontology> </request>
Implementation • First, need brief overview of Bee-gents • 2 types: Agent Wrappers and Mediation Agents • Agent Wrappers encapsulate “legacy” functionality, host “bees” • Mediation Agents (bees) - mobile • Communication is permitted to/from both types (but need forwarding…) • State-based programming model
Implementation - Example • Goal: 2 agents, Jack and Jill, that exchange “greetings” and “farewells” • Jill starts the conversation • Jack randomly responds or dies • Jill randomly responds • Steps • Define performatives • Define names and addresses of agents • Code state behavior of agents
Define Performatives • DTD file (specs) and XML file (defaults) • In .\xml directory below each agent class farewell.dtd <?xml encoding="US-ASCII"?> <!ELEMENT farewell (sender,receiver,content,protocol,in-reply-to,ontology)> <!ELEMENT sender (#PCDATA)> <!ELEMENT receiver (#PCDATA)> <!ELEMENT content (#PCDATA)> <!ELEMENT protocol (#PCDATA)> <!ELEMENT in-reply-to (#PCDATA)> <!ELEMENT ontology (#PCDATA)> farewell.xml <?xml version="1.0"?> <!DOCTYPE farewell SYSTEM "farewell.dtd"> <farewell> <sender>TBD</sender> <receiver>TBD</receiver> <content>TBD</content> <protocol>TBD</protocol> <in-reply-to>TBD</in-reply-to> <ontology>TBD</ontology> </farewell>
Define agent names and addresses • In .\conf\Name2Addresses.csv • For each agent JACK,http://localhost:9441/ JILL,http://localhost:9442/
Code it – JACK.java public class JACK extends AgentWrapper{ JACK(String s){ super(s); } public static void main(String[] argv) throws Exception{ JACK aw = new JACK("JACK"); aw.printLog(true); aw.fileLog(true); aw.setPassword("kawamura"); aw.addPublicIPStates(); aw.startIP(); } }
Code states • Agent employs all IP state classes in same directory • Communication taken care of by XmlAcl class
public class AwrIPStateS1 extends AwrIPState{ public AwrIPStateS1(){ super("INIT"); } public void action(){ XmlAcl xa = null; String perf = new String(); String sender = new String(); // Receive XML/ACL // Wait for someone to say hello while(waitXML(0)){ xa = getXML(); perf = xa.getTag2Value("performative"); sender = xa.getTag2Value("sender"); if(perf.equals("greeting")) break; if(perf.equals("farewell")) break; } // Send XML/ACL // Got a greeting or farewell // Randomly say either hello or goodbye or quit int rand = new Random(System.currentTimeMillis()).nextInt(); int dice = Math.abs(rand) % 3; switch(dice){ case 1: xa = new XmlAcl(); xa.setTag2Value("performative",“greeting"); xa.setTag2Value("sender", getMyname()); xa.setTag2Value("receiver“ , sender); xa.setTag2Value("content" , "farewell"); xa.setTag2Value("protocol", "nonsensetalk"); xa.setTag2Value("in-reply-to", "MSG1"); xa.setTag2Value("ontology", "default"); setPostcond("INIT"); break; default: setPostcond("END"); return; } if(!sendXML(xa)) Debug.printLog(getMyname(),"failed to send XML/ACL."); } }
What does Jill have to say? JILL AgentWrapper started. JILL Loaded State: AwrIPStateS1 JILL Loaded State: AwrIPStateS2 JILL Invoke : AwrIPStateS1 JILL Send by http : <!DOCTYPE request SYSTEM "request.dtd"><request> <sender>JILL</sender><receiver>http://localhost:9441</receiver><content><action> forward</action><actor>http://localhost:9441</actor><args><!DOCTYPE greeting SYSTEM "greeting.dtd"><greeting><sender>JILL</sender><receiver>JACK</receiver> <content>somecontent</content><protocol>nonsensetalk</protocol><in-reply-to>MSG1 </in-reply-to><ontology>default</ontology></greeting></args></content><protocol> forward(internal)</protocol><in-reply-to>none</in-reply-to><ontology>default </ontology></request> JILL Reply by http : <!DOCTYPE inform SYSTEM "inform.dtd"><inform><sender>JAC K</sender><receiver>http://localhost:9442/</receiver><content>Done forward</cont ent><protocol>forward(internal)</protocol><in-reply-to>none</in-reply-to><ontolo gy>default</ontology></inform> JILL Invoke : AwrIPStateS2 JILL Waiting message... • Why is JILL sending “request”, when she’s supposed to only know “greeting” or “farewell” performatives?
Message Forwarding • Apparently all messages are forwarded via the “request” performative • Actual message is contained in content field • Why? • Support for agent mobility? • Support for transport protocols? • Encryption?
Our message JILL AgentWrapper started. JILL Loaded State: AwrIPStateS1 JILL Loaded State: AwrIPStateS2 JILL Invoke : AwrIPStateS1 JILL Send by http : <!DOCTYPE request SYSTEM "request.dtd"><request> <sender>JILL</sender><receiver>http://localhost:9441</receiver><content><action> forward</action><actor>http://localhost:9441</actor><args><!DOCTYPE greeting SYSTEM "greeting.dtd"><greeting><sender>JILL</sender><receiver>JACK </receiver><content>somecontent</content><protocol>nonsensetalk </protocol><in-reply-to>MSG1</in-reply-to><ontology>default</ontology> </greeting></args></content><protocol>forward(internal)</protocol><in-reply-to> none</in-reply-to><ontology>default</ontology></request> JILL Reply by http : <!DOCTYPE inform SYSTEM "inform.dtd"><inform><sender> JACK</sender><receiver>http://localhost:9442/</receiver><content>Done forward </content><protocol>forward(internal)</protocol><in-reply-to>none</in-reply-to> <ontology>default</ontology></inform> JILL Invoke : AwrIPStateS2 JILL Waiting message... • JACK immediately responds using inform performative and says msg was forwarded
JACK does get the message • JACK then replies, again using the request performative so JILL can forward the message to herself. JACK AgentWrapper started. JACK Loaded State: AwrIPStateS1 JACK Invoke : AwrIPStateS1 JACK Waiting message... JACK Received : <!DOCTYPE greeting SYSTEM "greeting.dtd"><greeting> <sender>JILL</sender><receiver>JACK</receiver><content>somecontent </content><protocol>nonsensetalk</protocol><in-reply-to>MSG1 </in-reply-to><ontology>default</ontology></greeting> • Seems to work…
Conclusions • It’s a beta package • Documentation is sketchy (forwarding?) • But surprisingly error-free so far (using Sun JRE) • Need to learn more about: • Message forwarding • Agent mobility • Passing objects in tags • Applet for viewing agent messages