Tutorial

How to Build a Trade Intelligence Agent

Build a trade intelligence agent that monitors product flows, tariff changes, and supplier activity using multi-platform search. Python tutorial.

Build a trade intelligence agent by combining Google news search for tariff and regulatory updates with Amazon product search for pricing shifts and supplier monitoring. Trade intelligence teams currently rely on expensive subscription databases that update weekly at best. A search-API-powered agent can check multiple platforms daily, cross-reference supplier listings with news events, and flag anomalies in near real-time. This tutorial builds an agent that monitors a configurable set of trade signals and produces a daily intelligence brief.

Prerequisites

  • Python 3.8+ installed
  • requests library installed
  • A Scavio API key from scavio.dev
  • A list of products, suppliers, or trade topics to monitor

Walkthrough

Step 1: Define the intelligence targets

Configure the products, trade routes, and regulatory topics your agent will monitor.

Python
import os, requests, json, datetime

API_KEY = os.environ['SCAVIO_API_KEY']

TARGETS = {
    'products': ['lithium batteries', 'solar panels', 'steel coils'],
    'news_queries': ['tariff update 2026', 'trade restriction semiconductor', 'import duty change'],
    'suppliers': ['CATL', 'BYD', 'LONGi Green'],
}

Step 2: Search news for regulatory changes

Query Google through Scavio for recent news about tariffs, trade restrictions, and regulatory updates.

Python
def search_trade_news(query: str) -> list:
    resp = requests.post('https://api.scavio.dev/api/v1/search',
        headers={'x-api-key': API_KEY},
        json={'platform': 'google', 'query': query}, timeout=15)
    resp.raise_for_status()
    results = resp.json().get('organic_results', [])
    return [{'title': r.get('title', ''), 'url': r.get('link', ''),
             'snippet': r.get('snippet', '')} for r in results[:5]]

Step 3: Monitor supplier product listings

Search Amazon for each supplier's products to track pricing changes and availability shifts.

Python
def check_supplier_products(supplier: str, product: str) -> list:
    query = f'{supplier} {product}'
    resp = requests.post('https://api.scavio.dev/api/v1/search',
        headers={'x-api-key': API_KEY},
        json={'platform': 'amazon', 'query': query}, timeout=15)
    results = resp.json().get('organic_results', [])
    return [{'title': r.get('title', ''), 'price': r.get('price', ''),
             'url': r.get('link', ''), 'rating': r.get('rating', '')}
            for r in results[:3]]

Step 4: Generate the intelligence brief

Combine news and supplier data into a structured daily brief and save it as JSON.

Python
def generate_brief(targets: dict) -> dict:
    brief = {'date': datetime.date.today().isoformat(), 'news': [], 'supplier_activity': []}
    for query in targets['news_queries']:
        news = search_trade_news(query)
        brief['news'].extend(news)
    for supplier in targets['suppliers']:
        for product in targets['products']:
            listings = check_supplier_products(supplier, product)
            if listings:
                brief['supplier_activity'].append({'supplier': supplier, 'product': product, 'listings': listings})
    with open(f'trade_brief_{brief["date"]}.json', 'w') as f:
        json.dump(brief, f, indent=2)
    print(f'Brief: {len(brief["news"])} news items, {len(brief["supplier_activity"])} supplier checks')
    return brief

generate_brief(TARGETS)

Python Example

Python
import requests, os
H = {'x-api-key': os.environ['SCAVIO_API_KEY']}

def trade_news(topic):
    data = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
        json={'platform': 'google', 'query': f'{topic} tariff 2026'}).json()
    return [{'title': r['title'], 'snippet': r.get('snippet', '')} for r in data.get('organic_results', [])[:3]]

def supplier_check(supplier, product):
    data = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
        json={'platform': 'amazon', 'query': f'{supplier} {product}'}).json()
    return [{'title': r.get('title', ''), 'price': r.get('price', '')} for r in data.get('organic_results', [])[:3]]

print(trade_news('semiconductor'))
print(supplier_check('CATL', 'lithium batteries'))

JavaScript Example

JavaScript
const H = {'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json'};
async function tradeNews(topic) {
  const r = await fetch('https://api.scavio.dev/api/v1/search', {
    method: 'POST', headers: H, body: JSON.stringify({platform: 'google', query: `${topic} tariff 2026`})
  });
  return ((await r.json()).organic_results || []).slice(0, 3).map(r => ({title: r.title, snippet: r.snippet}));
}
async function supplierCheck(supplier, product) {
  const r = await fetch('https://api.scavio.dev/api/v1/search', {
    method: 'POST', headers: H, body: JSON.stringify({platform: 'amazon', query: `${supplier} ${product}`})
  });
  return ((await r.json()).organic_results || []).slice(0, 3).map(r => ({title: r.title, price: r.price}));
}
tradeNews('semiconductor').then(console.log);

Expected Output

JSON
A daily trade intelligence brief with regulatory news, supplier activity monitoring, and product pricing data across Google and Amazon search results.

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.8+ installed. requests library installed. A Scavio API key from scavio.dev. A list of products, suppliers, or trade topics to monitor. 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

Build a trade intelligence agent that monitors product flows, tariff changes, and supplier activity using multi-platform search. Python tutorial.