google-agentic-commerce/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.
What it solves
Before this extension, agents could communicate and perform tasks but had no built-in way to charge for the services they provide. The A2A x402 extension solves this by adding a layer of cryptocurrency payments to the agent-to-agent protocol, letting agents become commercial services that can accept payment on-chain.
How it works
The extension defines a simple three-step payment flow between agents:
- When a merchant agent requires payment for a service, it responds with a
payment-requiredmessage. - The client agent signs the payment details and sends them back in a
payment-submittedmessage. - The merchant verifies the payment, settles it on-chain, and replies with a
payment-completedmessage, delivering the requested service.
The architecture separates the core protocol (data structures and functions for creating, signing, and verifying payments) from "executors" — middleware that automates the flow so developers can either build custom logic or use ready-made components.
Who it’s for
Developers building agent-based services who want to charge for their capabilities — such as API calls, data processing, or AI inference — without building payment infrastructure from scratch. The project includes language-specific implementations (e.g., Python, TypeScript) and examples to help get started.
Highlights
- Brings HTTP 402 "Payment Required" spirit to the decentralized agent ecosystem.
- Language-agnostic specification with libraries in multiple languages.
- Functional core, imperative shell architecture for flexibility and ease of use.
- Includes examples and a full specification in the repository.
Related
- Project
- Project
- Project
- Project