Skip to content

Idea: x402 payment support for ADK agents — let agents autonomously pay for premium tools & A2A services with USDC #6542

Description

@minia2a

Problem

ADK agents can discover and call tools, but there is no built-in mechanism for agents to pay for premium API access or agent-to-agent services. Agents hit rate limits, get blocked by paywalls, or need manual API key provisioning — all of which break autonomous operation.

Google ADK already supports A2A (Agent-to-Agent) communication. But A2A without a payment layer means agents can talk but cannot transact. An agent that discovers another agent's service has no way to pay for it.

Proposal: google-adk-x402 integration

Add an optional x402 payment tool that lets ADK agents:

  1. Detect HTTP 402 Payment Required responses from any API
  2. Evaluate the price against configured budgets
  3. Pay in USDC on Base L2 (sub-cent transaction fees)
  4. Retry with payment proof to get the resource

How it fits ADK

ADK's tool system already supports custom Tool implementations. An x402 wrapper could be:

from google.adk.tools import Tool
from x402 import pay

class X402Tool(Tool):
    """Wrap any HTTP endpoint with automatic x402 payment handling."""
    
    async def run(self, args):
        response = await fetch(args["url"])
        if response.status == 402:
            payment = await pay(response.headers["x402-requirements"])
            response = await fetch(args["url"], payment_proof=payment)
        return response.json()

Live ecosystem

The x402 protocol is already live in production:

  • 174 payable services on minia2a.uk (on-chain data, web scraping, token security, email verification, sentiment analysis, etc.)
  • 115 registered agents actively discovering services
  • 298K+ requests processed
  • USDC on Base L2 — sub-cent fees, instant settlement
  • Protocol spec: https://docs.x402.org

Why this matters for ADK

ADK is Google's official agent framework with A2A support. Adding a payment layer makes A2A economically viable — agents can not just discover each other, but pay each other for services. This is the missing piece for a true agent economy.

Scope

  • An optional google-adk-x402 package (not in core — keeps deps lean)
  • A payment_tool that wraps any HTTP endpoint with x402 pay-and-retry
  • Budget/policy configuration matching ADK's existing safety patterns
  • Example: financial-advisor agent paying for real-time price oracle data

Would love to discuss or help prototype. The x402 protocol is open (Apache 2.0) and has client libraries available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    spam[Status] Issues suspected of having comments which are spam

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions