Skip to main content

CrewAI tools for x402 payments - let crews pay for APIs autonomously

Project description

crewai-nory

CrewAI tools for x402 payments - Let your agent crews pay for APIs autonomously.

PyPI version License: MIT

Overview

crewai-nory provides CrewAI tools that enable your agent crews to:

  • Pay for x402-protected APIs automatically when they encounter HTTP 402 responses
  • Access pre-built paid APIs for crypto prices, weather, translation, and more
  • Make direct payments to any Solana or EVM wallet

All payments use USDC stablecoin on Solana (~400ms settlement).

Installation

pip install crewai-nory

Quick Start

from crewai import Agent, Task, Crew
from crewai_nory import get_nory_tools

# Get all Nory tools (uses NORY_WALLET_KEY env var)
tools = get_nory_tools()

# Create an agent with payment capabilities
researcher = Agent(
    role="Market Researcher",
    goal="Get real-time cryptocurrency market data",
    backstory="You are an expert market analyst with access to premium data sources.",
    tools=tools,
    verbose=True
)

# Create a task
task = Task(
    description="Get the current prices of Bitcoin, Ethereum, and Solana. Analyze the 24h changes.",
    expected_output="A summary of current prices and market trends",
    agent=researcher
)

# Run the crew
crew = Crew(agents=[researcher], tasks=[task])
result = crew.kickoff()
print(result)

Available Tools

Tool Description Cost per request
NoryPaymentTool Fetch any URL with automatic x402 payment Varies
NoryCryptoPricesTool Real-time crypto prices (BTC, ETH, SOL, etc.) $0.001
NoryWeatherTool Weather + 7-day forecast for any city $0.002
NoryTranslateTool Translate between 20+ languages $0.005
NoryQRCodeTool Generate QR codes $0.001
NoryWebSummaryTool Extract text from any webpage $0.01

Environment Variables

export NORY_WALLET_KEY="your-solana-private-key"

Individual Tool Usage

from crewai_nory import NoryCryptoPricesTool

# Use individually
crypto_tool = NoryCryptoPricesTool(wallet_key="your-key")
prices = crypto_tool.run("BTC,ETH,SOL")

Multi-Agent Example

from crewai import Agent, Task, Crew, Process
from crewai_nory import get_nory_tools

tools = get_nory_tools()

# Research agent with payment capabilities
researcher = Agent(
    role="Market Researcher",
    goal="Gather real-time market data",
    tools=tools
)

# Analyst agent (no tools needed, analyzes data from researcher)
analyst = Agent(
    role="Market Analyst",
    goal="Analyze market data and provide insights"
)

# Writer agent
writer = Agent(
    role="Report Writer",
    goal="Write clear, actionable market reports"
)

# Sequential tasks
research_task = Task(
    description="Get current prices for top 10 cryptocurrencies",
    agent=researcher
)

analysis_task = Task(
    description="Analyze the market data and identify trends",
    agent=analyst
)

report_task = Task(
    description="Write a concise market report",
    agent=writer
)

crew = Crew(
    agents=[researcher, analyst, writer],
    tasks=[research_task, analysis_task, report_task],
    process=Process.sequential
)

result = crew.kickoff()

How It Works

  1. Your agent requests a paid API endpoint
  2. Server returns 402 Payment Required with payment requirements
  3. NoryPaymentTool creates and signs a USDC transfer on Solana
  4. Payment settles in ~400ms
  5. Agent retries request with payment proof
  6. Server verifies and returns data

All of this happens automatically - agents just use the tools normally.

Links

License

MIT

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

crewai_nory-0.1.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

crewai_nory-0.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file crewai_nory-0.1.0.tar.gz.

File metadata

  • Download URL: crewai_nory-0.1.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for crewai_nory-0.1.0.tar.gz
Algorithm Hash digest
SHA256 060a5313d1678e3890a732b783a7449d909a5b364290a278954dd71f00024530
MD5 03f84067482b77c9802502cf180c997d
BLAKE2b-256 54e324b1e0e9e6b17f7ea3203a0bd17b14fcad092c63437ffd9a7c1df01f4679

See more details on using hashes here.

File details

Details for the file crewai_nory-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: crewai_nory-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for crewai_nory-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 913607d24d3911e5cb79572fe18bcfa2bc252391a57d8fbe0ef5daab93dd107d
MD5 1194417b7884b9e068822f4b41df96dd
BLAKE2b-256 38286f89ac1ed034d6b14274c541a469af4d5e94d59bce8f612ecf17ff5b3b4a

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