Skip to main content

A package for easily interacting with remote crews via the Masumi protocol.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Masumi CrewAI Payment Module

This repository provides an implementation of Masumi blockchain-based payments, enabling AI agents using CrewAI to interact with the Masumi network for seamless payments, transaction logging, and monitoring.

🚀 Installation

To install the package, ensure you have Python 3.8+ and pip installed. Then, run:

pip install pip-masumi-crewai

🔧 Usage

The Payment class in payment.py provides functionality to send and track payments on the Cardano blockchain using the Masumi network.

Importing and Initializing

from masumi_crewai.payment import Payment, Amount
from masumi_crewai.config import Config

# Initialize configuration
config = Config(payment_api_key="your_api_key_here", payment_service_url="https://api.masumi.network")

# Define payment amounts
amounts = [Amount(amount=1000000, unit="lovelace")]

# Initialize Payment instance
payment = Payment(agent_identifier="agent_123", amounts=amounts, config=config)

Creating a Payment Request

import asyncio

async def main():
    response = await payment.create_payment_request()
    print(f"Payment Request Created: {response}")

asyncio.run(main())

Checking Payment Status

async def check_status():
    status = await payment.check_payment_status()
    print(f"Payment Status: {status}")

asyncio.run(check_status())

Completing a Payment

async def complete():
    transaction_hash = "your_transaction_hash_here"
    payment_id = "your_payment_id_here"
    response = await payment.complete_payment(payment_id, transaction_hash)
    print(f"Payment Completed: {response}")

asyncio.run(complete())

Monitoring Payments

async def payment_callback(payment_id):
    print(f"Payment {payment_id} confirmed!")

async def start_monitoring():
    await payment.start_status_monitoring(payment_callback)

asyncio.run(start_monitoring())

To stop monitoring:

payment.stop_status_monitoring()

🧪 Running Tests

To ensure everything is working as expected, you can run the test suite using:

pytest tests/test_masumi.py -v -s

Make sure you have pytest installed:

pip install pytest

📖 Documentation

For more details, check out the official Masumi documentation:

📚 Masumi Docs

🌐 Masumi Network

For more information about the Masumi Network and its capabilities, visit:

🔗 Masumi Website

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

masumi_crewai-0.1.20.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

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

masumi_crewai-0.1.20-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file masumi_crewai-0.1.20.tar.gz.

File metadata

  • Download URL: masumi_crewai-0.1.20.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for masumi_crewai-0.1.20.tar.gz
Algorithm Hash digest
SHA256 6be9bef6f77497bc15b7cfa051ea88c37681e0a0fb9cd6860e5ac651061ed49e
MD5 4515c8326b1621c768274fabefde90fa
BLAKE2b-256 63813937a61df4a9411ade017ca35bec63042076b2987b75860b64b51f94b645

See more details on using hashes here.

File details

Details for the file masumi_crewai-0.1.20-py3-none-any.whl.

File metadata

  • Download URL: masumi_crewai-0.1.20-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for masumi_crewai-0.1.20-py3-none-any.whl
Algorithm Hash digest
SHA256 7ecc5542f8c98e1b43a84c265906b4f6474c29f2d95e36a4af049d13174733b2
MD5 6d0f38b859acb5726200b51516d348ea
BLAKE2b-256 968385f4140219e3d9a61b61d364f90c638d9910d95a8b8359c575b90a76a2a4

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