You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/guides/agents/advanced/register-in-almanac.mdx
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ The [Almanac ↗️](/references/contracts/uagents-almanac/almanac-overview) con
8
8
9
9
## Walk-through
10
10
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`
12
12
13
13
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`:
Copy file name to clipboardExpand all lines: pages/guides/agents/getting-started/create-a-uagent.mdx
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -3,8 +3,11 @@
3
3
4
4
## Introduction
5
5
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.
7
7
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.
8
11
### The agent
9
12
10
13
1. Let's create a Python script for this task, and name it by running: `touch agent.py`
Copy file name to clipboardExpand all lines: pages/guides/agents/getting-started/getting-uagent-address.mdx
+17-19Lines changed: 17 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -6,21 +6,21 @@ Each agent within the Fetch ecosystem is characterized by different addresses. T
6
6
7
7
It is possible to distinguish between two different types of addresses:
8
8
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.
10
10
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.
12
12
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.
14
14
15
15
**Let's now check how these ways of retrieving addresses look like!**
16
16
17
17
## Print uAgent address
18
18
19
19
You can print the `uAgent address` related to your agent in the following way:
20
20
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`
22
22
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:
24
24
25
25
```py copy filename="uagent-address.py"
26
26
from uagents import Agent
@@ -38,16 +38,16 @@ You can print the `uAgent address` related to your agent in the following way:
You can print the `Fetch network address` related to your agent in the following way:
47
47
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`
49
49
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`:
51
51
52
52
```py copy filename="fetch-address.py"
53
53
from uagents import Agent
@@ -70,29 +70,27 @@ The output would be as follows:
70
70
71
71
## Print agent name and address using `name` and `address` methods
72
72
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:
74
74
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.
76
76
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.
78
78
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!**
82
80
83
81
### Walk-through
84
82
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`
86
84
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:
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:
96
94
97
95
```py copy
98
96
@agent.on_event("startup")
@@ -124,9 +122,9 @@ if __name__ == "__main__":
124
122
125
123
### Run the script
126
124
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.
128
126
129
-
Run the script: `my_agent.py`
127
+
On your terminal, run the script: `python my_agent.py`
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.
16
16
17
17
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.
18
18
@@ -28,12 +28,12 @@ The financial industry is another example. In this scenario, the automation of t
28
28
29
29
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.
30
30
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.
33
32
34
33
### Get started with Agents development!
35
34
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.
37
37
38
38
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)!
Copy file name to clipboardExpand all lines: pages/guides/agents/intermediate/communicating-with-other-agents.mdx
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ Let's start with **local communication**. This is the first step you would need
23
23
24
24
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.
25
25
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`
27
27
28
28
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`:
29
29
@@ -144,17 +144,17 @@ The output would be:
144
144
145
145
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/).
146
146
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.
148
148
149
149
Here, we show you how to create two agents and make them remotely communicate by registering and using the Almanac Contract.
150
150
151
151
### Walk-through
152
152
153
153
The first step would be to create two different Python scripts for this task, each one representing a remote agent:
154
154
155
-
Slaanesh: `touch remote_agents_slaanesh.py`
155
+
Slaanesh: `remote_agents_slaanesh.py`
156
156
157
-
Sigmar: `touch remote_agents_sigmar.py`
157
+
Sigmar: `remote_agents_sigmar.py`
158
158
159
159
Let's start by defining the script for **sigmar**.
Copy file name to clipboardExpand all lines: pages/guides/agents/intermediate/handlers.mdx
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Sometimes an agent will need to perform a task periodically. To do this we can u
20
20
21
21
### Walk-through
22
22
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`
24
24
2. Then import the necessary classes from `uagents` library, `Agent` and `Context`, and create our agent:
25
25
26
26
```py copy
@@ -91,7 +91,7 @@ We now showcase a scenario where three agents, named `alice`, `bob`, and `charle
91
91
92
92
### Walk-through
93
93
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`
95
95
96
96
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:
Copy file name to clipboardExpand all lines: pages/guides/agents/intermediate/mailbox.mdx
+10-4Lines changed: 10 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -3,10 +3,16 @@ import { Callout } from 'nextra/components'
3
3
# Agent Mailboxes
4
4
5
5
## 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.
8
14
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.
10
16
11
17
Let's get started!
12
18
@@ -45,7 +51,7 @@ Let's start by creating a local agent named `alice`, alice responds hello to any
45
51
agent.run()
46
52
```
47
53
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.
49
55
50
56
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!
51
57
When running the above agent, you should get something similar within your terminal output:
Copy file name to clipboardExpand all lines: pages/guides/agents/intermediate/send-tokens.mdx
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Let's get started!
8
8
9
9
## Walk-through
10
10
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`
12
12
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:
0 commit comments