Skip to content

Connection

A Connection is attached to a MailBox within the AEA framework.

The connection.py module in the connections directory contains two classes. A Connection object has a reference to a Channel.

  • Channel: a wrapper for an SDK or API.
  • Connection: a proxy to the functionality of an SDK or API.

Configuration

The connection.yaml file in the agent directory contains protocol details and connection url and port details. For example, the oef connection.yaml contains the connection class name, supported protocols, and any connection configuration details.

name: oef
authors: Fetch.ai Limited
version: 0.1.0
license: Apache 2.0
url: ""
class_name: OEFConnection
supported_protocols: ["oef"]
config:
  addr: 127.0.0.1
  port: 10000

The developer is left to implement the methods of both Connection and Channel classes dependent on the protocol type.

Channel

send(self, envelope: Envelope)

connect(self) -> Optional[Queue]

disconnect(self)

Connection

is_established(self)

connect(self)

disconnect(self)

send(self, envelope: Envelope)

from_config(cls, public_key: str, connection_configuration: ConnectionConfig)

Launching oef connections

oef - local node

Download the scripts directory:

svn export https://github.com/fetchai/agents-aea.git/trunk/scripts

Then, start an oef from a separate terminal:

python scripts/oef/launch.py -c ./scripts/oef/launch_config.json

This pulls and runs an oef docker image.

Now you can run an AEA with an oef connection.

oef - remote node

Connect directly to a running oef via a given URL:PORT. Update the configuration of the oef connection in the connection.yaml file.