uAgents is a library developed by Fetch.ai that allows for creating autonomous AI agents in Python. With simple and expressive decorators, you can have an agent that performs various tasks on a schedule or takes action on various events.
- 🤖 Easy creation and management: Create any type of agent you can think of and put into code.
- 🔗 Connected: On startup, each agent automatically joins the fast growing network of uAgents by registering on the Almanac, a smart contract deployed on the Fetch.ai blockchain.
- 🔒 Secure: uAgent messages and wallets are cryptographically secured, so their identities and assets are protected.
Get started with uAgents by installing it for Python 3.8, 3.9, 3.10, or 3.11:
cd python
poetry install
poetry shell
Build your first uAgent using the following script:
from uagents import Agent, Context
alice = Agent(name="alice", seed="alice recovery phrase")
Include a seed parameter when creating an agent to set fixed addresses, or leave it out to generate random addresses each time.
Give it a simple task, such as greeting:
@alice.on_interval(period=2.0)
async def say_hello(ctx: Context):
ctx.logger.info(f'hello, my name is {ctx.name}')
if __name__ == "__main__":
alice.run()
So far, your code should look like this:
from uagents import Agent, Context
alice = Agent(name="alice", seed="alice recovery phrase")
@alice.on_interval(period=2.0)
async def say_hello(ctx: Context):
ctx.logger.info(f'hello, my name is {ctx.name}')
if __name__ == "__main__":
alice.run()
Run it using:
python agent.py
You should see the results in your terminal.
Please see the official documentation for full setup instructions and advanced features.
- 👋 Introduction
- 💻 Installation
- 🏃 Running an agent
- Tutorials
- Key Concepts:
The examples
folder contains several examples of how to create and run various types of agents.
Go to the python
folder for details on the Python uAgents library.
All contributions are welcome! Remember, contribution includes not only code, but any help with docs or issues raised by other developers. See our contribution guidelines for more details.
Read our development guidelines to learn some useful tips related to development.
We use GitHub Issues for tracking requests and bugs, and GitHub Discussions for general questions and discussion.
This project, μAgent, is provided "as-is" without any warranty, express or implied. By using this software, you agree to assume all risks associated with its use, including but not limited to unexpected behavior, data loss, or any other issues that may arise. The developers and contributors of this project do not accept any responsibility or liability for any losses, damages, or other consequences that may occur as a result of using this
The uAgents project is licensed under Apache License 2.0.