NativePort
← All use cases

Find product offers on Google Shopping

Give your agent a shopping query and retrieve offers with prices, sellers, and source links.

The problem

An agent asked to find offers needs search results for a particular product and market. A general answer from memory cannot establish which sellers appear in today’s results. A regular search-page fetch may also leave the agent with an incomplete page instead of comparable product records.

How NativePort helps

NativePort connects your agent to SerpApi’s Google Shopping search. The agent supplies the product description and receives structured offers. It can then shortlist relevant results and show the links behind its comparison.

Technical implementation

Use Python 3 with requests installed (python -m pip install requests). Set NATIVEPORT_API_KEY in your environment to your NativePort key. Run the snippets on your server, where your key stays private.

Set SHOPPING_QUERY to a specific product query, such as a model name and capacity. This example requests one results page for the US market in English using the Google Shopping engine.

python
import json
import os
import requests

BASE = "https://api.nativeport.ai"
HEADERS = {"Authorization": f"Bearer {os.environ['NATIVEPORT_API_KEY']}"}

response = requests.get(
    BASE + "/serpapi",
    headers=HEADERS,
    params={"engine": "google_shopping", "q": os.environ["SHOPPING_QUERY"],
            "gl": "us", "hl": "en"},
    timeout=120,
)
response.raise_for_status()
result = response.json()
if result.get("error"):
    raise RuntimeError(result["error"])
offers = result.get("shopping_results", [])
print(json.dumps(offers, indent=2, ensure_ascii=False))

An empty list means no offers were returned in that field. The first results page is a shortlist, not a complete inventory of the market. Check the model, condition, delivery charges, and destination before comparing prices. Your agent can use the retail product guide to inspect a seller’s product page separately; that additional lookup is outside this example.

Tool costs

Tool used in the examplePrice per call
SerpApi — Google Shopping search $0.026375 / call

Prices in USD. Usage-based tools have no fixed per-call price. View pricing.

Let your agent build it

You don’t need to write this code yourself. Copy this page’s link and paste it into your agent. Ask it to follow the guide and implement the feature for you.