Skip to content

Instantly share code, notes, and snippets.

@arcolife
Last active August 16, 2022 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arcolife/68beef5fdeebd9e5c5bb57935f148843 to your computer and use it in GitHub Desktop.
Save arcolife/68beef5fdeebd9e5c5bb57935f148843 to your computer and use it in GitHub Desktop.
AEA structure discussions on discord

Packaging structure

Let's make a clean starter directory:

# mkdir test
# cd test

Agents

Fetch one remotely:

# aea fetch open_aea/my_first_aea:0.1.0:bafybeibnjfr3sdg57ggyxbcfkh42yqkj6a3gftp55l26aaw2z2jvvc3tny --remote

Adding protocol 'fetchai/state_update:1.0.0:bafybeihaknve6slfpsml5bz62xqwxcpv3u7bqaskuataehsrgygoeiucqe'...
...
Successfully added skill 'fetchai/echo:0.19.0'.
Agent my_first_aea successfully fetched.

# tree -d
.
└── my_first_aea
    ├── aea-config.yaml
    └── vendor
        ├── fetchai
        │   ├── connections
        │   ├── protocols
        │   └── skills
        └── open_aea
            └── protocols

So what was the AEA directory in our case? Was it test? let's leave this here for a second.

Create one on the spot

from the test folder, let's create an agent manually:

# autonomy create jarvis_agent --remote --empty 
Initializing AEA project 'jarvis_agent'
Creating project directory './jarvis_agent'
Creating config file aea-config.yaml

# ls
jarvis_agent  my_first_aea

Now we have two agents in test folder, one fetched remotely and one from scratch locally.

Let's dig further into semantics:

# cd jarvis_agent

# ls
aea-config.yaml  connections  contracts  protocols  skills  vendor

What exactly are "packages" ?

Skills

Let's dig further into semantics:

# aea scaffold --with-symlinks skill notes_app 
Adding skill scaffold 'notes_app' to the agent 'jarvis_agent'...
Fingerprinting skill components of 'arcolife/notes_app:0.1.0' ...
Adding symlinks from vendor to non-vendor and packages to vendor folders.
  • a new packages symlink is created inside an "agent" (jarvis_agent) which is later supposed to be inside a folder containing all packages?

Connections and Protocols

Let's dig further into semantics.

From jarvis_agent folder, let's fetch a connection type package remotely:

# aea add connection valory/http_client:0.1.0:bafybeicmoolrrjnt5qn7jbwon7a3b5noe6hkj7kbjj57xtfosoygkckhuy --remote 

Adding connection 'valory/http_client:0.1.0:bafybeicmoolrrjnt5qn7jbwon7a3b5noe6hkj7kbjj57xtfosoygkckhuy'...
Adding protocol 'valory/http:1.0.0:bafybeienmids6f5pcey2bnywmiup2faawqgmdhhz65qfciuhkntugztvpi'...
Successfully added protocol 'valory/http:1.0.0'.
Successfully added connection 'valory/http_client:0.1.0'.

Looking at the structure:

# tree -d
.
├── connections
├── contracts
├── packages -> vendor
├── protocols
├── skills
│   └── notes_app
└── vendor
    ├── arcolife
    │   └── skills
    │       └── notes_app -> ../../../skills/notes_app
    └── valory
        ├── connections
        │   └── http_client
        └── protocols
            └── http
  • Aren't I supposed to not touch vendor folder?
  • Due to the flow of commands thus far, it has created a packages symlink forcing me to thereby edit my new skill notes_app as a "vendor" inside test/jarvis_agent/packages/arcolife/skills/notes_app which is actually test/jarvis_agent/vendor/arcolife/skills/notes_app ?

Scaffolding

# aea scaffold
Usage: aea scaffold [OPTIONS] COMMAND [ARGS]...

  Scaffold a package for the agent.

Options:
  -tlr, --to-local-registry  Scaffold skill inside a local registry.
  --with-symlinks            Add symlinks from vendor to non-vendor and
                             packages to vendor folders.
  --help                     Show this message and exit.

Commands:
  connection              Add a connection scaffolding to the...
  contract                Add a contract scaffolding to the configuration...
  decision-maker-handler  Add a decision maker scaffolding to the...
  error-handler           Add an error scaffolding to the configuration...
  protocol                Add a protocol scaffolding to the configuration...
  skill                   Add a skill scaffolding to the configuration...

create agent

aea create --help
Usage: aea create [OPTIONS] AGENT_NAME

  Create a new agent.

Options:
  --author TEXT  Add the author to run `init` before `create` execution.
  --remote       To use a remote registry.
  --local        To use a local registry.
  --empty        Not adding default dependencies.
  --help         Show this message and exit.

from https://github.com/valory-xyz/open-autonomy

# tree -d -L 2 packages
packages
├── open_aea
│   └── protocols
└── valory
    ├── agents
    ├── connections
    ├── contracts
    ├── protocols
    ├── services
    └── skills
    
# tree -L 2 packages/valory/agents/hello_world 
packages/valory/agents/hello_world
├── aea-config.yaml
└── README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment