Skip to main content

Lightweight framework for rapid agent-based development

Project description

uAgents: AI Agent Framework

Official Website GitHub Repo stars Twitter Follow Ruff Tests PyPI - Python Version

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.

🚀 Features

  • 🤖 Easy creation and management: Create any type of agent you can think of and implement it in 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.

⚡ Quickstart

Installation

Get started with uAgents by installing it for Python 3.10 to 3.13:

pip install uagents

Running a Demo

Creating an Agent

Build your first uAgent using the following script:

from uagents import Agent, Context
alice = Agent(name="alice")

Include a seed parameter when creating an agent to set a fixed address, for example from an environment variable:

import os
alice = Agent(name="alice", seed=os.getenv("ALICE_SEED_PHRASE"))

Otherwise the agent's private key will be stored locally alongside its name in private_keys.json. If you create the agent without a name alice = Agent(), a new address will be generated each time you run the agent.

Giving it a task

Give it a simple task, such as a greeting:

@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()

Running the Agent

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.agent.name}')

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

Run it using:

python agent.py

You should see the results in your terminal.

📖 Documentation

Please see the official documentation for full setup instructions and advanced features.

🌱 Examples and Integrations

The uAgent-Examples repository contains several examples of how to create and run various types of agents as well as more intricate integrations. This is the official place for internal and community open source applications built on uAgents.

Python Library

Go to the python folder for details on the Python uAgents library.

uAgents Core

The uagents-core folder contains core definitions and functionalities to build 'agent' like software which can interact and integrate with Fetch.ai ecosystem and agent marketplace.

✨ Contributing

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.

📄 Development Guidelines

Read our development guidelines to learn some useful tips related to development.

❓ Issues, Questions, and Discussions

We use GitHub Issues for tracking requests and bugs, and GitHub Discussions for general questions and discussion.

🛡 Disclaimer

This project, uAgents, 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 software.

License

The uAgents project is licensed under Apache License 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uagents-0.25.2.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uagents-0.25.2-py3-none-any.whl (83.2 kB view details)

Uploaded Python 3

File details

Details for the file uagents-0.25.2.tar.gz.

File metadata

  • Download URL: uagents-0.25.2.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for uagents-0.25.2.tar.gz
Algorithm Hash digest
SHA256 fda551c07226c0b69423886cd6dfd0e78746b1e8015c4dd626a5dd11a9872d24
MD5 15559fb27657b2c1944c6a8bd15a9fff
BLAKE2b-256 9efaf4eee0f3cb754e87292905aab0035fe9eca6873224e0c602eac60e1fd7c4

See more details on using hashes here.

File details

Details for the file uagents-0.25.2-py3-none-any.whl.

File metadata

  • Download URL: uagents-0.25.2-py3-none-any.whl
  • Upload date:
  • Size: 83.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for uagents-0.25.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e41d2ad6a1037ebcba6455b79af4f424916ef6844398ec7c10e95622b319ac19
MD5 1194a9c1fb5e9180e5517599025ad78f
BLAKE2b-256 7a0d273ce1b2d8d7a0be4a3d8a14c62b20ed36a5b11ff40ad21f0aff22ec77c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page