Skip to content

Commit 72d58c6

Browse files
authored
Merge branch 'master' into feat/public
2 parents 8d993ea + ccc70f5 commit 72d58c6

File tree

9 files changed

+44
-37
lines changed

9 files changed

+44
-37
lines changed

pages/guides/agents/advanced/register-in-almanac.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The [Almanac ↗️](/references/contracts/uagents-almanac/almanac-overview) con
88

99
## Walk-through
1010

11-
1. First of all, create a Python script and name it by running: `touch registration.py`
11+
1. First of all, create a Python script and name it: `touch registration.py`
1212

1313
2. Then, import the `Agent` class from the `uagents` library to create our agent, and the `fund_agent_if_low` class from the `uagents.setup` module. This function will check if you have enough tokens to register in the Almanac contract, if not it will add testnet tokens to your `Fetch Network address`. Then, create an agent, `alice`, providing `name`, `port`, `seed`, and `endpoint`:
1414

pages/guides/agents/getting-started/create-a-uagent.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33

44
## Introduction
55

6-
Once you've [installed ↗️](/guides/agents/installing-uagent) the uAgents library, it's quite simple to get a minimal use case running. Let our first agent be a simple initialisation and printing out the agent's name.
6+
Once you've [installed ↗️](/guides/agents/installing-uagent) the uAgents library, it's quite simple to get a minimal use case running.
77

8+
The uAgents Framework streamlines agent creation by offering tools for communication, discovery, and publication within the Fetch.ai network. It empowers users and developers with flexibility, allowing them to build agents using anything from cutting-edge Large Language Models (LLMs) to simple APIs.
9+
10+
Let our first agent be a simple initialisation and printing out the agent's name and address.
811
### The agent
912

1013
1. Let's create a Python script for this task, and name it by running: `touch agent.py`

pages/guides/agents/getting-started/getting-uagent-address.mdx

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ Each agent within the Fetch ecosystem is characterized by different addresses. T
66

77
It is possible to distinguish between two different types of addresses:
88

9-
- `uAgent address`: this is the main agent identifier. Other agents can use this address to query the agent's information in the Almanac contract.
9+
- `uAgent address`: this address identifies the agent within the Fetch Network. It's similar to a username within a chat platform, allowing other agents to discover and communicate with that specific agent by querying that agent's information from the Almanac contract.
1010

11-
- `Fetch network address`: this is the address providing the agent with the capabilities for interacting with the [Fetch Ledger ↗️](/concepts/fetch-network/ledger/intro), including [Registration in the Almanac ↗️](/guides/agents/register-in-almanac) contract.
11+
- `Fetch network address`: this address is linked to the agent's wallet on the Fetch.ai network. It is essential to perform multiple functionalities like holding cryptocurrency, interacting with the [Fetch Ledger ↗️](/concepts/fetch-network/ledger/intro) , but also performing secure transactions. This address is also essential to register an agent on the [Almanac ↗️](/concepts/fetch-network/almanac) contract to ensure the agents has enough funds available to perform operations in the network.
1212

13-
If you want to retrieve the address of your agent, you can either use the `print()` function and specify which of the above addresses you wish to print out, or by calling the `Context` class and related methods to retrieve specific information.
13+
If you want to retrieve the address of an agent, you can either use the `print()` function and specify which of the above addresses you wish to print out, or by calling the `.address()` and `.wallet.address()` methods using the `agent` object to retrieve specific information.
1414

1515
**Let's now check how these ways of retrieving addresses look like!**
1616

1717
## Print uAgent address
1818

1919
You can print the `uAgent address` related to your agent in the following way:
2020

21-
1. First of all, create a Python script and name it by running: `touch uagent-address.py`
21+
1. First of all, create a Python script and name it: `touch uagent-address.py`
2222

23-
2. We then need to import the `Agent` class from the `uagents` library to create an agent, `alice`. Then, using the `print` function, we will print the related `uAgent address`. Importantly, remember that the `seed` parameter is used, when creating an agent, to set fixed addresses, otherwise a random address will be generated every time you run the agent:
23+
2. We then need to import the `Agent` class from the `uagents` library to create an agent, `alice`. Then, using the `print()` function, we will print the related `uAgent address`. Importantly, remember that the `seed` parameter is used, when creating an agent, to set fixed addresses, otherwise a random address will be generated every time you run the agent:
2424

2525
```py copy filename="uagent-address.py"
2626
from uagents import Agent
@@ -38,16 +38,16 @@ You can print the `uAgent address` related to your agent in the following way:
3838
The output would be as follows:
3939

4040
```
41-
uAgent address: agent1qww3ju3h6kfcuqf54gkghvt2pqe8qp97a7nzm2vp8plfxflc0epzcjsv79t
41+
uAgent address: agent1qww3ju3h6kfcuqf54gkghvt2pqe8qp97a7nzm2vp8plflc0epzcjsv79t
4242
```
4343

4444
## Print Fetch network address
4545

4646
You can print the `Fetch network address` related to your agent in the following way:
4747

48-
1. Let's create a Python script, and name it by running: `touch fetch-address.py`
48+
1. Let's create a Python script, and name it: `touch fetch-address.py`
4949

50-
2. As before, we first need to import the `Agent` class from the `uagents` library to create a uAgent, `alice`. Then, using the `print()` function, we will print the related `Fetch Network address`:
50+
2. As before, we first need to import the `Agent` class from the `uagents` library to create an Agent, `alice`. Then, using the `print()` function, we will print the related `Fetch Network address`:
5151

5252
```py copy filename="fetch-address.py"
5353
from uagents import Agent
@@ -70,29 +70,27 @@ The output would be as follows:
7070

7171
## Print agent name and address using `name` and `address` methods
7272

73-
In this guide, we aim at showing how to create an agent being able to say hello and printing its `name` and `address` retrieving such information from the `Context` class imported from the `uagents` library.
73+
In this guide, we aim at showing how to create an agent being able to say hello and printing its `name` and `address` using the `uagents` library tools. Indeed, it is possible to retrieve the `name` and `address` of any agent directly from the `agent` object representing the agent you create and initialise. More specifically, we refer to the following methods:
7474

75-
The `Context` class is a crucial component which represents the execution context of an agent. It encapsulates different attributes and methods which allow an agent to interact with its environment, send and receive messages, and manage its state and identity. Within this class, we can distinguish multiple attributes and methods, including:
75+
- `.name()`: this returns the provided name of the agent, if specified, otherwise, if the agent's name is not explicitly set, then it will use the first ten characters of the agent's address as its name.
7676

77-
- `name`: which returns the provided name of the agent, if specified, otherwise, if the agent's name is not explicitly set, then it will use the first ten characters of the agent's address as its name.
77+
- `.address()`: this returns the unique address of the agent in the form `agent1...`. This address is essential for other agents to interact with your agent.
7878

79-
- `address`: which returns the unique address of the agent in the form `agent1...`. This address is essential for other agents to interact with your agent.
80-
81-
**Let's get started and use the `Context` class to make our agent print its name and address!**
79+
**Let's get started and use the `agent` object to make our agent print its name and address!**
8280

8381
### Walk-through
8482

85-
1. First of all, you need to create a Python script and name it by running: `touch my_agent.py`
83+
1. First of all, you need to create a Python script and name it: `touch my_agent.py`
8684

87-
2. We then need to import the necessary classes `Agent` and `Context` from the `uagents` library, and then create an instance of the `Agent` class, `alice`:
85+
2. We then need to import the necessary classes `Agent` and `Context` from the `uagents` library, and then create an instance of the `Agent` class, `alice`. Below you can see the `agent` object being initialised:
8886

8987
```py copy
9088
from uagents import Agent, Context
9189

9290
agent = Agent(name="alice", seed="alice recovery phrase")
9391
```
9492

95-
3. We would then need to assign the agent the behavior to be executed. In this case, `agent` could send a message when it is being run saying hello and printing its `name` and `address`:
93+
3. We would then need to assign the agent the behavior to be executed. In this case, `agent` could send a message when it is being run saying hello and printing its `name` and `address` using the `agent` object:
9694

9795
```py copy
9896
@agent.on_event("startup")
@@ -124,9 +122,9 @@ if __name__ == "__main__":
124122

125123
### Run the script
126124

127-
On your terminal, make sure to have activated the virtual environment.
125+
If you are using a Poetry virtual environment, make sure that you have activated it.
128126

129-
Run the script: `my_agent.py`
127+
On your terminal, run the script: `python my_agent.py`
130128

131129
The output should be as follows:
132130

pages/guides/agents/getting-started/whats-an-agent.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The **uAgents Framework** is a lightweight library designed to facilitate the de
1212

1313
![](src/images/concepts/ai-agents/Agents_interacting.svg)
1414

15-
Agents are programs that can interact autonomously with other agents in a decentralized environment. These agents can operate in a decentralized manner, but their decentralization remains optional and dependent on individual preferences or needs.
15+
Agents are autonomous software program built using the uAgents framework and that can interact autonomously with other agents in a decentralized environment. These agents can operate in a decentralized manner, but their decentralization remains optional and dependent on individual preferences or needs.
1616

1717
Intelligent agents can fundamentally change the way we see complicated systems. For example, supply chain management could deploy Agents using the uAgents Framework to improve operations at various stages. Demand forecasting, inventory control, logistics optimization, supplier relationships monitoring, quality control and risk mitigation in all areas can be done with their help. Agents could transform supply chain operations by increasing efficiency, reducing costs, improving accuracy and providing real-time visibility.
1818

@@ -28,12 +28,12 @@ The financial industry is another example. In this scenario, the automation of t
2828

2929
In this context, Fetch.ai introduces the **uAgents Framework**. Using this open-source framework, developers are able to create intelligent, autonomous agents and join a decentralized network of many agents to effectively tackle the challenges of the modern world. Agents only perform tasks specified by the developers, and these tasks can be precisely described by coding customizable behavior for specific use cases and scenarios.
3030

31-
The concept of Agents stands for autonomous, decentralized systems that overcome conventional limitations.
32-
Agents provide a gateway to a future where intelligent agents, empowered by the Fetch network and the [AI Engine ↗️](/concepts/ai-engine/ai-engine-intro), can communicate, negotiate and collaborate to streamline complex tasks, solve complicated problems and improve decision-making processes in various fields.
31+
TThe concept of agents refers to autonomous, decentralized systems that overcome conventional limitations. Agents provide a gateway to a future where intelligent agents, empowered by the Fetch network and the [AI Engine ↗️](/concepts/ai-engine/ai-engine-intro), can communicate, negotiate and collaborate to streamline complex tasks, solve complicated problems and improve decision-making processes in various fields.
3332

3433
### Get started with Agents development!
3534

36-
Visit the [GitHub repository ↗️](https://github.com/fetchai/uAgents) if you need to verify any additional information on the aforementioned topics. This will keep you informed about any updates made to the uAgents Framework.
35+
Visit the [GitHub repository ↗️](https://github.com/fetchai/uAgents) for more information on the aforementioned topics.
36+
. This will also keep you up-to-date with any update made to the uAgents Framework.
3737

3838
To learn more about how to create and connect Agents technology, check out the resources and guides for the [Agentverse ↗️](/concepts/agent-services/agentverse-intro), [AI Engine ↗️](/concepts/ai-engine/ai-engine-intro), and [DeltaV ↗️](/concepts/deltav/intro)!
3939

pages/guides/agents/intermediate/communicating-with-other-agents.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Let's start with **local communication**. This is the first step you would need
2323

2424
The first step to better understand how agents communicate is to introduce how 2 agents perform a local communication. Let's consider a basic example in which two agents say hello to each other.
2525

26-
1. First of all, let's create a Python script for this task and name it by running: `touch agents_communication.py`
26+
1. First of all, let's create a Python script for this task and name it: `agents_communication.py`
2727

2828
2. Then, we import `Agent`, `Context`, `Bureau`, and `Model` from the uagents library and we then define the message structure for messages to be exchanged between the agents using the class `Model`:
2929

@@ -144,17 +144,17 @@ The output would be:
144144

145145
To speak, search or be found, your agent must register to the [Almanac contract ↗️](/references/contracts/uagents-almanac/almanac-overview). Agents then query this to retrieve an HTTP endpoint for a recipient agent. [Registration in the Almanac ↗️](/guides/agents/register-in-almanac) requires paying a small fee, so make sure to have enough funds to allow for this. You can query the Almanac now, by using the search feature on [Agentverse ↗️](https://agentverse.ai/).
146146

147-
Whenever an agent registers in the Almanac, it must specify the service [endpoints ↗️](/references/contracts/uagents-almanac/endpoints) alongside a weight parameter for each endpoint provided. Agents trying to communicate with your agent, will choose the service endpoints using a weighted random selection.
147+
Whenever an agent registers in the Almanac, it must specify the service [endpoints ↗️](/references/contracts/uagents-almanac/endpoints) alongside a weight parameter for each endpoint provided. Agents trying to communicate with your agent will choose the service endpoints using a weighted random selection.
148148

149149
Here, we show you how to create two agents and make them remotely communicate by registering and using the Almanac Contract.
150150

151151
### Walk-through
152152

153153
The first step would be to create two different Python scripts for this task, each one representing a remote agent:
154154

155-
Slaanesh: `touch remote_agents_slaanesh.py`
155+
Slaanesh: `remote_agents_slaanesh.py`
156156

157-
Sigmar: `touch remote_agents_sigmar.py`
157+
Sigmar: `remote_agents_sigmar.py`
158158

159159
Let's start by defining the script for **sigmar**.
160160

pages/guides/agents/intermediate/handlers.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Sometimes an agent will need to perform a task periodically. To do this we can u
2020

2121
### Walk-through
2222

23-
1. Let's create a Python script for this task, and name it: `touch interval-task.py`
23+
1. Let's create a Python script for this task, and name it: `interval-task.py`
2424
2. Then import the necessary classes from `uagents` library, `Agent` and `Context`, and create our agent:
2525

2626
```py copy
@@ -91,7 +91,7 @@ We now showcase a scenario where three agents, named `alice`, `bob`, and `charle
9191

9292
### Walk-through
9393

94-
1. First of all, let's create a Python script for this task, and name it: `touch broadcast.py`
94+
1. First of all, let's create a Python script for this task, and name it: `broadcast.py`
9595

9696
2. We then need to import the `Agent`, `Bureau`, `Context`, `Model`, and `Protocol` classes from the `uagents` library, and the `fund_agent_if_low` from `uagents.setup`. Then, let's create the 3 different agents using the class `Agent`. Each agent is initialized with a unique name and a seed phrase for wallet recovery. Additionally, if an agent's wallet balance is low, the `fund_agent_if_low()` function is called to add funds to their wallet:
9797

pages/guides/agents/intermediate/mailbox.mdx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ import { Callout } from 'nextra/components'
33
# Agent Mailboxes
44

55
## Introduction
6-
Agents can't always be online, say for a power-cut, or simply they're only online while you are. This can be a problem, ideally agents should be available online as much as they can so to not miss any opportunities, or contacts. For this reason we created the **Mailbox** feature on [Agentverse ↗️](https://agentverse.ai). A Mailbox is like a middleman that acts as a mailbox for all communication for you.
7-
Messages get stored there, and your agents will collect them when they're online back again.
6+
Agents can't always be online, say for a power-cut, or simply they're only online while you are. This can be a
7+
problem as agents should be available online as much as they can so that they do not miss any opportunities, or
8+
contacts. However, 100% uptime is of course sometimes challenging, especially if you're hosting agents locally on
9+
your own computer. For this reason we created
10+
the
11+
**Mailbox** feature on [Agentverse ↗️](https://agentverse.ai). A Mailbox is a
12+
middleman that acts as a mailbox for all communication to your agent. Messages are stored within the mailbox and your
13+
agents will collect them (calls for these messages as in startup of uAgents library) when they're online back again.
814

9-
First of all, we need to have an agent being set up and running locally before we can register it for a Mailbox on the Agentverse.
15+
First of all, we need to have an agent up and running locally before we can register it for a Mailbox on the Agentverse.
1016

1117
Let's get started!
1218

@@ -45,7 +51,7 @@ Let's start by creating a local agent named `alice`, alice responds hello to any
4551
agent.run()
4652
```
4753

48-
We now need to create a Mailbox for this agent and retrieve a Mailbox API key which should be then pasted within your local agent code by filling up the `AGENT_MAILBOX_KEY` field inline.
54+
We now need to create a Mailbox for this agent and retrieve a Mailbox API key which should be then pasted within your local agent code by filling up the `AGENT_MAILBOX_KEY` field.
4955

5056
Run the above code in your terminal to retrieve your agent's address. You will need it in the next steps to set up an Agentverse Mailbox!
5157
When running the above agent, you should get something similar within your terminal output:

pages/guides/agents/intermediate/send-tokens.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Let's get started!
88

99
## Walk-through
1010

11-
1. First of all, create a Python script for this task, and name it by running: `touch sending_tokens.py`
11+
1. First of all, create a Python script for this task, and name it: `touch sending_tokens.py`
1212
2. Then, import the necessary modules from `uagents`, `uagents.network`, and `uagents.setup`. Let's then define two data models: `PaymentRequest` and `TransactionInfo`. We then need to set up the values for the `AMOUNT` and `DENOM` variables, which define the default amount and denomination for the payment requests:
1313

1414
```py copy

pages/guides/agents/intermediate/storage-function.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ In this guide, we want to illustrate how storage functions are called and how to
66

77
## Walk-through
88

9-
1. First of all, let's create a Python script, and name it by running: `touch storage.py`.
9+
1. To start let's create a Python script and name it `storage.py`, we can do this in terminal with `touch storage.py`.
1010

1111
2. Then, we need to open the script in the text editor of choice and import the necessary classes, `Agent` and `Context`, from the `uagents` library.
1212

0 commit comments

Comments
 (0)