Agent Communications: Remote Procedure Calls (RPC)

Summary

This document describes agent communication, focusing on Remote Procedure Calls (RPC) and the structure of messages. It details how agents use message queues and asynchronous message passing, as well as the fields within a message such as sender, receiver, content, and ontology. The document also mentions the use of the ACLMessage class in JADE for creating and handling messages.

Full Transcript

Agent Communications Remote Procedure Calls - RPC Each agent has their own mailbox where messages sent by other agents are posted. Whenever a message is posted in the message queue the receiving agent is notified. If the agent wants to pick the message and when is up to the programmer. Messages...

Agent Communications Remote Procedure Calls - RPC Each agent has their own mailbox where messages sent by other agents are posted. Whenever a message is posted in the message queue the receiving agent is notified. If the agent wants to pick the message and when is up to the programmer. Messages have a format specified by FIPA’s Agent Communication Language – ACL. All communication is message-based. Agents also construct and decode messages internally. The communication is asynchronous message passing. Message Fields:  Sender  Receiver  Performative  Content  Content language – the syntax used to express the content  Ontology – the vocabulary of the symbols  Reply- with  In-reply-to  Reply-by Performative indicates what is the sender's purpose to achieve by sending the message. The performative can be: request, inform, query_if, propose etc. The message in JADE provides get and set methods for handling all fields of a message. How to construct a message? 1. Create a message object (ACLMessage) 2. Set performative 3. Set sender and recipients 4. Set message attributes 5. Fill content An agent can pick up messages by means of the receive() method. This method returns: 1. The first message in the message queue, and after that it removes it. 2. Null if the message queue is empty. The createReply() method of the ACLMessage class automatically creates a new ACLMessage properly setting the receivers and all the fields used to control the conversation. When we add the above behavior, the agent’s thread starts a continuous loop. To avoid that we would like to execute the action() method only when a new message is received. We can use the block() method of the Behavior class A conversation is a sequence of messages exchanged by two or more agents. The RequestPerformer behavior represents an example of a behavior carrying out a “complex” conversation.