Skip to content

feat: add AgentPay x402 payment tools for ADK agents #107

@up2itnow0822

Description

@up2itnow0822

Summary

Add AgentPay payment tools that enable ADK agents to make autonomous HTTP payments using the x402 protocol (HTTP 402 Payment Required → automatic on-chain payment → retry).

Motivation

AI agents increasingly need to call paid APIs and make micropayments autonomously. The x402 protocol provides a standard machine-to-machine payment flow. AgentPay provides non-custodial smart contract wallets with on-chain spend limits that protect against runaway agent behavior — essential for safe autonomous payment.

This was previously submitted to google/adk-python (PR #4937), where reviewer @rohityan correctly redirected it here with the note: "We highly recommend releasing the feature as a standalone package that we will then share through https://google.github.io/adk-docs/integrations/"

The standalone packages already exist on npm:

Proposed Tools

Tool Description
fetch_paid_api Fetch a URL; auto-pay x402 HTTP 402 challenge if needed
get_wallet_info Return wallet address, USDC balance, spend limits, remaining allowance
check_spend_limit Pre-check whether a payment is within on-chain spend limits
send_payment Send USDC directly to an address within spend policy

Technical Details

  • Chain: Base (live), multi-chain coming
  • Token: USDC
  • Protocol: x402 / HTTP 402
  • Non-custodial: smart contract wallet owned via NFT
  • Spend limits: enforced on-chain before any transaction is signed
  • Transport: MCP stdio subprocess (standard MCP protocol)

Files to be Added

contributing/tools/agentpay/README.md
src/google/adk_community/tools/__init__.py
src/google/adk_community/tools/agentpay/__init__.py
src/google/adk_community/tools/agentpay/agentpay_tools.py
tests/unittests/tools/__init__.py
tests/unittests/tools/agentpay/__init__.py
tests/unittests/tools/agentpay/test_agentpay_tools.py

Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions