DEV Community

BuyWhere
BuyWhere

Posted on

Connect Gemini to Singapore Commerce in 5 Minutes via A2A — BuyWhere Agent Card Walkthrough

Connect Gemini to Singapore Commerce in 5 Minutes via A2A

Google's Agent2Agent (A2A) protocol lets AI agents discover and delegate tasks to each other. BuyWhere just published its A2A Agent Card — so any A2A-compatible agent can now shop Singapore's product catalog autonomously.

This walkthrough shows you how to connect Gemini or any Google ADK agent to BuyWhere via the A2A protocol.

What You'll Build

A Gemini agent that can:

  • Search for products in Singapore
  • Compare prices across merchants
  • Find deals and discounts
  • Get detailed product info

All without writing custom API integration code — the A2A Agent Card handles discovery and delegation.

Step 1: Discover BuyWhere's Capabilities

Any A2A agent can fetch an Agent Card at a well-known URL:

curl https://buywhere.ai/.well-known/agent.json
Enter fullscreen mode Exit fullscreen mode

This returns a machine-readable spec with 6 skills:

Skill Description
search_products Search by keyword or natural language
get_product Full product details
find_best_price Cheapest listing across merchants
get_deals Products with price drops
get_recommendations Personalized recommendations
cross_border_match Find products available for cross-border

Step 2: Connect via Google ADK

If you're using Google's Agent Development Kit (ADK), point your agent to the Agent Card:

from google.adk.agents import A2AAgent

buywhere = A2AAgent(
    card_url="https://buywhere.ai/.well-known/agent.json",
    api_key="your-buywhere-api-key"
)

result = buywhere.send_task({
    "skill": "search_products",
    "input": {
        "query": "wireless earbuds",
        "category": "electronics",
        "limit": 5
    }
})
print(result)
Enter fullscreen mode Exit fullscreen mode

Step 3: Or Connect via Gemini API Directly

If you're using the Gemini API, you can send A2A tasks directly:

import requests

response = requests.post(
    "https://api.buywhere.ai/a2a",
    headers={"Authorization": "Bearer your-api-key"},
    json={
        "agent_id": "buywhere",
        "task": {
            "type": "commerce.search",
            "params": {
                "query": "gaming laptop under 2000 SGD"
            }
        }
    }
)
print(response.json())
Enter fullscreen mode Exit fullscreen mode

Step 4: Also Available via MCP

If you prefer the Model Context Protocol (Claude, Cursor, Windsurf):

npx -y @buywhere/mcp-server
Enter fullscreen mode Exit fullscreen mode

Configure with env var BUYWHERE_API_KEY and the tools load automatically.

Why This Matters

Most commerce APIs require:

  • Custom integration code
  • API documentation reading
  • Authentication setup
  • Web scraping fallbacks

With A2A, your agent discovers BuyWhere's capabilities at runtime. The Agent Card tells the agent exactly what skills are available, how to authenticate, and what parameters each skill expects.

Try It

  1. Get your API key: buywhere.ai/dashboard
  2. Agent Card: buywhere.ai/.well-known/agent.json
  3. Docs: docs.buywhere.ai

Built an integration? Tag us on social or open a GitHub Discussion — we'd love to feature your agent.


BuyWhere is Singapore's first agent-native product catalog API, purpose-built for AI agents.

Top comments (0)