feat(tools): add AgentPay x402 payment tools for ADK agents#108
Open
up2itnow0822 wants to merge 1 commit intogoogle:mainfrom
Open
feat(tools): add AgentPay x402 payment tools for ADK agents#108up2itnow0822 wants to merge 1 commit intogoogle:mainfrom
up2itnow0822 wants to merge 1 commit intogoogle:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Author
|
CLA has been signed at https://cla.developers.google.com/ — please re-run the CLA check. |
Adds AgentPay tools that enable ADK agents to make autonomous HTTP payments using the x402 protocol (HTTP 402 Payment Required). Tools added: - fetch_paid_api: Fetch a URL, auto-paying any x402 402 challenge - get_wallet_info: Return wallet address, USDC balance, spend limits - check_spend_limit: Pre-check payment against on-chain spend limits - send_payment: Send USDC directly within autonomous spend policy Implementation wraps the agentpay-mcp MCP server via stdio subprocess (standard MCP transport). No custodian; non-custodial smart contract wallet on Base. Spend limits enforced on-chain before any signing. Standalone package: npm: https://www.npmjs.com/package/agentpay-mcp (patent pending) sdk: https://www.npmjs.com/package/agentwallet-sdk See contributing/tools/agentpay/README.md for setup and usage.
7e17376 to
0ef169e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #107
Summary
agentpay-mcpon npm (patent pending)agentwallet-sdkfetch_paid_api,get_wallet_info,check_spend_limit,send_paymentWhat is AgentPay / x402?
x402 is an open protocol that revives HTTP's original
402 Payment Requiredstatus code for machine-to-machine micropayments. When an agent hits a paid API, the server returns HTTP 402 with payment details. The agent's wallet pays automatically on-chain and retries — zero manual intervention.AgentPay is a non-custodial smart contract wallet system for AI agents:
Tools Added
fetch_paid_apiget_wallet_infocheck_spend_limitsend_paymentUsage
Requirements
Implementation Notes
agentpay-mcpMCP server via stdio subprocess (standard MCP transport)AGENTPAY_PRIVATE_KEYnot setTesting Plan
Unit tests mock
subprocess.runandshutil.whichto avoid requiring Node.js or a real wallet. Tests cover:AGENTPAY_PRIVATE_KEY→ clear error for all 4 toolsfetch_paid_apiwith and without x402 paymentcheck_spend_limit— allowed and blocked cases__all__completenessPytest Results
Links