Tutorial

How to Build a Multi-Source Product Research Agent

Create a product research agent in Python that queries Google, Amazon, and Walmart via Scavio to compile comprehensive product intelligence reports.

Product research for purchasing decisions, catalog enrichment, or competitive analysis requires collecting data from multiple sources. A product research agent automates this by querying Google for reviews and expert opinions, Amazon for pricing and customer feedback, and Walmart for alternative pricing, then synthesizing everything into a structured report. This tutorial builds such an agent using the Scavio API's unified endpoint, without needing to manage multiple API keys or rate limits.

Prerequisites

  • Python 3.10 or higher
  • requests and concurrent.futures available
  • A Scavio API key
  • Basic understanding of data merging and formatting

Walkthrough

Step 1: Query all three platforms concurrently

Use ThreadPoolExecutor to query Google, Amazon, and Walmart simultaneously for a product name.

Python
from concurrent.futures import ThreadPoolExecutor

def fetch_all(product: str) -> dict:
    queries = {
        "google": lambda: search_google(product + " review"),
        "amazon": lambda: search_amazon(product),
        "walmart": lambda: search_walmart(product),
    }
    with ThreadPoolExecutor(max_workers=3) as ex:
        futures = {name: ex.submit(fn) for name, fn in queries.items()}
        return {name: fut.result() for name, fut in futures.items()}

Step 2: Extract price range from Amazon and Walmart

Collect prices from both e-commerce platforms and compute the min and max.

Python
def price_range(data: dict) -> dict:
    prices = []
    for platform in ["amazon", "walmart"]:
        for p in data[platform].get("products", [])[:5]:
            ps = p.get("price", "")
            if ps:
                prices.append(float(ps.replace("$", "").replace(",", "")))
    return {"min": min(prices) if prices else None, "max": max(prices) if prices else None}

Step 3: Extract Google review sentiment

Collect organic result snippets from Google that contain review signals like ratings or recommendations.

Python
def extract_review_signals(google_data: dict) -> list[str]:
    signals = []
    for r in google_data.get("organic_results", [])[:5]:
        snippet = r.get("snippet", "")
        if any(word in snippet.lower() for word in ["recommend", "rating", "review", "best", "worth"]):
            signals.append(snippet)
    return signals

Step 4: Assemble and print the research report

Combine price range, review signals, and product count into a formatted research report.

Python
def research_product(product: str) -> str:
    data = fetch_all(product)
    pr = price_range(data)
    signals = extract_review_signals(data["google"])
    lines = [f"Product Research: {product}"]
    lines.append(f"Price range: ${pr['min']} — ${pr['max']}")
    lines.append("Review signals:")
    for s in signals[:3]:
        lines.append(f"  - {s[:100]}")
    return "\n".join(lines)

Python Example

Python
import os
import requests
from concurrent.futures import ThreadPoolExecutor

API_KEY = os.environ.get("SCAVIO_API_KEY", "your_scavio_api_key")
ENDPOINT = "https://api.scavio.dev/api/v1/search"

def call(body: dict) -> dict:
    r = requests.post(ENDPOINT, headers={"x-api-key": API_KEY}, json=body)
    r.raise_for_status()
    return r.json()

def research(product: str) -> dict:
    with ThreadPoolExecutor(max_workers=3) as ex:
        g = ex.submit(call, {"query": f"{product} review", "country_code": "us"})
        a = ex.submit(call, {"platform": "amazon", "query": product, "marketplace": "US"})
        w = ex.submit(call, {"platform": "walmart", "query": product})
        return {"google": g.result(), "amazon": a.result(), "walmart": w.result()}

if __name__ == "__main__":
    data = research("Sony WH-1000XM5")
    amazon_products = data["amazon"].get("products", [])
    print(f"Amazon listings: {len(amazon_products)}")
    if amazon_products:
        print(f"Top Amazon price: {amazon_products[0].get('price')}")  
    google_count = len(data["google"].get("organic_results", []))
    print(f"Google results: {google_count}")

JavaScript Example

JavaScript
const API_KEY = process.env.SCAVIO_API_KEY || "your_scavio_api_key";
const ENDPOINT = "https://api.scavio.dev/api/v1/search";

async function call(body) {
  const res = await fetch(ENDPOINT, {
    method: "POST",
    headers: { "x-api-key": API_KEY, "Content-Type": "application/json" },
    body: JSON.stringify(body)
  });
  return res.json();
}

async function research(product) {
  const [google, amazon, walmart] = await Promise.all([
    call({ query: `${product} review`, country_code: "us" }),
    call({ platform: "amazon", query: product, marketplace: "US" }),
    call({ platform: "walmart", query: product })
  ]);
  return { google, amazon, walmart };
}

async function main() {
  const data = await research("Sony WH-1000XM5");
  console.log(`Amazon listings: ${data.amazon.products?.length || 0}`);
  console.log(`Google results: ${data.google.organic_results?.length || 0}`);
}
main().catch(console.error);

Expected Output

JSON
Product Research: Sony WH-1000XM5
Price range: $249.99 — $349.00
Review signals:
  - The WH-1000XM5 remains our top recommendation for noise-canceling headphones...
  - Rated 4.8/5 stars across 50,000+ verified reviews on Amazon...
  - Best premium wireless headphones in 2026 according to our testing...

Related Tutorials

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

Python 3.10 or higher. requests and concurrent.futures available. A Scavio API key. Basic understanding of data merging and formatting. A Scavio API key gives you 500 free credits per month.

Yes. The free tier includes 500 credits per month, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Start Building

Create a product research agent in Python that queries Google, Amazon, and Walmart via Scavio to compile comprehensive product intelligence reports.