Ap2 Dev Patternsのロゴ

Ap2 Dev Patterns

組織
OrcaQubits
ap2-dev-patterns

Apply AP2 cross-cutting development patterns — multi-agent payment architecture, UCP integration, x402 crypto payments, testing with mock providers, and production deployment. Use when architecting agentic payment systems or solving cross-cutting payment concerns.

概要

公開者OrcaQubits
リポジトリagentic-commerce-skills-plugins
スキル名ap2-dev-patterns
スター
40
フォーク
17
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    OrcaQubitsがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルAp2 Dev PatternsをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/OrcaQubits/agentic-commerce-skills-plugins/tree/main/ap2-agentic-payments/skills/ap2-dev-patterns
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/OrcaQubits/agentic-commerce-skills-plugins.git /tmp/agentic-commerce-skills-plugins
mkdir -p .claude/skills
cp -r /tmp/agentic-commerce-skills-plugins/ap2-agentic-payments/skills/ap2-dev-patterns .claude/skills/ap2-dev-patterns
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでAp2 Dev Patternsを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にAp2 Dev Patternsを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Ap2 Dev Patternsは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

AP2 Development Patterns

Before writing code

Fetch live docs:

  1. Fetch https://ap2-protocol.org/ap2/specification/ for the latest protocol details
  2. Fetch https://ap2-protocol.org/overview/ for UCP integration patterns
  3. Fetch https://ap2-protocol.org/overview/ for x402 crypto integration
  4. Web-search site:github.com google-agentic-commerce AP2 samples for reference architectures

Conceptual Architecture

Multi-Agent Payment Architecture

The standard AP2 architecture involves four agents communicating via A2A:

┌──────────────────────────────────────────────────┐
│                    User                           │
│          (trusted device surface)                 │
└──────────┬───────────────────────────────────────┘
           │ intent + signatures
┌──────────▼───────────────────────────────────────┐
│            Shopping Agent (SA)                     │
│    Orchestrator — coordinates the full flow        │
└──┬──────────────┬────────────────────────────────┘
   │              │
   │ A2A          │ A2A
   │              │
┌──▼──────┐  ┌───▼──────────┐
│ Merchant │  │ Credentials  │
│ Agent    │  │ Provider     │
│          │  │              │
│ catalog  │  │ payment      │
│ cart     │  │ methods      │
│ signing  │  │ tokenization │
└────┬─────┘  └──────────────┘
     │
     │ (Merchant → MPP)
     │
┌────▼─────────────┐
│ Merchant Payment  │
│ Processor (MPP)   │
│                   │
│ authorization     │
│ settlement        │
│ Payment Mandate   │
│ challenges        │
└────────┬──────────┘
         │
    ┌────▼──────────┐
    │ Network/Issuer │
    │ (Visa, MC,     │
    │  banks)        │
    └────────────────┘

Important: The SA communicates with the Merchant and the CP via A2A. The Merchant communicates with the MPP. The SA does not directly communicate with the MPP.

UCP Integration Pattern

UCP (Universal Commerce Protocol) operationalizes AP2:

  • UCP's Checkout object maps to a commerce-level checkout flow
  • UCP's checkout_mandate is distinct from (but related to) AP2's Checkout Mandate — checkout_mandate is a UCP-specific concept that wraps the commerce checkout authorization, while AP2's Checkout Mandate is the cryptographically signed VDC binding user consent to specific transaction terms
  • UCP's /complete_checkout API = AP2's payment authorization step
  • PaymentMandate (constructed by the MPP) proves payment authorization for the network/issuer

Use UCP when you need the full commerce checkout flow (catalog, cart, checkout, orders) with AP2's payment security.

x402 Crypto Payment Pattern

AP2 supports emerging digital payment methods via x402:

  • AP2 is payment-method agnostic — supports cards and crypto
  • x402 represents a specific crypto payment standard
  • AP2's VDC framework provides trust infrastructure for any payment method
  • Reference: github.com/google-agentic-commerce/a2a-x402

Testing with Mock Providers

Development testing without real money:

  • Set up internal environments with mock payment methods
  • Use the official samples as test harnesses (no real payment dependencies)
  • Mock Credentials Provider returns fake DPANs
  • Mock Payment Processor approves without real authorization
  • OTP test value: "123" (from samples)
  • Use "verbose" mode for full mandate payload visibility

Framework Flexibility

AP2 agents can be built with any framework:

  • Google ADK — Reference implementation framework
  • LangGraph — LangChain-based agent graphs
  • CrewAI — Crew-based multi-agent orchestration
  • AG2 — Microsoft's agent framework
  • Custom — Any Python/JS framework with A2A support

The protocol doesn't mandate a specific framework — only A2A compliance.

Multi-Merchant Comparison

Shopping Agents can query multiple merchants:

  1. Send Intent Mandate to Merchant A, B, C in parallel
  2. Receive Checkout Mandates from each
  3. Compare offers (price, shipping, availability)
  4. Present best options to user
  5. User selects preferred offer
  6. Proceed with selected merchant

Subscription and Recurring Payments

On the V1.x roadmap:

  • Standardized recurring payment flows
  • Subscription management
  • Recurring Intent Mandates with TTL-based reauthorization

Production Deployment Considerations

  • Key management — HSMs for merchant signing keys, secure hardware for user keys
  • PCI compliance — Credentials Provider must meet PCI DSS requirements
  • Logging — Complete audit trail for all mandates and transactions
  • Monitoring — Track mandate creation, signing, and payment success rates
  • Scaling — Each agent role scales independently
  • Trust establishment — Start with allowlists, evolve to certificate-based trust

Security Checklist

  • Shopping Agent cannot access raw payment credentials
  • User signatures are hardware-backed
  • Merchant signatures are entity-level (not agent-level)
  • All mandates are stored with signatures for audit
  • Challenge flows redirect to trusted surfaces
  • Risk signals are captured at transaction time
  • PCI data stays within Credentials Provider boundary
  • Agent-to-agent communication is encrypted (HTTPS)

Best Practices

  • Start with the official samples as a foundation
  • Use mocked payment providers for development
  • Test the full multi-agent flow end-to-end
  • Implement proper role separation from the beginning
  • Build with the UCP integration pattern for full commerce flows
  • Monitor the AP2 roadmap for new capabilities (push payments, subscriptions)
  • Follow Google ADK patterns for the reference implementation approach
  • Engage with the AP2 community on GitHub for updates

Fetch the latest specification, roadmap, and sample implementations for current capabilities and patterns before implementing.

よくある質問

AIスキル「Ap2 Dev Patterns」では何ができますか?

Apply AP2 cross-cutting development patterns — multi-agent payment architecture, UCP integration, x402 crypto payments, testing with mock providers, and production deployment. Use when architecting agentic payment systems or solving cross-cutting payment concerns.

TypingMindでAp2 Dev Patternsを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Ap2 Dev Patternsはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにAp2 Dev Patternsをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/OrcaQubits/agentic-commerce-skills-plugins/tree/main/ap2-agentic-payments/skills/ap2-dev-patternsを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Ap2 Dev Patternsを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Ap2 Dev Patternsは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもAp2 Dev Patternsを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Ap2 Dev Patterns」は無料ですか?

はい。OrcaQubitsがGitHubでMITライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇