explaingit

google-agentic-commerce/ap2

Analysis updated 2026-05-18

3,001PythonAudience · developerComplexity · 4/5LicenseSetup · moderate

TLDR

An open specification and code samples letting AI shopping agents complete secure, standardized payments on a user's behalf.

Mindmap

mindmap
  root((AP2 protocol))
    What it does
      Agent driven payments
      Standard checkout flow
      Cross platform spec
    Tech stack
      Python SDK
      Go samples
      Android samples
      React web client
    Use cases
      AI shopping assistants
      Agent to business checkout
      Payment credential exchange
    Audience
      Developers
      Payment providers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Prototype an AI shopping agent that can complete a checkout on a user's behalf using a standard protocol.

USE CASE 2

Study a reference implementation of secure agent to business payment flows across Python, Go, and Android.

USE CASE 3

Integrate a business's checkout system with AI agents using AP2's declared capabilities model.

What is it built with?

PythonGoReactAndroid

How does it compare?

google-agentic-commerce/ap2openmoss/moss-tts-nanouniversal-commerce-protocol/ucp
Stars3,0013,0322,961
LanguagePythonPythonPython
Setup difficultymoderatemoderateeasy
Complexity4/53/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 1h+

Requires a Google API key or Vertex AI setup, plus Python 3.11+ and the uv package manager to run samples.

Apache 2.0: free to use, modify, and distribute, including commercially, as long as you keep the license and copyright notice.

In plain English

AP2, short for Agent Payments Protocol, is a specification and set of code samples for letting AI agents make purchases on a person's behalf in a secure, standardized way. Rather than every company building its own custom integration for agent driven shopping, AP2 defines a common protocol that platforms, businesses, payment providers, and credential providers can all speak, so agents can discover what a business supports and complete a checkout with or without a human present at that exact moment. The repository is organized into a docs folder holding the specification, flow diagrams, and FAQ, and a code folder holding the actual implementation. Inside code, there is an AP2 software development kit written in Python with Pydantic based data models and JSON schemas, a set of sample scenarios written in Python, Go, and for Android, and a demo web client built with Vite and React. Each sample scenario comes with its own README and a run script that installs dependencies and starts the relevant agents automatically. The samples are built using Google's Agent Development Kit and a Gemini model, though the README is clear that AP2 itself does not require either of these: developers are free to build their own agents with different tools. To try a scenario, you set up authentication using either a Google API key or Vertex AI, then run a scenario's script, for example the human present card payment flow, and navigate to the shopping agent's URL to interact with it. For developers who only want the protocol's data types rather than the full demo, the AP2 Python package can be installed directly from GitHub while a formal PyPI release is still pending. The project is released under the Apache 2.0 license and is maintained as an open, collaborative specification rather than a single company's closed product.

Copy-paste prompts

Prompt 1
Walk me through running the human present card payment scenario in AP2's Python samples.
Prompt 2
Explain how AP2 lets an AI agent complete a purchase without exposing raw payment credentials.
Prompt 3
Help me install the AP2 Python SDK and explore the models in code/sdk/python/ap2.
Prompt 4
What is the difference between the human present and human absent AP2 flows?

Frequently asked questions

What is ap2?

An open specification and code samples letting AI shopping agents complete secure, standardized payments on a user's behalf.

What language is ap2 written in?

Mainly Python. The stack also includes Python, Go, React.

What license does ap2 use?

Apache 2.0: free to use, modify, and distribute, including commercially, as long as you keep the license and copyright notice.

How hard is ap2 to set up?

Setup difficulty is rated moderate, with roughly 1h+ to a first successful run.

Who is ap2 for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.