Skip to content

Commit

Permalink
feat(docs): Minor updates from Feb review (#1179)
Browse files Browse the repository at this point in the history
Co-authored-by: Joshua Croft <[email protected]>
Co-authored-by: Felix Nicolae Bucsa <[email protected]>
  • Loading branch information
3 people authored Feb 27, 2025
1 parent 56ddfe6 commit 4c22168
Show file tree
Hide file tree
Showing 17 changed files with 548 additions and 125 deletions.
5 changes: 4 additions & 1 deletion .github/spelling/known_words_corpus.txt
Original file line number Diff line number Diff line change
Expand Up @@ -791,4 +791,7 @@ apimessage
getmodels
runtype
CUDOS
HD
HD
teckstack
i1
i2
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@
"eslint-plugin-unicorn": "^48.0.1",
"tailwindcss": "^3.3.3",
"typescript": "^4.9.5"
}
},
"packageManager": "[email protected]+sha512.da9dc28cd3ff40d0592188235ab25d3202add8a207afbedc682220e4a0029ffbff4562102b9e6e46b4e3f9e8bd53e6d05de48544b0c57d4b0179e22c76d1199b"
}
4 changes: 3 additions & 1 deletion pages/guides/agents/getting-started/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@
"title": "Agents address",
"tags": ["Beginner", "Python", "Address", "Local"],
"timestamp": true
}
},
"almanac": "Almanac",
"fet-token-for-agents": "Agent Funds"
}
13 changes: 13 additions & 0 deletions pages/guides/agents/getting-started/almanac.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Callout } from 'nextra/components'

# Almanac contract, registering, searching and discovery

The [Almanac ↗️](/references/contracts/uagents-almanac/almanac-overview) contract is a decentralised register of all agents that are available in the system. Registration in the Almanac contract is mandatory so that agents can participate in remote interactions and become discoverable through the [Marketplace ↗️](/concepts/agent-services/agent-explorer). However, you can use uAgents without the Almanac registration by creating your own communication protocol.

Agents keep their registrations up-to-date within defined block times to ensure the accuracy and relevance of their data. Expired registrations prevent outdated information from being accessed, increasing the reliability of the data. During the registration process, the ownership of addresses is verified to ensure the credibility and accuracy of the information stored in the Almanac.

The agents registered to the Almanac provide service define their endpoint(s) for remote communication, which also define weighted parameters that enable effective interaction. The Almanac facilitates the discovery of endpoints based on these assigned weights. This structured approach promotes efficient agent interactions and a robust environment for the development of Agents within Fetch.ai's decentralized network.

<Callout type="info" emoji="ℹ️">
Check out the [Registering in the Almanac contract ↗️](/guides/agents/register-in-almanac) guide and the [Registration and endpoints weighting ↗️](/references/contracts/uagents-almanac/endpoints) for additional information on the registration process.
</Callout>
92 changes: 92 additions & 0 deletions pages/guides/agents/getting-started/fet-token-for-agents.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { Callout } from 'nextra/components'

# Getting Started with FET Token for Agent development

<Callout type="info" emoji="💡️">
This is currently a work in progress and may be subject to further updates and revisions.
</Callout>

## Introduction

The FET token was created to facilitate payments in an Agentic ecosystem, these are micro payments to one another which traditional currencies do not support. FET tokens are used for agent Almanac registration, and wider contract interactions.

## Acquiring FET Tokens

Exchanges are the simplest way to get FET tokens.

Visit a trusted exchange such as Coinbase or Binance. You may need to create an account, which will involve you
passing [KYC ↗️](https://www.gov.uk/government/publications/know-your-customer-guidance/know-your-customer-guidance-accessible-version). Once your account is enabled, you can buy FET token. You can buy this with most global
currencies, just check on the exchange which currencies they accept.

## Storing FET

Ideally you would be sending this FET to your agent to transact on the network. However, if you'd like greater
security or accessibility.

For short-term storage goals, the ASI Wallet is an excellent choice; it provides direct functionalities for daily activities such as staking and interacting with Agents.

For long-term storage goals, you can enhance security by integrating your ASI Wallet with a hardware wallet like Ledger, offering robust protection for your assets. Follow this guide [here ↗️](/guides/fetch-network/asi-wallet/asi-wallet-hardware-connection-guide) if you wish to set up the ASI Alliance extension wallet with a Ledger hardware wallet.

## How to transfer tokens to your Agents

You can download and use the uAgents library to create autonomous Agents capable of interacting with other Agents in a decentralized environment. Check out this guide [here ↗️](/guides/agents/getting-started/installing-uagent) to get started with Agents development.

In order to get your Agent up and running within the Fetch.ai ecosystem, you will need to retrieve the Agent's address and fund it with FET tokens to make it correctly register within the network.

<Callout type="info" emoji="ℹ️">
When creating your account, it is crucial to securely store your [seed phrase ↗️](/guides/agents/getting-started/seedphrase). The seed phrase is essential for accessing your Agent's identity and controlling any funds it holds. Treat it with the highest level of security to prevent unauthorized access!
</Callout>

### Getting your Agent address to send tokens to your Agent

The following Python script demonstrates how to create and initialize an Agent using the `uagents` and `cosmpy` libraries, to connect it to the Fetch.ai Mainnet, and retrieve its address and balance information:

```py copy filename="agent_address_and_balance.py"
from uagents import Agent, Context
import cosmpy

from cosmpy.aerial.client import LedgerClient, NetworkConfig

agent = Agent(name="alice", seed="", port=8000, test=False, endpoint=["http://localhost:8000/submit"])

@agent.on_event("startup")
async def introduce_agent(ctx: Context):
ctx.logger.info(f"ASI network address:{agent.wallet.address()}")
ledger_client = LedgerClient(NetworkConfig.fetch_mainnet())
address: str = agent.wallet.address()
balances = ledger_client.query_bank_all_balances(address)
ctx.logger.info(f"Balance of addr: {balances}")

if __name__ == "__main__":
agent.run()

```

**You must update the seed value, and store it safely. Losing this value will lose you your tokens.**

In the code example above an Agent named `alice` is initialized with a specified `name`, `port`, `endpoint`, and `seed`
parameters. When the Agent starts up, it logs the wallet address and queries the balance using the `LedgerClient` connected to the Fetch.ai Mainnet. Finally, the script runs the Agent, which processes the `startup` event and retrieves the balance, allowing the Agent to interact with the Fetch.ai network.

Once you run the above Agent script, you will see your Agent address and balance printed out. You will see something similar to the following output:

```
INFO: [alice]: Registration on Almanac API successful
INFO: [alice]: Registering on almanac contract...
INFO: [alice]: Registering on almanac contract...complete
INFO: [alice]: Agent inspector available at https://agentverse.ai/inspect/?uri=http%3A//127.0.0.1%3A8000&address=agent1qdxdrwqek4pt9xt8kggcxus0zm54d4vgdznrs6y5acn26paphervwfj7pdd
INFO: [alice]: Starting server on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO: [alice]: ASI network address:fetch1ujr7wyuvza7uwnkr3usv53hjlwjvu8s7l06vzf
INFO: [alice]: Balance of addr: []
```

You can now use this address to transfer your purchased FET tokens from the exchange to this Agent's address. This
should be as simple as withdrawing native FET, by selecting the Fetch.ai Mainnet network when withdrawing. Some
exchanges do not support Native FET, and you will need to use the [token bridge](https://token-bridge.fetch.ai/),
luckily we have [a guide for that too](/guides/fetch-network/how-to-convert-fet-to-and-from-erc20)

Check out the following resources for more information on Agents and how these integrate within the Fetch Ecosystem and perform operations using FET tokens:

- [Agents - uAgents Framework ↗️](/guides/agents/getting-started/whats-an-agent)
- [The Agentverse ↗️](/concepts/agent-services/agentverse-intro)
- [AI Engine ↗️](/concepts/ai-engine/ai-engine-intro)
- [DeltaV ↗️](/concepts/ai-engine/deltav)
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,6 @@ The overall script should look as follows:

### Run the script

If you are using a Poetry virtual environment, make sure that you have activated it.

On your terminal, run the script: `python my_agent.py`

The output should be as follows:
Expand Down
67 changes: 3 additions & 64 deletions pages/guides/agents/getting-started/installing-uagent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,15 @@ On your computer, you may need to install:

- [Python ↗️](https://www.python.org/downloads/) 3.8+.
- [PIP ↗️](https://pypi.org/project/pip/) - the Python package manager.
- [Poetry ↗️](https://python-poetry.org/) for virtual environments (optional).
- [uAgents library ↗️](https://pypi.org/project/uagents/)

## Install with Pip

1. Create a directory for your agents project: `mkdir directory_name`

2. Within the directory, create and open a virtual environment using Poetry: `poetry init -n && poetry shell`
2. Install Fetch.ai `uagents` library: `pip install uagents`

3. Install Fetch.ai `uagents` library: `pip install uagents`

4. Check if installation was successful: `pip show uagents`

<Callout type="info" emoji="ℹ️">
If you want to install a specific version of the `uagents` library (e.g., 0.12.0), you can do so by running the following:

`pip install uagents==0.12.0`

Current version of the uAgents package is <PackageVersion packageName="uagents" packageType="pypi" />.
</Callout>
3. Check if installation was successful: `pip show uagents`

## Install from source code

Expand Down Expand Up @@ -170,54 +159,4 @@ Let's now ensure the **global version of Python** you are working with is not th
```
pyenv global 3.10 # this sets the global interpreter
pyenv versions # this verifies if it is set up correctly
```

#### Installing Poetry

You now need to install **Poetry**. Poetry is used for managing Python project dependencies, handling virtual environments, packaging, and publishing Python libraries or applications.

You can install Poetry by running the following command:

```
curl -sSL https://install.python-poetry.org | python3 -
```

<Callout type="info" emoji="ℹ️">
If you would like to learn more about Poetry, visit the [website ↗️](https://python-poetry.org/docs/#installation) for further information.
</Callout>

#### Initialize your project with Poetry

You now have all necessary tools installed. You are ready to initialize your project! Let's create a working directory and initialize Poetry 🎉.

First, you need to create a working directory for your project using `mkdir` command. Then, you will need to change directory to this one, using `cd` command:

```
mkdir development/agent-demo
cd development/agent-demo
```

You can ensure you are in the correct directory by checking your current path:

```
pwd
# Example output: /Users/Jessica/Documents
```

If you are happy with the install location for the project, go ahead and **initialize Poetry**:

```
poetry init
```

<Callout type="info" emoji="ℹ️">
Follow the setup wizard to provide details including project name, version, author, license, and select dependencies (e.g., `uagents`).
</Callout>

Once you complete the initialization, run:

```
poetry install
```

This command will install the dependencies specified in the **pyproject.toml** file.
```
76 changes: 49 additions & 27 deletions pages/guides/agents/getting-started/whats-an-agent.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { Callout } from 'nextra/components'
import PackageVersion from 'components/package-version'
import { ImageByTheme } from "components/mdx"
import AgentsInteracting from 'src/images/concepts/ai-agents/Agents_interacting.png';
import DarkAgentsInteracting from 'src/images/concepts/ai-agents/Dark_agents_interacting.svg';
import DecentralisedNetwork from 'src/images/concepts/ai-agents/decentralised_network.png';
import DarkDecentralisedNetwork from 'src/images/concepts/ai-agents/Dark_decentralised_network.svg';
import PackageVersion from 'components/package-version'
import communication from 'src/images/concepts/tech/I2.svg';

# Agents - uAgents Framework

Expand All @@ -18,39 +15,64 @@ The **uAgents Framework** is a lightweight library designed to facilitate the de
Current version of the uAgents package is <PackageVersion packageName="uagents" packageType="pypi" />.
</Callout>

<ImageByTheme
darkSrc={DarkAgentsInteracting}
lightSrc={AgentsInteracting}
alt="agents-interacting"
/>

Agents built with the uAgents Framework are autonomous programs designed for decentralized interactions, with decentralization being optional. They can transform systems like supply chains by enhancing forecasting, logistics, supplier monitoring, and risk management, driving efficiency and accuracy. Developers can leverage these Agents to build intelligent, self-managed systems across various domains.
### Getting into Agents

Agents are programs designed to operate freely and communicate with whomever they're programmed to. Agents can connect, search, and transact in order to create dynamic markets, and they can be programmed to interact both within their environment and with other agents in the network. Because they're siloed, and decentralized they can safely accomplish particular activities and objectives without requiring human participation. We have a very simple guide in our documentation that gets you started on building an agent to be part [of the network ↗️](/guides/agents/getting-started/create-a-uagent).


At the simplest level, and agent would work as follows:

<ImageByTheme
darkSrc={DarkDecentralisedNetwork}
lightSrc={DecentralisedNetwork}
alt="decentralised-network"
darkSrc={communication}
lightSrc={communication}
alt="HighLevel-Diagram"
/>

## Why Agents

With the rise of Large Language Models (LLMs) and AI-driven tools, autonomous Agents are revolutionizing problem-solving, decision-making, and collaboration.

For instance, Agents operating in the financial sector are able to automate trading, risk assessment, fraud detection, and customer support. By leveraging predictive analytics, they analyze market trends, assess risks, and offer tailored advice. Continuous transaction monitoring enhances security and simplifies processes, providing valuable insights for better decision-making.
Of course, many agents in the above workflow can come together to become multi-agents workflows, where single Agents call one another to complete a task. Agents that you design could be programmed to contact known agents, whereas in a dynamic marketplace you may need an agent that you haven't created, searching and interacting with that agent may be the more optimal strategy.

Fetch.ai's uAgents Framework enables developers to create customizable Agents for decentralized networks, tailored to specific tasks and real-world challenges. These autonomous systems, powered by the Fetch network and the [AI Engine ↗️](/concepts/ai-engine/ai-engine-intro), collaborate to streamline tasks, solve complex problems, and improve decision-making across industries.

### Get started with Agents development!

Visit the [GitHub repository ↗️](https://github.com/fetchai/uAgents) for more information on the aforementioned topics.
. This will also keep you up-to-date with any update made to the uAgents Framework.
A simple Agent using the uAgents library could be:

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)!
```
from uagents import Agent, Context, Model
agent = Agent(name="concept", seed="secret_seed_phrase_concept", endpoint="127.0.0.1", port="8001")
<Callout type="info" emoji="ℹ️">
If you wish to create AI Engine compatible Agents, you will need to get the `uagents-ai-engine` package installed. Check out the [package ↗️](https://pypi.org/project/uagents/) to download it and start developing your AI Engine compatible Agents.
class Message(Model):
message : str
Also, do not miss the [Make your agents AI Engine compatible ↗️](/guides/agents/intermediate/ai-engine-compatible-agent) resource to get yourself started!
</Callout>
@agent.on_message(model=Message)
async def print_message(ctx: Context, msg : Message):
ctx.logger.info(f"Message received: {msg.message}")
if __name__ == "__main__":
agent.run()
```

This Agent defines its communication method as receiving any Object of `Class Message`, with a value for `message` of type `string`. You can see how this agent behaves, and how to extend this in [our guides ↗️](/guides)


Agents are lightweight programs that can be inserted to existing systems with the ability to simplify the way we see complicated systems. As an 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.

You can view the source code for an Agent that monitors inventory levels in [our examples ↗️](https://github.com/fetchai/uAgent-Examples/blob/main/3-applications/inventory-monitoring/src/main.py)

Agents thrive on IoT devices such as Raspberry Pi, and there are some great examples of multi-agent simulations using Agents on Raspberry Pi available on [Github ↗️](https://github.com/Agents-Lab/sensor-agent).


#### LLMs

Agents can wrap and orchestrate LLMs to create personalized Agents for any task. With the rise of Large Language Models (LLMs) and AI-related products, autonomous intelligent Agents have become the link between these models and tools. They are revolutionizing the way we solve problems, make decisions and collaborate with each other.

Integrating LLMs into an Agent is relatively trivial, [we have a guide for that too ↗️](/guides/agents/intermediate/langchain-rag-agent)


### Getting started with Agent development!

Visit the [GitHub repository ↗️](https://github.com/fetchai/uAgents) to see the source code for uAgents, and to keep up-to-date with any update made to the uAgents Framework.

The Team is available on [Telegram ↗️](https://t.me/fetch_ai) and [Discord ↗️](https://discord.gg/fetchai) channels for any further inquiries.
From there, view the examples on uAgents repository, or start reading our guides, we'd recommend starting with [agent to agent communication ↗️](/guides/agents/intermediate/communicating-with-other-agents).
Loading

0 comments on commit 4c22168

Please sign in to comment.