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.21.tar.gz (15.9 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.21-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: masumi_crewai-0.1.21.tar.gz
  • Upload date:
  • Size: 15.9 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.21.tar.gz
Algorithm Hash digest
SHA256 4f6fe86e1729427dbca06f9f847316589275ff431d7e775f06181bc581bddbc7
MD5 c3d022537e241c9e75831689b05f0c3e
BLAKE2b-256 0456450e03b4eac41192e4e35e0555dd6547c81fa1ce0264d8510b15ade97bcd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: masumi_crewai-0.1.21-py3-none-any.whl
  • Upload date:
  • Size: 11.3 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.21-py3-none-any.whl
Algorithm Hash digest
SHA256 63ceaf95bd4252329f79c14f848d887dc41c785b84662c1c39965ea9db2e7bba
MD5 ddbc4b74d65ce5d34d8a46f400f62097
BLAKE2b-256 546a425eb1df851b60534dcb1cb4140ffcc1a1e8cc5b7e9a1776f9ee51b6e781

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