Skip to content

Quickstart

Get the AP2 reference samples running on your machine in minutes.

Ensure you have the following installed:

  • Python 3.10+
  • uv (highly recommended for dependency management)
  • Go 1.21+ (if running Go samples)
  • Android Studio (if running Android samples)

AP2 samples use Gemini models for agent reasoning. You need either a Google API Key or Vertex AI configured.

  1. Get a key from Google AI Studio.
  2. Set it in your terminal:
    Terminal window
    export GOOGLE_API_KEY='your_key_here'

If you prefer using Google Cloud Vertex AI:

Terminal window
export GOOGLE_GENAI_USE_VERTEXAI=true
export GOOGLE_CLOUD_PROJECT='your-project-id'
gcloud auth application-default login

The fastest way to see AP2 in action is the Python “Human Present” card scenario.

  1. Clone and navigate to the repo:

    Terminal window
    git clone https://github.com/google-agentic-commerce/AP2.git
    cd AP2
  2. Run the automated script:

    Terminal window
    bash samples/python/scenarios/a2a/human-present/cards/run.sh
  3. Start Shopping: Open your browser to http://localhost:8000/dev-ui.

    • Select shopping_agent from the dropdown.
    • Type: "I want to buy a pair of red shoes."

Once you have the basics working, try these other tutorials: