The AEA framework enables us to create agents either from the CLI tool or programmatically.

The following demo demonstrates an interaction between two AEAs.

The provider of weather data (managed with the CLI). The buyer of weather data (managed programmatically).

Preparation instructions


Follow the Preliminaries and Installation sections from the AEA quick start.


The scope of the specific demo is to demonstrate how a CLI based AEA can interact with a programmatically managed AEA. In order to achieve this we are going to use the weather station skills. This demo does not utilize a smart contract or a ledger interaction.

Launch an OEF node

In a separate terminal, launch a local OEF node (for search and discovery).

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

Keep it running for the entire demo.

Demo instructions

If you want to create the weather station AEA step by step you can follow this guide here

Create the weather station AEA

Fetch the weather station AEA with the following command :

aea fetch fetchai/weather_station:0.1.0

Update the AEA configs

In the terminal change the configuration:

aea config set vendor.fetchai.skills.weather_station.models.strategy.args.is_ledger_tx False --type bool
The is_ledger_tx will prevent the AEA to communicate with a ledger.

Run the weather station AEA

aea run --connections fetchai/oef:0.1.0

Create the weather client AEA

Since we want to show the interaction between a programmatically created AEA with a CLI based AEA we are going to write some code for the client.

Create a new python file and name it and add the following code

Weather client full code.
import logging
import os
import time
from threading import Thread
from typing import cast

from aea import AEA_DIR
from aea.aea import AEA
from aea.crypto.fetchai import FETCHAI
from aea.crypto.helpers import FETCHAI_PRIVATE_KEY_FILE, _create_fetchai_private_key
from aea.crypto.ledger_apis import LedgerApis
from aea.crypto.wallet import Wallet
from aea.identity.base import Identity
from aea.protocols.base import Protocol
from aea.registries.base import Resources
from aea.skills.base import Skill

from packages.fetchai.connections.oef.connection import OEFConnection
from packages.fetchai.skills.weather_client.strategy import Strategy

HOST = ""
PORT = 10000
ROOT_DIR = os.getcwd()

# Not sure what level of logging to specify to get the logging to be displayed?
logger = logging.getLogger("aea")

def run():
    # Create a private key

    # Set up the wallet, identity, oef connection, ledger and (empty) resources
    identity = Identity("my_aea", address=wallet.addresses.get(FETCHAI))
    oef_connection = OEFConnection(
        address=identity.address, oef_addr=HOST, oef_port=PORT
    ledger_apis = LedgerApis({}, FETCHAI)
    resources = Resources()

    # create the AEA
    my_aea = AEA(
        identity, [oef_connection], wallet, ledger_apis, resources,  # stub_connection,

    # Add the default protocol (which is part of the AEA distribution)
    default_protocol = Protocol.from_dir(os.path.join(AEA_DIR, "protocols", "default"))

    # Add the oef protocol (which is a package)
    oef_protocol = Protocol.from_dir(
        os.path.join(os.getcwd(), "packages", "fetchai", "protocols", "oef",)

    # Add the fipa protocol (which is a package)
    fipa_protocol = Protocol.from_dir(
        os.path.join(os.getcwd(), "packages", "fetchai", "protocols", "fipa",)

    # Add the error and weather_station skills
    error_skill = Skill.from_dir(
        os.path.join(AEA_DIR, "skills", "error"), my_aea.context
    weather_skill = Skill.from_dir(
        os.path.join(ROOT_DIR, "packages", "fetchai", "skills", "weather_client"),

    strategy = cast(Strategy, weather_skill.models.get("strategy"))
    strategy.is_ledger_tx = False
    strategy.max_buyer_tx_fee = 100
    strategy.max_row_price = 40

    for skill in [error_skill, weather_skill]:

    # Set the AEA running in a different thread
    try:"STARTING AEA NOW!")
        t = Thread(target=my_aea.start)

        # Let it run long enough to interact with the weather station
        # Shut down the AEA"STOPPING AEA NOW!")

if __name__ == "__main__":

For more details on how to create an agent programmatically follow this guide here

Run the weather station AEA

In a new terminal window, navigate to the folder that you created the script and run:


You should see both AEAs interacting now.