Skip to content

tools: Add Nory x402 payment tools for AI agents#4393

Open
TheMemeBanker wants to merge 2 commits intocrewAIInc:mainfrom
TheMemeBanker:add-nory-x402-tools
Open

tools: Add Nory x402 payment tools for AI agents#4393
TheMemeBanker wants to merge 2 commits intocrewAIInc:mainfrom
TheMemeBanker:add-nory-x402-tools

Conversation

@TheMemeBanker
Copy link

@TheMemeBanker TheMemeBanker commented Feb 6, 2026

Summary

Added tools for AI agents to make payments using the x402 HTTP protocol:

  • NoryPaymentRequirementsTool: Get payment requirements for a resource
  • NoryVerifyPaymentTool: Verify a signed payment before settlement
  • NorySettlePaymentTool: Submit payment to blockchain (~400ms)
  • NoryTransactionLookupTool: Look up transaction status
  • NoryHealthCheckTool: Check service health

Why

As AI agents become more autonomous, they need to interact with the real economy. When an agent encounters an HTTP 402 "Payment Required" response, these tools enable it to:

  1. Get payment requirements (amount, networks, wallet address)
  2. Verify a signed transaction
  3. Settle the payment on-chain
  4. Retry the original request

Example Usage

from crewai import Agent, Task, Crew
from crewai_tools import NoryPaymentRequirementsTool, NorySettlePaymentTool

payment_agent = Agent(
    role="Payment Handler",
    goal="Handle payment requests for premium APIs",
    tools=[NoryPaymentRequirementsTool(), NorySettlePaymentTool()],
)

Supported Networks

  • Solana (mainnet/devnet) - sub-400ms settlement
  • Base, Polygon, Arbitrum, Optimism, Avalanche, Sei, IoTeX

Links

AI Disclosure

This contribution was developed with assistance from Claude Code (AI pair programming).


Note

Medium Risk
Adds new networked tooling that can initiate on-chain payment settlement via an external API, so failures/misuse impact cost and reliability despite being mostly additive changes.

Overview
Adds a new nory_x402_tool package that lets agents programmatically handle x402 paywalls via the Nory API: fetching payment requirements, verifying and settling signed payments, looking up transaction status, and performing a service health check.

Exports the five new tools (NoryPaymentRequirementsTool, NoryVerifyPaymentTool, NorySettlePaymentTool, NoryTransactionLookupTool, NoryHealthCheckTool) from the top-level crewai_tools and crewai_tools.tools modules, and includes a README documenting usage and the optional NORY_API_KEY env var.

Written by Cursor Bugbot for commit 1fd450f. This will update automatically on new commits. Configure here.

Added tools for AI agents to make payments using the x402 HTTP protocol:
- NoryPaymentRequirementsTool: Get payment requirements for a resource
- NoryVerifyPaymentTool: Verify a signed payment before settlement
- NorySettlePaymentTool: Submit payment to blockchain (~400ms)
- NoryTransactionLookupTool: Look up transaction status
- NoryHealthCheckTool: Check service health

Supports Solana and 7 EVM chains (Base, Polygon, Arbitrum, Optimism,
Avalanche, Sei, IoTeX) with sub-400ms settlement.

This enables CrewAI agents to handle HTTP 402 Payment Required
responses programmatically.

API: https://noryx402.com
Docs: https://github.com/TheMemeBanker/x402-pay
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@TheMemeBanker
Copy link
Author

Hi team! Following up on this PR. I'd love to get this merged so CrewAI users can easily integrate blockchain payments into their agent workflows. The x402 protocol enables sub-400ms settlements which works well for real-time agent interactions. Happy to make any changes needed to align with CrewAI's patterns!

- URL-encode transaction_id in path parameter to prevent injection
- Add Nory tools to __all__ exports in tools/__init__.py
- Add Nory tools to main package crewai_tools/__init__.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@TheMemeBanker
Copy link
Author

Thanks for the Bugbot review! All three issues have been addressed in commit 1fd450f:

  1. URL encoding - transaction_id is now encoded using quote(transaction_id, safe="") before being used in the URL path (line 238)
  2. __all__ exports - All 5 Nory tools are now included in tools/__init__.py __all__ list (lines 238-242)
  3. Main package exports - All 5 Nory tools are now imported and exported in crewai_tools/__init__.py (lines 103-109 and 254-258)

The imports from crewai_tools import NoryPaymentRequirementsTool will work as documented in the README.

@TheMemeBanker
Copy link
Author

Quick update: We've just published nory-mcp-server to the official MCP registry (io.github.TheMemeBanker/nory-x402), which means Claude and other MCP-compatible agents can now discover and use Nory for payments. This CrewAI integration would complement that nicely, giving CrewAI users the same payment capabilities. All Cursor Bugbot suggestions have been addressed. Ready for review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant