Ap2 setup

From OrcaQubits/agentic-commerce-skills-plugins · View interactive version

Ap2 setup is an AI agent skill from the GitHub repository OrcaQubits/agentic-commerce-skills-plugins. Scaffold a new AP2 project — install the SDK, set up agent roles, configure credentials, and create a basic multi-agent payment system. Use when starting a new AP2 agentic payments project from scratch.

How to use this skill

Skill file

AP2 Project Setup

Before writing code

Fetch live docs:

  1. Fetch https://ap2-protocol.org/ for the latest protocol overview
  2. Fetch https://github.com/google-agentic-commerce/AP2 for the current README and installation instructions
  3. Web-search site:github.com google-agentic-commerce AP2 samples python for the sample project structure
  4. Fetch https://github.com/google-agentic-commerce/AP2/tree/main/code/samples for Python sample layout

Conceptual Architecture

What Setup Involves

An AP2 project creates a multi-agent payment system with distinct roles:

  1. Install the AP2 Python package from GitHub
  2. Create agent role directories — Shopping Agent, Merchant, Credentials Provider, Payment Processor
  3. Configure authentication — Google API key or Vertex AI credentials
  4. Define Agent Cards — each agent advertises its AP2 capabilities
  5. Set up the agent framework — Google ADK (Agent Development Kit) is the reference framework

Installation

# Requires Python 3.10+ and uv
uv pip install git+https://github.com/google-agentic-commerce/AP2.git@main

Project Structure (Reference from Official Samples)

my-ap2-project/
├── roles/
│   ├── shopping_agent/           # Shopping Agent — orchestrates purchases
│   │   ├── __init__.py
│   │   └── agent.py
│   ├── merchant_agent/           # Merchant — product catalog, cart creation
│   │   ├── __init__.py
│   │   └── agent.py
│   ├── credentials_provider_agent/  # CP — payment methods, tokenization
│   │   ├── __init__.py
│   │   └── agent.py
│   └── merchant_payment_processor_agent/  # MPP — payment processing
│       ├── __init__.py
│       └── agent.py
├── .env                          # GOOGLE_API_KEY or Vertex AI config
├── pyproject.toml
├── run.sh                        # Launches all agents
└── tests/
    └── test_flow.py

Environment Configuration

Two authentication options:

Agent Ports (Reference)

Each agent runs on its own port:

Key Dependencies

Key Decisions During Setup

Best Practices

Fetch the latest GitHub README and sample READMEs for exact setup commands, current package versions, and framework requirements before scaffolding.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.