The problem
An agent asked to compare two Amazon products needs the actual listings. Its stored knowledge cannot tell it which variant is selected or what price is displayed today. A basic page fetch may encounter a browser check or return HTML that mixes product information with recommendations and ads.
How NativePort helps
NativePort connects your agent to Oxylabs, which retrieves the listing and organizes the product details into named fields. Give it the product identifier and marketplace, then let your agent work from the returned record. This makes a price check or product comparison possible without building a page parser.
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 AMAZON_ASIN to the ten-character identifier after /dp/ in the product URL. This example reads one listing on Amazon.com; domain selects the marketplace.
import json
import os
import requests
BASE = "https://api.nativeport.ai"
HEADERS = {"Authorization": f"Bearer {os.environ['NATIVEPORT_API_KEY']}"}
response = requests.post(
BASE + "/oxylabs",
headers=HEADERS,
json={"source": "amazon_product", "domain": "com",
"query": os.environ["AMAZON_ASIN"], "parse": True},
timeout=120,
)
response.raise_for_status()
results = response.json().get("results", [])
if not results:
raise RuntimeError("No product result returned")
item = results[0]
if item.get("status_code") != 200:
raise RuntimeError("Amazon page could not be retrieved")
product = item.get("content")
if not isinstance(product, dict) or not product.get("title"):
raise RuntimeError("No parsed product details returned")
print(json.dumps(product, indent=2, ensure_ascii=False))Keep the ASIN, marketplace, and retrieval time with the result. Check the selected variant, currency, and availability before comparing prices; the displayed amount may exclude shipping or depend on delivery location. A missing price should remain missing in your agent’s answer. The Amazon product request reference documents the available controls. For customer feedback, use the Amazon reviews guide.
Tool costs
| Tool used in the example | Price per call |
|---|---|
| Oxylabs — Amazon product lookup | $0.002638 / 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.