Protocols define the structure of agent-to-agent and component-to-component interactions, which in the AEA world, are in the form of communication. To learn more about interactions and interaction protocols, see here.
Protocols in the AEA world provide definitions for:
messagesdefining the structure and syntax of messages;
serializationdefining how a message is encoded/decoded for transport; and optionally
dialoguesdefining the structure of dialogues formed from exchanging series of messages.
The framework provides a
base protocol. This protocol provides a bare-bones implementation for an AEA protocol which includes a
DefaultMessage class and associated
Additional protocols - i.e. a new type of interaction - can be added as packages or generated with the protocol generator.
We highly recommend you to not attempt writing your protocol manually as they tend to have involved logic; always use existing packages or the protocol generator!
Components of a protocol
A protocol package contains the following files:
message.py, which defines message representation
serialization.py, which defines the encoding and decoding logic
- two protobuf related files
It optionally also contains
dialogues.py, which defines the structure of dialogues formed from the exchange of a series of messages
custom_types.py, which defines custom types
All protocols are for point to point interactions between two agents or agent-like services.
Message in an interaction protocol has a set of default fields:
dialogue_reference: Tuple[str, str], a reference of the dialogue the message is part of. The first part of the tuple is the reference assigned to by the agent who first initiates the dialogue (i.e. sends the first message). The second part of the tuple is the reference assigned to by the other agent. The default value is
message_id: int, the identifier of the message in a dialogue. The default value is
target: int, the id of the message this message is replying to. The default value is
performative: Enum, the purpose/intention of the message.
sender: Address, the address of the sender of this message.
to: Address, the address of the receiver of this message.
The default values for
target assume the message is the first message in a dialogue. Therefore, the
message_id is set to
1 indicating the first message in the dialogue and
0 since the first message is the only message that does not reply to any other.
By default, the values of
target are set. However, most interactions involve more than one message being sent as part of the interaction and potentially multiple simultaneous interactions utilising the same protocol. In those cases, the
dialogue_reference allows different interactions to be identified as such. The
target are used to keep track of messages and their replies. For instance, on receiving of a message with
target=0, the responding agent could respond with another with
target=1 replying to the first message. In particular,
target holds the id of the message being replied to. This can be the preceding message, or an older one.
Each message may optionally have any number of contents of varying types.
Protocols can optionally have a dialogue module. A dialogue, respectively dialogues object, maintains the state of a single, respectively, all dialogues associated with a protocol.
The developer can generate custom protocols with the protocol generator. This lets the developer specify the speech-acts as well as optionally the dialogue structure (e.g. roles of agents participating in a dialogue, the states a dialogue may end in, and the reply structure of the speech-acts in a dialogue).
We highly recommend you do not attempt to write your own protocol code; always use existing packages or the protocol generator!