a2a-x402
The A2A x402 Extension brings cryptocurrency payments to the Agent-to-Agent (A2A) protocol, enabling agents to monetize their services through on-chain payments. This extension revives the spirit of HTTP 402 "Payment Required" for the decentralized agent ecosystem.
claude mcp add --transport stdio google-agentic-commerce-a2a-x402 python -m x402_a2a \ --env A2A_X402_NETWORK="mainnet or testnet placeholder" \ --env A2A_X402_PRIVATE_KEY="your-private-key (securely stored)" \ --env A2A_X402_RPC_ENDPOINT="https://example-rpc-endpoint"
How to use
A2A x402 is an extension that enables agent-to-agent services to be paid on-chain using the x402 protocol. It provides a library (primarily Python in this repo) that implements core payment data structures, signing/verification utilities, and executors to automate the payment flow. To use it, integrate the x402_a2a library into your A2A agent so that when you offer a paid capability, your agent can respond with a payment-required message, accept a payment-submitted message from the client, and finalize with a payment-completed message. The repository also includes example applications demonstrating how to wire the library into real agents and how to invoke typical payment flows. In short, you can convert any A2A agent into a commercial service by wiring in the x402 core and executors to handle on-chain payments for API calls, data processing, AI inference, or other valuable services.
How to install
Prerequisites:
- Python 3.8+ and pip
- Git
- Virtual environment (recommended)
Install steps:
-
Clone the repository: git clone https://github.com/your-org/google-agentic-commerce-a2a-x402.git cd google-agentic-commerce-a2a-x402
-
(Optional) Create and activate a virtual environment: python3 -m venv .venv source .venv/bin/activate # on Unix/macOS .venv\Scripts\activate # on Windows
-
Install Python dependencies for the x402 a2a library (adjust path if structure differs): if a requirements file exists: python -m pip install -r python/x402_a2a/requirements.txt otherwise install the package directly from source: python -m pip install -e python/x402_a2a
-
Run or test the library/examples: python -m x402_a2a
Notes:
- The exact package name may vary; look for the Python implementation under python/x402_a2a in this repo for precise usage instructions.
- Ensure your environment variables (see mcp_config) are set to point at your network, RPC endpoint, and keys in a secure manner.
Additional notes
Tips and common issues:
- This extension is designed as a protocol library; you will typically run the Python module that provides the x402_a2a implementation and integrate it into your agent's middleware.
- Ensure you securely manage private keys and RPC endpoints; avoid hard-coding credentials.
- When testing, use a testnet or sandbox environment if available for on-chain payments before going live on mainnet.
- Refer to the spec at spec/v0.1/spec.md and the Python library documentation under python/x402_a2a/README.md for deeper integration details and examples.
- If you encounter module import errors, verify your PYTHONPATH includes the repository's python/x402_a2a directory or install the package in editable mode as shown above.
Related MCP Servers
valuecell
ValueCell is a community-driven, multi-agent platform for financial applications.
learn-ai-engineering
Learn AI and LLMs from scratch using free resources
NagaAgent
A simple yet powerful agent framework for personal assistants, designed to enable intelligent interaction, multi-agent collaboration, and seamless tool integration.
any-agent
A single interface to use and evaluate different agent frameworks
evo-ai
Evo AI is an open-source platform for creating and managing AI agents, enabling integration with different AI models and services.
c2sagent
C2S Agent is an lightweight AI Agent construction platform that provides configurable online Agents and MCP services, You can configure any HTTP request interface as an MCP tool. C2S Agent 是一个轻量级的AI Agent构建平台,提供在线可配置的Agent,MCP,您可以一个HTTP请求的接口配置成为一个MCP工具,Agent之间可以进行自交流。并提供了单端口多A2A服务,MCP服务的解决方案