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.22.tar.gz (16.3 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.22-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: masumi_crewai-0.1.22.tar.gz
  • Upload date:
  • Size: 16.3 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.22.tar.gz
Algorithm Hash digest
SHA256 6b2ac9429cb52bdee661083e678e9aa4ce6ad10d072904a666c9440b01481941
MD5 dca38475a040f142096a2c9d3e62d281
BLAKE2b-256 ff79f2c9610586088a44c2bb3c532c3ee334323dbe19f50ba1975fa83e016fe5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: masumi_crewai-0.1.22-py3-none-any.whl
  • Upload date:
  • Size: 11.9 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.22-py3-none-any.whl
Algorithm Hash digest
SHA256 763d46565c7193c82b199249f39f4fe658564d71975a081cef88a2f959b91713
MD5 d4ea9dc0691bcfe080408eaa9f195505
BLAKE2b-256 32f686f269d805fcb80df5fbec9d631e918ef5b463939a236348dcb05b6d5172

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