P402 Logo
P402.io

A2A Protocol

The universal language for autonomous agents.

Discovery

Agents broadcast skills via .well-known/agent.json.

Messaging

JSON-RPC 2.0 transport for structured, context-aware conversations.

Stateful

Tasks tracks lifecycle from pending to completed.

Quick Start: Handshake

# 1. Discover Capabilities
curl https://p402.io/.well-known/agent.json

# Response
{
  "name": "P402 Payment Router",
  "capabilities": { "streaming": true },
  "skills": [{ "id": "ai-completion" }]
}

JSON-RPC Reference

message/send

Send a message to an agent to initiate or continue a task.

{
  "jsonrpc": "2.0",
  "method": "message/send",
  "params": {
    "message": { "role": "user", "parts": [{ "type": "text", "text": "Hello" }] },
    "configuration": { "mode": "speed" }
  },
  "id": 1
}

message/stream

Stream response chunks using Server-Sent Events (SSE).

POST /api/a2a/stream with same body as above.

A2A x402 Extension

Standardized payment negotiation for agentic services.

1. payment-required

The agent responds with payment terms if the task requires settlement.

"result": {
  "extension_uri": "tag:x402.org,2025:x402-payment",
  "content": {
    "type": "payment-required",
    "data": {
      "payment_id": "pay_123",
      "schemes": [{ "scheme": "exact", "asset": "USDC", "amount": "500000" }]
    }
  }
}

2. payment-submitted

The client signs and submits the payment proof (EIP-3009 or Tx Hash).

"method": "x402/payment-submitted",
"params": {
  "payment_id": "pay_123",
  "scheme": "exact",
  "signature": "0x..." 
}

3. payment-completed

The server verifies settlement and issues an x402 receipt.

"result": {
  "status": "completed",
  "receipt": { "receipt_id": "rec_456" }
}