Metadata-Version: 2.4
Name: crewai-nory
Version: 0.1.0
Summary: CrewAI tools for x402 payments - let crews pay for APIs autonomously
Author-email: Nory <hello@noryx402.com>
License: MIT
Project-URL: Homepage, https://noryx402.com
Project-URL: Documentation, https://noryx402.com/docs
Project-URL: Repository, https://github.com/TheMemeBanker/crewai-nory
Keywords: crewai,ai-agents,payments,x402,solana,usdc,micropayments,autonomous-agents,multi-agent
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Office/Business :: Financial
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: crewai>=0.28.0
Requires-Dist: requests>=2.28.0
Requires-Dist: pydantic>=2.0.0

# crewai-nory

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

[![PyPI version](https://badge.fury.io/py/crewai-nory.svg)](https://pypi.org/project/crewai-nory/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/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

```bash
pip install crewai-nory
```

## Quick Start

```python
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

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

## Individual Tool Usage

```python
from crewai_nory import NoryCryptoPricesTool

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

## Multi-Agent Example

```python
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

- **Website**: [noryx402.com](https://noryx402.com)
- **Documentation**: [noryx402.com/docs](https://noryx402.com/docs)
- **x402 Protocol**: [github.com/coinbase/x402](https://github.com/coinbase/x402)
- **npm packages**: [nory-x402-payer](https://npmjs.com/package/nory-x402-payer) | [nory-mcp-server](https://npmjs.com/package/nory-mcp-server)

## License

MIT
