uAgents: AI Agent Framework
uAgents is a powerful library created by Fetch.ai to help developers build autonomous AI agents using Python. With ease of use at its core, uAgents allows you to create agents that can handle various tasks, automate processes, and react to different events efficiently.
π Features
- Easy Creation and Management: uAgents makes it straightforward to create any kind of agent you want and implement them directly in your code.
- Connected Network: When initialized, each agent becomes part of the rapidly expanding uAgents network by registering on the Almanac, a smart contract on the Fetch.ai blockchain.
- Security First: All messages and wallets within uAgents are secured with cryptographic methods, ensuring the protection of identities and assets.
β‘ Quickstart
Installation
To start using uAgents, you need to install it for Python versions 3.9 to 3.12. You can do this by running the following command:
pip install uagents
Running a Demo
You can create your first uAgent and assign a task by following these steps:
-
Creating an Agent:
You begin by building an agent, like so:
from uagents import Agent, Context alice = Agent(name="alice", seed="alice recovery phrase")
The seed parameter helps set a fixed address for consistency, or you can omit it to generate a new random address every time.
-
Giving it a Task:
You can assign a simple task to the agent, such as greeting:
@alice.on_interval(period=2.0) async def say_hello(ctx: Context): ctx.logger.info(f'hello, my name is {ctx.agent.name}')
-
Running the Agent:
Compile everything:
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.agent.name}') if __name__ == "__main__": alice.run()
Execute the script using:
python agent.py
You'll observe the agent's activity in your terminal.
π Documentation
For comprehensive instructions and advanced features, visit the official documentation. Here are some useful links:
- Introduction to agents
- Detailed installation instructions
- Tutorials for creating and communicating with agents
- Various demo scenarios and key concepts
π± Examples and Integrations
Explore the examples
directory to see different uses of agents. The integrations
directory offers deeper insights into using the uAgents library.
β¨ Contributing and Development
Fetch.ai welcomes all forms of contribution, be it code, documentation, or issue resolutions. The contribution guidelines provide more details. Developers can also refer to development guidelines for further insights.
β Community and Support
For questions or discussion, refer to GitHub Issues and GitHub Discussions.
π‘ Disclaimer
uAgents is provided "as-is" without warranties. Users assume all risks, and developers hold no liability for any problems that might arise.
License
The uAgents project is open-source and licensed under the Apache License 2.0.