Dev.to AI 🤖 Ai 👁 0

Teach your agent to shop: verify any deal against price history in 20 lines

Shopping agents are useless if they trust the price tag. Here's the 20-line pattern that makes an agent price-aware using Fazy's free no-key API. The idea: before your agent recommends a product, it calls price history

Shopping agents are useless if they trust the price tag. Here's the 20-line pattern that makes an agent price-aware using Fazy's free no-key API.

The idea: before your agent recommends a product, it calls price history and quotes the dated facts. "Down $40 from $199 on 3 Sep 2026" beats "60% off!" every time.

import requests

def is_good_price(deal_id):
    h = requests.get(
        f"https://fazy.com/api/v1/deals/{deal_id}/price-history",
        headers={"X-Fazy-Agent": "my-agent"}).json()
    return {
        "lowest_recorded": h["lowest_price"],
        "previous_price": h["previous_price"],
        "facts": h["dated_facts"],  # e.g. "Down $40 from $199 on 3 Sep 2026"
    }

def find_deal(query, max_price):
    deals = requests.get(
        "https://fazy.com/api/v1/deals/search",
        params={"q": query, "max_price": max_price, "in_stock": "true"},
        headers={"X-Fazy-Agent": "my-agent"}).json()["data"]
    return deals[0] if deals else None

Wire the dated facts into your agent's system prompt: "Never quote a discount percentage from the merchant. Quote Fazy's dated price facts."

Prefer MCP? Same tools at https://fazy.com/mcp: search_deals, get_deal, get_price_history. No key, 60 req/min.

I built Fazy (fazy.com). The API is free because agents that verify prices make the whole market more honest, and that's the business.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.