article

Microagents - Getting Started with Microagents

A guide helping you to get started with microagents.
2023-03-140 min readjosh

What are microagents?

Microagents are software entities that can interact with each other to achieve specific goals. Fetch.ai's uAgents package is a fast and lightweight python library that makes it easy to build microagents for different kinds of decentralized use cases. Microagents can be programmed to perform a wide range of tasks, such as buying and selling goods, booking appointments, managing finances, and so on. Microagents are designed to be intelligent, adaptable, and autonomous, meaning they can make decisions and take actions on their own without human intervention.

Microagents offer several advantages, including:

  1. Easy to pick up: the quick guides available on our website allow you to create a microagent in a few minutes.

  2. Customization: any type of microagent can be created to meet the most specific needs.

  3. Connectivity: your microagents automatically join the micro-Agents network at start-up, through registration on the Fetch.ai Almanac smart contract.

  4. Security: the messages exchanged and the wallets used by microagents are cryptographically protected.

  5. Independence: your microagent is platform and language independent, with the exchange protocol defined in standard data types and soon to be available in additional languages.

Microagents Preliminaries

Let's get set up to develop microagents! First, make sure you have satisfied all the system requirements needed to go on with the installation process.

Fetch.ai's microagents package is a Python library that runs on Ubuntu/Debian, MacOS, and Windows.

System Requirements

  • Python 3.8, 3.9 or 3.10
  • PIP (Python Installs Packages)
  • (optional) Poetry or Pipenv for virtual environments

Location

Once the system requirements are met, you need to create a specific directory for your micro-Agents projects. So go ahead and create a directory on your system and enter it.

Virtual Environment (optional)

Although optional, we strongly recommend that you use a virtual environment when developing your micro-Agents.

A virtual environment lets you create an isolated environment for a Python project, so that the project's dependencies and packages do not conflict with other Python projects on the same system. This ensures that the project's dependencies are isolated, and makes it easier to manage dependencies for the project.

You can use any of the standard Python virtual environment providers, such as poetry or pipenv.

Create and enter a new poetry virtual environment:

code-icon
code-icon
poetry init -n && poetry shell

Create and enter a new pipenv environment:

code-icon
code-icon
pipenv --python 3.10 && pipenv shell

Install uAgents package from PyPI

Now let's install the microagents library from the Python Package Index (PyPI):

code-icon
code-icon
pipenv install uagents

This will download and install the latest version of the microagents library, along with any dependencies it requires.

Note: to check if microagent library is installed:

code-icon
code-icon
pip show uagents

Tutorial

Once the requirements are being satisfied, you will be ready to go on with the installation process. First of all, you need to create a specific directory for your project which will contain all the scripts you need to create. Let’s create a directory named "micro_agents_example":

code-icon
code-icon
mkdir micro_agents_example

We then need to enter it. Once you enter the directory, you will need to create and activate the virtual environment.

code-icon
code-icon
pipenv install
pipenv shell

then, you can proceed with the installation of the microagents python package.

code-icon
code-icon
pipenv install uagents

We can check if the package has been installed.

code-icon
code-icon
pip show uagents

Now, installation is complete! You are ready to create your first microagent!

For more information visit the microagents GitHub repository or our documentation. Also, do not miss any other related piece of content, such as our latest microagents blog post The Dawn of Microagents.


More from Fetch

light-leftellipse-orangeellipse-orange