Simple infrastructure to enable payments for AI agents
Project description
AI Agents Blockchain Payment System
Overview
This project demonstrates the integration of AI agents with blockchain technology, specifically focusing on facilitating autonomous payments using USDC. By creating a network of specialized AI agents using the AutoGen framework and managing payments via Circle's Programmable Wallets, this system autonomously executes research tasks and compensates agents based on their contributions.
Features
- Multi-Agent System: Deploys multiple AI agents, each with specific roles like Admin, Engineer, Scientist, Planner, Executor, and Critic to collaboratively handle research tasks.
- Blockchain Payments: Implements Programmable Wallets to execute secure payments in USDC using Circle’s Web3 Services.
- Environment Setup: Detailed instructions on setting up the development environment for the project using Python and Node.js.
Structure
ai_agents_project/
├── ai_research.py # Handles AI research tasks and agent orchestration
├── circle_payment.js # Manages blockchain payments via Circle's Programmable Wallets
├── main.py # Main script to execute the research and payment workflow
├── .env # Environment variables for API keys
└── OAI_CONFIG_LIST # Configuration for OpenAI models
Prerequisites
- Python (3.9 or later)
- Node.js (v20.17.0 or later)
- API Keys from Circle’s Developer Console: Obtain your API keys by visiting Circle’s Developer Console.
Environment Setup
Python Setup
- Install Python and create a virtual environment:
mkdir ai_agents_project cd ai_agents_project python -m venv ai_agents_env source ai_agents_env/bin/activate # On Windows use: ai_agents_env\Scripts\activate
- Install necessary Python packages:
pip install autogen python-dotenv
Node.js Setup
- Create a new Node.js project:
npm init -y
- Install Circle's Developer-Controlled Wallets SDK:
npm install @circle-fin/developer-controlled-wallets --save
Configuration
- Create a
.envfile in the project root and add your API keys. To test in Replit, use the Replit Secret Keys feature:OPENAI_API_KEY=your_openai_api_key CIRCLE_API_KEY=your_circle_api_key CIRCLE_ENTITY_SECRET=your_circle_entity_secret - Create an
OAI_CONFIG_LISTfile containing necessary OpenAI configurations:[ { "model": "gpt-4o", "api_key": "${OPENAI_API_KEY}" } ]
Usage
To run the entire project, execute the following command:
python3 main.py
Key Scripts
ai_research.py: Contains logic to create and manage the AI agents that contribute to research tasks.circle_payment.js: Implements blockchain payment processing, including wallet creation, transaction processing, and validation of payments received by AI agents.main.py: Orchestrates the execution of the research tasks and the payment processing.
Key Functions
- AI Research: Managed by the function defined in
ai_research.py, which initiates conversations among AI agents and collaborates on tasked workflows. - Blockchain Payments: Handled by the functions in
circle_payment.js, which encompass creating wallets, checking balances, and processing transactions.
Running the Project
- Execute the project by running
main.py. It will perform AI research on the topic defined in the script and handle all wallet interactions and payments through the Circle API. - Monitor the logs in the terminal for real-time feedback regarding agent contributions and payment confirmations.
Conclusion
This project shows the synergy between AI and blockchain, providing a foundational framework for building autonomous payment systems. By leveraging the power of AI agents and blockchain technology, this system opens pathways for automating workflows and transactions in diverse applications.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agent_payments-0.1.0.tar.gz.
File metadata
- Download URL: agent_payments-0.1.0.tar.gz
- Upload date:
- Size: 102.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9364e2ace3b9f9c0bb5c04ac4cbd28e869a6d2c751e617b2a1c60514685357a6
|
|
| MD5 |
2e98dc2e45c2dba6722b40c8a493d433
|
|
| BLAKE2b-256 |
9d31c6d1777e8d7100a1d88424fc33b6bfaa337fdf5d82288ad28ba459b9fc3b
|
File details
Details for the file agent_payments-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agent_payments-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
adac7454fb68711196cbea5725d04cafcd47923b0a34bba5794f445a71079d59
|
|
| MD5 |
ce0cb1322e52404b465f3822501632b0
|
|
| BLAKE2b-256 |
e4658a478772898f75fc11a6875d2094146c983f2b09d08f8fab5420c4fb9e24
|