Agent Communication Architecture

This section of the Communicator User's Guide will describe the processes and mechanisms involved in implementing communication between RETSINA-based Software Agents. However, it should be noted, that the Communicator library can be used by any processes desiring to interoperate over a TCP/IP network. This is whether or not the Agents are based on the RETSINA architecture, or even if they are Agents at all, and possibly just networked applications.

Agent Communication Architecture

back to the top

Finding another Agent on the Network

Prerequisites for Finding another Agent
Everything should be ready once an Agent has created (and therefore initialized) an instance of the Communicator object. This process ensures that the processes, queues, and other data structures required to interact with other Agents are in place. This step also establishes a working connection with an Agent Name Server, which will be used to locate the target Agent on the network.

Request that a Connection be established to the remote Agent
The Agent makes a call to the Communicator's "openConnection" method and passes it the name of an remote Agent to which it desires to communicate. For example:

call comm.openConnection("some-agent-name");
This function will return a "ConnectionDescriptor" to the calling Agent if it is successful, or the value of null if there was a failure to create the Connection for any reason. The ConnectionDescriptor data object can then be used:

Steps followed in opening a Connection
A client Agent can request a Shared Connection be created to a server Agent, or it can request an Exclusive Connection. These different types will be discussed in more detail later, but basically, shared connections will be faster and more efficient in their use of system resources, because multiple connections between a client and a server will share the same connection. The overhead of setting up and tearing down individual network links between the two systems will only occur once. Exclusive Connections demand that a separate and private link be established between the client and the server. New network links (and associated delays) are required for each connection.

The client's calls to openConnection() (or openExclusiveConnection) to creates a Connection object will maintain the communications path to a server Agent. This process will follow this progression of events:

  1. Look Up the target Server Agent's Name
    a request is sent to the Agent Name Server (ANS), found earlier, in order to find the hostname and active listening port of the remote Agent. The process will return the remote Agent's information if successful, or cause the openConnection method to return a null value instead of a valid ConnectionDescriptor when it fails.
  2. Open a socket on the local machine and connect
    using this local communications port, an attempt is made to contact the hostname and listener socket of the server Agent. After they negotiate the connection, both sides know the address and socket number of each other, for use in any subsequent information transfers.
  3. Creation of PrintWriters and BufferedReaders
    these constructs are initiated to facilitate message transfers, and to better handle the details of the socket communications.
  4. Build a unique Connection Identifier
    this text string helps the Communicators at each end of an Agent interaction specifically identify the source of a message.
  5. Add to ConnectionTable
    this new, and functioning, Connection is added to the appropriate tables, maintained by the Communicator, that keep track of all active Connections that the local Agent has in operation.
  6. Start Thread to Handle Incoming Connection Activity
    now that everything is in place, this thread will monitor the socket for any incoming traffic, parse it, convert the message format from an external network format, to the Agent's preferred internal message format, and then place the message into the inputMsgQueue described earlier. (Another thread, the Communicator's RouteInputMsgs thread, will watch for new messages arriving in the inputMsgQueue; and then send them to their proper internal destination queue or to a task that was placed "on-hold" awaiting an incoming message or reply.)
  7. Create a ConnectionDescriptor Object
    the ConnectionDescriptor object is the local Agent's interface to the Connection and therefore the remote Agent. All interactions with the remote Agent will be made by manipulations with this object, its data, and its methods. The ConnectionDescriptor points to the Connection, and the Connection points to its ConnectionDescriptor.
  8. Return ConnectionDescriptor or null
    finally, the ConnectionDescriptor is returned to the Agent that requested a connection be created. If there were any failures in any of the steps leading up to this point, the openConnection function will return a value of null to indicate that a valid connection could not be established.

Basic of working with the ConnectionDescriptor
The most common operations that an Agent will perform with a ConnectionDescriptor involve I/O with the remote Agent. The following UML format descriptions show the function name and the parameters sent to the method. Each item (parameter and function call) are followed by a colon and an indicator of the parameter type, or the return value of the method. The leading plus sign (+) indicates that the method is public rather than private (-) or protected (#).
UMLDescription

ConnectionDescriptor.getServerName()
ConnectionDescriptor.getClientName()
ConnectionDescriptor.getLocalport()
ConnectionDescriptor.ConnectionName()
ConnectionDescriptor.isConnectionAliveAndWell()


Communicator.getAgentName()
Communicator.getAgentHost()
Communicator.getAgentPort()
Communicator.lookupConnection()
Communicator.getInternalMsgInstance()
Communicator.getExternalMsgInstance()

back to the top

Connections Between Agents

review of ConnectionDescriptor
Types of Connections
 Shared
 Exclusive
opening and closing Connections
status of Connection
unique connection identifier
connection status
other connection methods and attributes

back to the top

Overview of Messaging

simple messaging
synchronous messaging
asynchronous messaging
Communicator's role in messaging

back to the top

Description of Basic Message Formatting Concepts

components of message that Agent programmer will be working with
basic fields
set and get methods
performative 
"basicRequiredFields"
"basicOptionalFields"
AgentMsg Interface
InternalMsg Interface
ExternalMsg Interface
your message derived Object
InputMsgObject class
ReplyWithObject class

back to the top

Description of Current Message Standards

standards overview
standards organizations
active research facilities/groups
directions

KQML

FIPA

CMU-KQML

others

back to the top

Description of Message Translation Tasks

review of Internal and External formats
diverse Agent interactions
InternalMsg Interface convertToExternal() method
ExternalMsg Interface convertToInternal() method
locations where expected
locations where provided automatically

back to the top

Overview of Message Translation Flow

1.Agent, Building Message 
2.Internal Message Manipulation 
3.Communicator gets message 
4.Translate Internal to External Format 
5.Communicator sends message 
6.(ANS-links-to-target?) 
7.Network transfer 
8.Communicator recieves message 
9.Translate External to Internal Format 
10.Internal Message enqueued 
11.Agent accepts and processes message contents 

back to the top

Operations of Communicator CMU-KQML Messages

basic formatting
difference from straight KQML
types of functions described below

back to the top

Description of Basic Functions for Creating and Manipulating Messages

building new
building reply from incoming message
setting fields
getting field values
resetting message contents
checking for valid format

back to the top

Description of Functions for Working With Message Content Information

CONTENT field
setting
getting
toString
comparing values
ONTOLOGY
LANGUAGE

back to the top

Description of Functions for Working With Message Source and Destination Info

sender
receiver
reply with
in reply to

back to the top

Description of Functions for Working With Message Action and Purpose Info

PEFORMATIVE and other related values

back to the top

Description of Functions for Message Format Translation

Review of Internal vs External
Converting between
Review of Format Standards
Inter Agent translation
Intra Agent translation (agent app mapped to communicator expectations)

back to the top

Brief Examples of Working With Messages

code segment showing message manipulation
brief descrip and pointer/links to example programs

back to the top

Sending and Receiving Communicator Messages

blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah

back to the top



Previously edited content for cut/paste




 
(In the following sections, briefly describe the types of functions available by logical grouping and make links to the more detailed information in the reference section.)
 

5.3        Finding information about the current environment

 
Communicator.getAgentName()
Communicator.getAgentHost()
Communicator.getAgentPort()
Communicator.lookupConnection()
Communicator.getInternalMsgInstance()
Communicator.getExternalMsgInstance()
ConnectionDescriptor.getServerName()
ConnectionDescriptor.getClientName()
ConnectionDescriptor.getLocalport()
ConnectionDescriptor.ConnectionName()
ConnectionDescriptor.isConnectionAliveAndWell()
AgentMsg.getRequiredFields():String[]
AgentMsg.getOptionalFields():String[]
AgentMsg.getInternalFields():String[]
AgentMsg.getFilteredFields():String[]
AgentMsg.getPerformative():String[]
AgentMsg.getField(fieldName:String):String
AgentMsg.existsField(fieldName:String):boolean
AgentMsg.existsNonNullField(fieldName:String):boolean
AgentMsg.existsNonEmptyField(fieldName:String):boolean
AgentMsg.getFieldNames():Enumeration
AgentMsg.isValidMsg():boolean

5.4        Manipulating the current environment

5.5        Asynchronous I/O

queueMsg()
getInputMsg()
showInputMsg()
getNextInputMsg()
showNextInputMsg()

5.6        Synchronous I/O

sendMsg()
sendMsgAndGetReply()
waitOnGetInputMsg()
waitOnShowInputMsg()
waitOnGetNextInputMsg()
waitOnShowNextInputMsg()

5.7        I/O Queue functions

queueMsg()
routeInputMsgs()

5.8        Connection maintenance and management

openConnection()
openExclsiveConnection()
closeConnection()
lookupCOnnection()
refuseNewConnections()
flushMsgsAndStop()
unRegisterWithANS()