Cysic Agent-to-Agent API
Extending Agent-to-Agent Interactions with Cryptocurrency Payments
Overview
The Crypto A2A Protocol is an extension of Google's Agent-to-Agent (A2A) Protocol that introduces cryptocurrency payment capabilities for agent tasks. By adding a new payment_required task state, this protocol enables agents to request payments from clients before proceeding with task execution, laying the foundation for an Agent Economy Ecosystem.
This extension maintains full compatibility with the standard A2A Protocol while introducing Web3 payment functionality, allowing agents to monetize their services through blockchain-based transactions.
Current Implementation: The initial version focuses on Solana blockchain integration, supporting SOL and SPL token payments. Future versions will extend support to additional blockchain networks.
Key Concepts
Extended Task States
The Crypto A2A Protocol extends the original A2A task states with an intermediate state:
payment_required: A new intermediate state indicating that the agent requires payment before continuing task execution
This state works alongside existing A2A states such as input_required, auth_required, working, completed, failed, etc.
Payment Flow Integration
When an agent determines that a task requires payment, it transitions to the payment_required state and provides payment details to the client. The task remains in an interrupted state until the client:
Processes the payment transaction on the blockchain
Provides the transaction hash as verification
The agent verifies the payment on-chain
The task continues to execution upon successful verification
Lifespan of a Paid Task
The following diagram illustrates the extended lifecycle of a task that requires payment (using Solana blockchain as an example):
Protocol Extensions
Payment Details Structure
When an agent requests payment, it includes structured payment information. The current implementation supports Solana-based payments:
Extended Task Status
The task status is enhanced to include payment information:
Example Payment Flow (Multiturn Conversation)
Similar to how the standard A2A protocol handles input_required states, the payment_required state enables a multiturn conversation flow where the client can continue the same task after completing the payment.
Note: The following examples demonstrate the payment workflow using Solana blockchain and USDC SPL tokens.
1. Initial Request - Client Sends Message
Server Response - Payment Required:
2. Extract Task Information and Process Payment
3. Continue Task with Payment Verification
Server Response - Payment Verified, Task Continues:
4. Task Completion with Artifacts
Final Server Response - Task Completed:
5. Automated Payment Handling with CryptoA2AClient
The Crypto A2A SDK provides automated payment handling to simplify this flow:
Key Points About Multiturn Payment Flow
State Continuity: The same
task_idandcontext_idare used throughout the payment flowInterruption Model: Similar to
input_required,payment_requiredpauses task executionVerification Step: The client must provide transaction proof to continue
Automatic Resumption: Once payment is verified, the task automatically continues
Error Handling: Failed payment verification transitions the task to
failedstate
Architecture Components
Agent-Side Components
PaymentAgentExecutor: Provides payment request and verification capabilities for agents
Payment State Management: Tracks payment requirements and verification status for each task
Blockchain Verification: Integrates with blockchain networks (Solana) to verify payment transactions
Client-Side Components
CryptoA2AClient: Extended A2A client with payment handling capabilities
Payment Handlers: Pluggable payment processors for different token types and blockchains
Automatic Payment Flow: Seamless handling of payment requests during task execution
Blockchain Integration
Solana Network Support: Currently supports Solana blockchain networks (mainnet-beta, devnet, testnet)
SPL Token Flexibility: Handles various Solana SPL tokens (SOL, USDC, USDT, custom SPL tokens)
On-Chain Verification: Solana transaction verification for secure payment confirmation
Benefits and Use Cases
For Agent Developers
Monetization: Direct revenue generation from agent services
Flexible Pricing: Dynamic pricing based on task complexity or resource usage
Secure Payments: Blockchain-based payment verification eliminates chargebacks
For Agent Users
Pay-per-Use: Only pay for services actually consumed
Transparent Pricing: Clear payment requirements before task execution
Decentralized: No intermediary payment processors required
AgentFi Ecosystem
Agent Marketplace: Enables decentralized marketplaces for AI agent services
Service Discovery: Agents can advertise their capabilities and pricing
Cross-Agent Payments: Agents can pay other agents for sub-tasks or collaboration
Implementation Considerations
Security
All payment verification occurs on Solana blockchain for maximum security
Transaction hashes are verified against the exact payment requirements
Failed verification immediately halts task execution
Performance
Payment verification is asynchronous and doesn't block other operations
Configurable timeout and retry mechanisms for payment processing
Minimal impact on standard A2A protocol performance
Compatibility
Maintains full backward compatibility with standard A2A protocol
Existing A2A agents continue to work without modification
Payment features are opt-in and can be selectively enabled
Future Extensions
The Crypto A2A Protocol provides a foundation for advanced AgentFi features:
Multi-blockchain Support: Extension from current Solana support to Ethereum, Bitcoin, and other blockchain networks
Advanced Payment Models: Subscription payments, usage-based billing, revenue sharing
Agent-to-Agent Economy: Direct agent collaboration with automated payments
Governance Tokens: Community governance for agent marketplaces and protocols
Roadmap Note: While the current implementation focuses on Solana blockchain, the protocol design is blockchain-agnostic and can be extended to support multiple blockchain networks in future versions.
Conclusion
The Crypto A2A Protocol represents a significant step toward the AgentFi ecosystem, where AI agents can operate as autonomous economic entities. By seamlessly integrating cryptocurrency payments into the A2A protocol, we enable new business models and use cases that were not possible with traditional payment systems.
This protocol maintains the simplicity and elegance of the original A2A specification while opening up entirely new possibilities for agent monetization and cross-agent collaboration in a decentralized economy.
Last updated