Skip to content

Commit db6098e

Browse files
fix(docs): fixed mailbox guides with new changes following release (#1111)
1 parent 5f8fa5b commit db6098e

25 files changed

+210
-225
lines changed

pages/examples/agentverse/mailbox-agents.mdx

+1-5
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,11 @@ Please check out the example code in our [examples repo ↗️](https://github.c
4343
# First generate a secure seed phrase (e.g. https://pypi.org/project/mnemonic/)
4444
SEED_PHRASE = "put_your_seed_phrase_here"
4545

46-
# Now go to https://agentverse.ai, register your agent in the Mailroom by providing the address you just copied.
47-
# Then, copy the agent's mailbox key and insert it here below inline
48-
AGENT_MAILBOX_KEY = "put_your_AGENT_MAILBOX_KEY_here"
49-
5046
# Now your agent is ready to join the agentverse!
5147
agent = Agent(
5248
name="alice",
5349
seed=SEED_PHRASE,
54-
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
50+
mailbox=True
5551
)
5652

5753
fund_agent_if_low(agent.wallet.address())

pages/guides/agent-courses/agents-for-ai.mdx

+9-13
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,11 @@ We can do this by running:
147147

148148

149149
SEED_PHRASE = ""
150-
AGENT_MAILBOX_KEY = ""
151150

152151
sentimentagent = Agent(
153152
name="SentimentAgent", # or any name
154153
seed=SEED_PHRASE,
155-
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
154+
mailbox=True,
156155
)
157156

158157
print(sentimentAgent.address)
@@ -190,7 +189,7 @@ We can do this by running:
190189

191190

192191
<Callout type="warning" emoji="⚠️">
193-
Remember that you need to provide the `SEED_PHRASE`, `AGENT_MAILBOX_KEY`, `name`, `seed` and `mailbox` parameters to correctly run this example.
192+
Remember that you need to provide the `SEED_PHRASE`, `name`, `seed` and `mailbox` parameters to correctly run this example.
194193
</Callout>
195194

196195
Okay, we've got the whole code block above for our first agent. Have a look at list of available packages on the Agentverse [here ↗️](/guides/agentverse/allowed-imports) to get started with Agents development on the Agentverse.
@@ -239,18 +238,16 @@ There are a lot of really cool, neat things you need to know from code above. Le
239238

240239
- `SEED_PHRASE` is our agents unique seed.
241240

242-
- `AGENT_MAILBOX_KEY` mailbox key is our ID of our mailbox hosted on Agentverse.
243-
244241
- `OPENAI_API_KEY` is our API key to OpenAI's APIs.
245242

246243
We can now initialize the Agent and define the [Protocol ↗️](/references/uagents/uagents-protocols/agent-protocols). To read more about **Agent objects**, please check out [the reference docs ↗️](/references/uagents/uagents-api/agent#agent-objects).
247244

248-
Then, we have the **on_message()** [handler ↗️](/guides/agents/intermediate/handlers):
245+
Then, we have the `on_message()` [handler ↗️](/guides/agents/intermediate/handlers):
249246

250247
<GithubCodeSegment digest="4062beca9a7cafff6002e8e8ff9c7a28">
251248
<CodeSegment
252249
path="https://github.com/fetchai/uAgent-Examples/blob/main/5-documentation/guides/agent-courses/agents-for-ai/sentiment_agent.py"
253-
lineStart={35}
250+
lineStart={34}
254251
lineEnd={40}
255252
hosted={true}
256253
/>
@@ -285,7 +282,7 @@ We can finally run the Agent at the bottom of the script:
285282
<GithubCodeSegment digest="669ae61db8d1e79422c0db593b959609">
286283
<CodeSegment
287284
path="https://github.com/fetchai/uAgent-Examples/blob/main/5-documentation/guides/agent-courses/agents-for-ai/sentiment_agent.py"
288-
lineStart={43}
285+
lineStart={42}
289286
lineEnd={44}
290287
hosted={true}
291288
/>
@@ -414,7 +411,7 @@ The next agent in the chain is the **Summary agent**. Let's name the script `web
414411
```py copy filename="ubuntu"
415412
touch web_sentiment_agent.py
416413
```
417-
</DocsCode>
414+
</DocsCode>
418415

419416
</CodeGroup>
420417

@@ -449,13 +446,12 @@ Let's take a look.
449446

450447

451448
SEED_PHRASE = "<your_seed_phrase>"
452-
AGENT_MAILBOX_KEY = "<your_mailbox_key>"
453449
OPENAI_API_KEY = "<your_open_ai_key>"
454450

455451
summaryAgent = Agent(
456452
name="SummaryAgent",
457453
seed=SEED_PHRASE,
458-
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
454+
mailbox=True,
459455
)
460456

461457
summary_protocol = Protocol("Text Summariser")
@@ -511,7 +507,7 @@ Let's take a look.
511507

512508

513509
<Callout type="warning" emoji="⚠️">
514-
Remember that you need to provide the `SEED_PHRASE`, `AGENT_MAILBOX_KEY`, `OPENAI_API_KEY`, `name`, `seed` and `mailbox` parameters to correctly run this example.
510+
Remember that you need to provide the `SEED_PHRASE`, `OPENAI_API_KEY`, `name`, `seed` and `mailbox` parameters to correctly run this example.
515511
</Callout>
516512

517513
This Agent is simple again, hopefully you're seeing a pattern here. These Agents while independent of each other can
@@ -523,7 +519,7 @@ compliment one another.
523519

524520
Aside from the different logic, the primary difference in `web_summary_agent.py` is that this agent does not rely on a separate function, and wraps the whole logic in the message handler.
525521

526-
Let's run this one too. Again, follow the steps for the previous Agent and go and register a Mailbox and update this agent with the new Mailbox. Each agent must have a unique [Mailbox ↗️](/guides/agents/intermediate/mailbox).
522+
Let's run this one too. Again, follow the steps for the previous Agent and go and connect it via a Mailbox Each agent must have a unique [Mailbox ↗️](/guides/agents/intermediate/mailbox)!
527523

528524
## One more Agent Function 🎵
529525

pages/guides/agents/intermediate/agent-functions.mdx

+18-8
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,29 @@ Finally, we run our agent as follows: `python simple_function.py`
130130

131131
For this example we set up a really simple Agent Function. For further information on Agent Functions and registration process, see [Register Agent Functions on the Agentverse ↗️](/guides/agentverse/registering-agent-services) resource.
132132

133-
To register **Local Agents and Functions**, you will first need to log in the [Agentverse ↗️](https://agentverse.ai/) and head over to the **My Agents** tab. Then, click on **Local Agents** tab and click one of the **Connect Local Agent** buttons.
133+
To register **Local Agents and Functions**, you will first need to head over to the [local Agent Inspector ↗️](/guides/agents/intermediate/local-agent-inspector) available by clicking on the dedicated link presented within your terminal output after running the above local Agent. Once you do so, click on **Connect** button and select **Mailbox**. Follow the steps closely and provide all needed data required.
134134

135-
![](src/images/guides/uagent/servicefordungeons_1.png)
135+
![](src/images/guides/agentverse/mailbox/agentverse:mailbox/mailbox_1a.png)
136136

137-
You will need to provide the **local agent address** and make sure it is running on your terminal as only running agents can enroll Agent Functions on the Agentverse!
137+
![](src/images/guides/agentverse/mailbox/agentverse:mailbox/mailbox_2a.png)
138138

139-
![](src/images/guides/uagent/servicefordungeons_2.png)
139+
After this, click **Connect**.
140+
141+
![](src/images/guides/agentverse/mailbox/agentverse:mailbox/mailbox_3a.png)
142+
143+
At this point, you do not need to do anything else. Click **Finish**.
140144

141-
<Callout type="warning" emoji="⚠️">
142-
If you see a message saying **"We couldn't find this agent address on Fetch Network"** you will need to wait for some time (around 5 minutes) until the protocols are uploaded successfully on the Fetch Network and your agent is retrievable.
143-
</Callout>
145+
![](src/images/guides/agentverse/mailbox/agentverse:mailbox/mailbox_4a.png)
146+
147+
Once your agent is connected via the Mailbox correctly, you will see a box depicting it within the **My Agents** tab.
148+
149+
![](src/images/guides/uagent/servicefordungeons_1.png)
150+
151+
Click on it and head over to the **Deploy** tab and click on **+ New Function**.
152+
153+
![](src/images/guides/uagent/servicefordungeons_2.png)
144154

145-
Once your agent is retrieved correctly, you will see a box depicting it within the **My Agents** tab. Click on it and head over to the **Deploy** tab and click on **+ New Function**. Here, you can now provide the needed details for your Agent Function in the dedicated fields. Remember to provide detailed descriptions for what your **Agent Function** does and the **Fields** for data Models expected. understanding of Functions fields descriptions.
155+
Here, you can now provide the needed details for your Agent Function in the dedicated fields. Remember to provide detailed descriptions for what your **Agent Function** does and the **Fields** for data Models expected. understanding of Functions fields descriptions.
146156

147157
![](src/images/guides/uagent/servicefordungeons_3.png)
148158

pages/guides/agents/intermediate/agent-types.mdx

+8-8
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ The [Agentverse Mailbox feature ↗️](/guides/agents/intermediate/mailbox) mak
3737

3838
**Local Agents can use a Mailbox to ensure that no messages are lost when they are temporarily disconnected from the network**; the Mailbox acts as a message buffer, storing communications until the Agent comes back online and ready to process them. Indeed, this feature enables interaction with other Agents or functions without the Agent being online continuously.
3939

40-
In order to set up a mailbox for a local Agent, you first need to create and configure a local Agent. The Agent's address is used to register it on the Agentverse, and then to generate a **Mailbox API key** for your Agent. For instance, consider the following basic Agent:
40+
In order to set up a mailbox for a local Agent, you first need to create and configure the local Agent. For instance, consider the following basic Agent:
4141

4242
<GithubCodeSegment digest="67d527d8ecb6cc3ea76fdce279b2a78a">
4343
<CodeSegment
@@ -58,15 +58,13 @@ In order to set up a mailbox for a local Agent, you first need to create and con
5858
class Message(Model):
5959
message: str
6060

61-
62-
AGENT_MAILBOX_KEY = "put_your_AGENT_MAILBOX_KEY_here"
63-
SEED_PHRASE = "put_your_seed_phrase_here"
61+
SEED_PHRASE = "put_your_seed_phrase_here"
6462

6563
# Now your agent is ready to join the agentverse!
6664
agent = Agent(
6765
name="alice",
68-
seed=SEED_PHRASE,
69-
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai"
66+
port=8000,
67+
mailbox=True
7068
)
7169

7270
# Copy the address shown below
@@ -80,8 +78,10 @@ In order to set up a mailbox for a local Agent, you first need to create and con
8078

8179
</CodeGroup>
8280

81+
Now, run this Agent. You will be able to see a link in your terminal output redirecting you towards the [Local Agent Inspector ↗️](/guides/agents/intermediate/local-agent-inspector) for this specific Agent on the [Agentverse ↗️](https://agentverse.ai/). Click on this URL. You will be redirected to the Inspector UI where you can check multiple details about the local Agent you have just run.
8382

83+
![](src/images/guides/inspector/local_agent_inspector.png)
8484

85-
Then, head over to the [Agentverse ↗️](https://agentverse.ai/) and navigate to the **My Agents** tab. Here, select **Local Agents** and click on **Connect Local Agent**. Paste your Agent's address retrieved from running your local Agent and follow the steps until you get a **Mailbox API Key**, which you will use to update your Agent's configuration above. To test your Mailbox setup, you can create another Agent (on Agentverse for instance) that sends messages to the Mailbox while the first Agent is offline. When the first agent comes back online, it will retrieve and process the stored messages. For a complete example, check out this [guide ↗️](/guides/agentverse/agentverse-mailbox/utilising-the-mailbox).
85+
Now, click on **Connect** and then on **Mailbox** options and follow the steps closely in order to correctly set up a mailbox for your local Agent. To test your Mailbox setup, you can create another Agent (on Agentverse for instance) that sends messages to the Mailbox while the first Agent is offline. When the first agent comes back online, it will retrieve and process the stored messages.
8686

87-
For a more complex example of an Agent using a Mailbox, check out the following [guide ↗️](/guides/agents/intermediate/langchain-rag-agent).
87+
For a complete example, check out this [guide ↗️](/guides/agentverse/agentverse-mailbox/utilising-the-mailbox). For a more complex example of an Agent using a Mailbox, check out the following [guide ↗️](/guides/agents/intermediate/langchain-rag-agent).

pages/guides/agents/intermediate/langchain-rag-agent.mdx

+6-6
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,15 @@ Let's start by creating the file within the `agents` directory, under `src` dire
243243
</DocsCode>
244244
</CodeGroup>
245245

246-
The Agent is defined as a [local agent with a Mailbox ↗️](https://fetch.ai/docs/guides/agents/intermediate/options-for-running-local-agents#run-a-local-agent-using-a-mailbox) and it can answer questions by fetching and summarizing information from a given website URL.
246+
The Agent is defined as a [local agent with a Mailbox ↗️](/guides/agents/intermediate/options-for-running-local-agents#run-a-local-agent-using-a-mailbox) and it can answer questions by fetching and summarizing information from a given website URL.
247247

248248
The script for this Agent looks as follows:
249249

250250
<GithubCodeSegment digest="6e1bac7fcd2e972c9e57b0baae58c27c">
251251
<CodeSegment
252252
path="https://github.com/fetchai/uAgent-Examples/blob/main/1-uagents/examples/intermediate/langchain-rag/src/agents/langchain_rag_agent.py"
253253
lineStart={1}
254-
lineEnd={137}
254+
lineEnd={134}
255255
hosted={true}
256256
/>
257257
</GithubCodeSegment>
@@ -284,13 +284,13 @@ The script for this Agent looks as follows:
284284

285285

286286
LANGCHAIN_RAG_SEED = "YOUR_LANGCHAIN_RAG_SEED"
287-
AGENT_MAILBOX_KEY = "YOUR_MAILBOX_KEY"
288287

289288
agent = Agent(
290289
name="langchain_rag_agent",
291290
seed=LANGCHAIN_RAG_SEED,
292-
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
291+
mailbox=True,
293292
)
293+
294294
fund_agent_if_low(agent.wallet.address())
295295

296296
docs_bot_protocol = Protocol("DocsBot")
@@ -407,7 +407,7 @@ The script for this Agent looks as follows:
407407

408408
The Agent fetches and processes information from specified URLs to answer users' questions.
409409

410-
Let's explore the script above in more detail. We start by importing multiple modules, including tools for making HTTP requests, parsing HTML, and handling Natural Language Processing (NLP). The Agent uses **OpenAI's GPT-4o-mini model** to generate answers based on the retrieved documents. We then create an Agent called `langchain_rag_agent()` with a unique `seed` and `mailbox` address. Check out the [Mailbox ↗️](/guides/agents/intermediate/mailbox) guide for additional information on how to set up Mailboxes for your Agents. **Make sure to have enough funds in the Agent's wallet for it to correctly register in the [Almanac contract ↗️](/references/contracts/uagents-almanac/almanac-overview). You can use the `fund_agent_if_low` function on the testnet to add funds to your Agent's wallet if needed.
410+
Let's explore the script above in more detail. We start by importing multiple modules, including tools for making HTTP requests, parsing HTML, and handling Natural Language Processing (NLP). The Agent uses **OpenAI's GPT-4o-mini model** to generate answers based on the retrieved documents. We then create an Agent called `langchain_rag_agent()` with a unique `seed`. Check out the [Mailbox ↗️](/guides/agents/intermediate/mailbox) guide for additional information on how to set up Mailboxes for your Agents. **Make sure to have enough funds in the Agent's wallet for it to correctly register in the [Almanac contract ↗️](/references/contracts/uagents-almanac/almanac-overview)**. You can use the `fund_agent_if_low` function on the testnet to add funds to your Agent's wallet if needed.
411411

412412
Next, we define the `DocsBot` [protocol ↗️](/guides/agents/intermediate/protocols) using the `Protocol` class of the `uagents` library to handle message interactions. This protocol uses a predefined prompt template to structure the questions and context for the language model.
413413

@@ -594,7 +594,7 @@ It will look as follows:
594594

595595
Cool! All scripts are now set up! You will need to [connect the local Agent to the Agentverse using a Mailbox ↗️](/guides/agents/intermediate/options-for-running-local-agents#run-a-local-agent-using-a-mailbox). The Mailbox enables your Agents to be retrievable for communication and interaction with any other registered Agent on the Almanac contract and Fetch Network. In this example, the `langchain_rag_agent` will be connected to the Agentverse using a [Mailbox ↗️](/guides/agents/intermediate/mailbox). The `langchain_rag_user` Agent is used as a testing Agent for the RAG Agent being registered on the Agentverse and made subsequently available on DeltaV for queries.
596596

597-
By creating an [Agent Function ↗️](https://fetch.ai/docs/guides/agents/intermediate/agent-functions) and [registering it ↗️](https://fetch.ai/docs/guides/agentverse/agentverse-functions/registering-agent-services) via the Agentverse, you will make it retrievable to the [AI Engine ↗️](/concepts/ai-engine/ai-engine-intro) for interaction with users via natural language queries made on [DeltaV ↗️](/concepts/ai-engine/deltav).
597+
By creating an [Agent Function ↗️](/guides/agents/intermediate/agent-functions) and [registering it ↗️](/guides/agentverse/agentverse-functions/registering-agent-services) via the Agentverse, you will make it retrievable to the [AI Engine ↗️](/concepts/ai-engine/ai-engine-intro) for interaction with users via natural language queries made on [DeltaV ↗️](/concepts/ai-engine/deltav).
598598

599599
The `langchain_rag_user` Agent is used as a testing Agent for the RAG Agent being registered on the Agentverse and made subsequently available on DeltaV for queries.
600600

pages/guides/agents/intermediate/local-agent-inspector.mdx

+3-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ For instance, consider the following simple local Agent:
2929
<CodeSegment
3030
path="https://github.com/fetchai/uAgent-Examples/blob/main/5-documentation/guides/agents/intermediate/local-agent-inspector/agent_inspector_example.py"
3131
lineStart={1}
32-
lineEnd={25}
32+
lineEnd={27}
3333
hosted={true}
3434
/>
3535
</GithubCodeSegment>
@@ -84,7 +84,6 @@ By running the above Agent, the output you get should be similar to the followin
8484

8585
By clicking on the dedicated link depicted here, you will then be redirected to the **Inspector Dashboard**. A pop-up message will appear saying that your Agent was connected successfully.
8686

87-
![](src/images/guides/inspector/inspector_2.png)
88-
89-
Here you can view all the information about your local Agent, including details about all messaged sent and received by the Agent.
87+
![](src/images/guides/inspector/local_agent_inspector.png)
9088

89+
Here you can view all the information about your local Agent, including details about all messaged sent and received by the Agent. Additionally, you can connect you local Agent directly via the Inspector UI, by clicking the **Connect** button and following the steps required. For a better representation of the process, have a look at the following guide [here ↗️](/guides/agents/intermediate/mailbox)

0 commit comments

Comments
 (0)