Skip to main content

Google AP2

AP2 defines structured mandates and delegation chains so agents can execute commerce actions with explicit, narrow authority.

Mandate-First Model

Narrowing by Hop

VDC Mandate Types

  • Cart
  • Intent
  • Payment

Scopes

  • checkout
  • payment
  • browse
  • compare
  • negotiate

Capabilities

CapabilityDescription
select_itemChoose candidate products/services.
add_to_cartModify cart composition and quantities.
checkoutSubmit checkout details up to payment step.
payExecute authorized payment transaction.
confirm_orderConfirm and persist final order receipt.
manage_subscriptionCreate/update/cancel recurring service plans.

Multi-Hop Delegation Chains

Delegation chains narrow authority at each hop so every child mandate is a strict subset of its parent.
Note: Delegation invariant: child scopes ⊆ parent scopes and child capabilities ⊆ parent capabilities.

Mandate Parsing Example

ap2-parse-mandate.ts
type Scope = "checkout" | "payment" | "browse" | "compare" | "negotiate";
type Capability =
  | "select_item"
  | "add_to_cart"
  | "checkout"
  | "pay"
  | "confirm_order"
  | "manage_subscription";

interface MandatePayload {
  type: "Cart" | "Intent" | "Payment";
  scopes: Scope[];
  capabilities: Capability[];
  delegations: Array<{
    delegate: string;
    scopes: Scope[];
    capabilities: Capability[];
  }>;
}

const mandate = JSON.parse(payload) as MandatePayload;

const hasPaymentScope = mandate.scopes.includes("payment");
const canPay = mandate.capabilities.includes("pay");

if (!hasPaymentScope || !canPay) {
  throw new Error("Mandate does not authorize payment execution");
}
Tip: Persist parsed mandate snapshots and subset-validation results for every delegation hop.
Note: Route all AP2 verification outcomes through ProtocolRouter.verify() for consistent fallback and metrics tagging.