结账 A2A 绑定

概述

本文档指定结账能力的智能体对智能体协议 (A2A) 绑定。

传输发现

支持 A2A 传输的商家必须在 UCP Profile 中指定智能体卡片端点:

{
  "ucp": {
    "services": {
      "dev.ucp.shopping": {
        "a2a": {
          "endpoint": "https://example-business.com/.well-known/agent-card.json"
        }
      }
    }
  }
}

购物智能体 Profile 宣告

购物平台必须将其 profile URI 作为 UCP-Agent 请求头发送:

UCP-Agent: profile="https://agent.example/profiles/v2025-11/shopping-agent.json"
Content-Type: application/json

A2A 交互

UCP A2A 扩展 URI:https://ucp.dev/specification/reference?v=2026-01-11

商家必须在其 A2A 智能体卡片中宣告此扩展:

{
  "extensions": [
    {
      "uri": "https://ucp.dev/specification/reference?v=2026-01-11",
      "description": "Business agent supporting UCP",
      "params": {
        "capabilities": [
          {
            "name": "dev.ucp.shopping.checkout",
            "version": "2026-01-11"
          }
        ]
      }
    }
  ]
}

结账功能

结账实体必须作为键为 a2a.ucp.checkoutDataPart 对象的一部分返回。

自然语言输入

{
  "message": {
    "role": "user",
    "parts": [
      {
        "type": "text",
        "text": "将 Pixel 10 Pro 添加到我的结账"
      }
    ],
    "messageId": "69da8f87-991b-479e-80dc-ed92fcb57cbe",
    "kind": "message",
    "contextId": "aad14abc-4082-4748-84ca-4afff85aedfa"
  }
}

结构化输入

{
  "message": {
    "role": "user",
    "parts": [
      {
        "type": "data",
        "data": {
          "action": "add_to_checkout",
          "product_id": "PIXEL-10-PRO",
          "quantity": 1
        }
      }
    ],
    "messageId": "e94a8c10-69f4-4c4c-b988-21a298302da6",
    "kind": "message",
    "contextId": "aad14abc-4082-4748-84ca-4afff85aedfa"
  }
}

响应格式

{
  "id": 33,
  "jsonrpc": "2.0",
  "result": {
    "contextId": "4629ea79-7201-4ece-bc7a-ce19fff76e61",
    "kind": "message",
    "messageId": "8e8566e0-6d7c-4f29-bd90-26a132385baa",
    "parts": [
      {
        "data": {
          "a2a.ucp.checkout": {...checkoutObject}
        },
        "kind": "data"
      }
    ],
    "role": "agent"
  }
}

结账完成

标准完成

{
  "message": {
    "role": "user",
    "parts": [
      {
        "type": "data",
        "data": {"action":"complete_checkout"}
      },
      {
        "kind": "data",
        "data": {
          "a2a.ucp.checkout.payment_data": {
            "id": "instr_1",
            "handler_id": "gpay",
            "type": "card",
            "credential": {
              "type": "PAYMENT_GATEWAY",
              "token": "examplePaymentMethodToken"
            }
          }
        }
      }
    ],
    "messageId": "e94a8c10-69f4-4c4c-b988-21a298302da6",
    "kind": "message",
    "contextId": "aad14abc-4082-4748-84ca-4afff85aedfa"
  }
}

基于 AP2 的完成

当 AP2 mandates 扩展处于活动状态时,包含 ap2.checkout_mandate

{
  "kind": "data",
  "data": {
    "a2a.ucp.checkout.payment_data": {
      "id": "instr_1",
      "handler_id": "gpay",
      "type": "card",
      "credential": {
        "type": "PAYMENT_GATEWAY",
        "token": "examplePaymentMethodToken"
      }
    },
    "ap2": {
      "checkout_mandate": "eyJhbGciOiJFUz..."
    }
  }
}

另请参阅