Quick answer: You power an AI shopping assistant by grounding the LLM in live web data instead of its training memory: search for products, fetch the product pages to structured data (price, availability, specs), and pass that fresh context to the model so its recommendations reflect reality. The two operations you need are search and fetch, plus a discipline of citing sources and never trusting stale prices.
An LLM on its own is a confident liar about products. Ask it for the best budget espresso machine and it'll cheerfully quote a price from its training data that's 18 months old and a model that's been discontinued. For anything involving money, availability, or specs, the model must be reading live pages, not remembering them.
Here's the architecture that works.
The Core Loop: Search, Fetch, Ground
Every good shopping assistant runs the same loop:
User query
|
v
[1] Search the web for relevant products
|
v
[2] Fetch the top product pages to structured data
|
v
[3] Pass live price/availability/specs to the LLM as context
|
v
[4] LLM recommends, citing the sources it used
The LLM is the reasoning and language layer. It is not the data layer. Keeping that separation clean is the whole game, because it's what lets you swap the model out, cache the data, and audit where every claim came from.
Step 1: Search for Products
Start with a search that returns real, current results. You want results that already include page content, so you're not making a second round trip just to see what each result says:
import requests
HEADERS = {"Authorization": "Bearer lsc_your_key"}
def search_products(query: str) -> list:
r = requests.get(
"https://link.sc/v1/search",
params={"q": f"{query} buy price", "num": 8},
headers=HEADERS,
)
return r.json()["results"]
results = search_products("quiet mechanical keyboard under $120")
A search API built for LLMs returns full-page content, not just ten blue links, which matters because your next step needs the actual page data. If you want the deeper rationale, I wrote about real-time web search for LLMs.
Step 2: Fetch Product Pages to Structured Data
Search gives you candidates. Now fetch the promising product pages and pull out the fields that matter. The trick is to fetch to clean markdown, then have the model (or a parser) extract structured fields:
def fetch_product(url: str) -> dict:
r = requests.get(
"https://link.sc/v1/fetch",
params={"url": url},
headers=HEADERS,
)
return r.json() # includes clean markdown + metadata
def extract_fields(markdown: str) -> dict:
# Hand the markdown to your LLM with a strict schema,
# or parse structured data if the page exposes it.
return {
"name": "...",
"price": "...",
"currency": "USD",
"in_stock": True,
"url": "...",
"fetched_at": "2026-07-18T14:00:00Z",
}
products = []
for hit in results[:5]:
page = fetch_product(hit["url"])
fields = extract_fields(page["markdown"])
products.append(fields)
Two things I've learned the hard way here. First, always stamp fetched_at on every record. You'll need it to reason about freshness and to be honest with the user about how current a price is. Second, fetch clean markdown rather than raw HTML, because product pages are enormous and mostly boilerplate, and you don't want to spend your context window on cookie banners.
Step 3: Ground the LLM's Recommendation
Now hand the live data to the model with instructions to only use what you gave it:
import anthropic, json
client = anthropic.Anthropic()
prompt = f"""You are a shopping assistant. Recommend from ONLY the
products below. Every price and availability claim must come from this
data. Cite the source URL for each recommendation. If data is missing,
say so rather than guessing.
Live product data:
{json.dumps(products, indent=2)}
User asked: quiet mechanical keyboard under $120"""
resp = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=1024,
messages=[{"role": "user", "content": prompt}],
)
print(resp.content[0].text)
The system-prompt discipline ("only use this data, cite sources, admit gaps") is what turns a hallucination machine into a trustworthy assistant. Without it, the model will happily blend live data with half-remembered training data, and you won't be able to tell which is which. This is the same grounding pattern behind any RAG pipeline with live web data, just pointed at product pages.
Step 4: Cite Sources, Always
Never let the assistant state a price without a link to where it got it. This does two jobs at once:
- Trust. Users click through, see the real price, and believe the next recommendation.
- Blame routing. When a price is wrong, a citation tells you instantly whether the source was stale or the extraction was buggy.
Structure the output so every claim carries its source:
| Product | Price | In stock | Source |
|---|---|---|---|
| KeyQuiet 84 | $99 | Yes | store-a.example/keyquiet-84 |
| SilentType Pro | $115 | Yes | store-b.example/silenttype |
Make the assistant produce this table, not a prose paragraph, and grounding becomes verifiable at a glance.
Keeping It Fresh
Prices and stock change constantly, and stale data is worse than no data because it looks authoritative. My rules of thumb:
| Data type | Reasonable freshness | Strategy |
|---|---|---|
| Price | Minutes to a few hours | Re-fetch on the query, short cache |
| Availability | Minutes | Re-fetch on the query |
| Specs, descriptions | Days | Longer cache is fine |
| Reviews, ratings | Days | Longer cache is fine |
The pattern: cache the slow-moving stuff aggressively, and re-fetch price and availability at query time or close to it. Show the fetched_at timestamp to the user for anything money-related. "$99 as of 2 minutes ago" is honest; a bare "$99" implies a certainty you don't have. Check pricing to size the fetch volume this implies for your traffic.
The Compliance and Ethics Note
A shopping assistant touches retailer data, so a few boundaries matter:
- Stick to public product pages; don't scrape behind logins or checkout flows.
- Honor robots.txt and rate limits. A polite fetch cadence keeps you welcome.
- Prefer official retailer or affiliate APIs where they exist. Many marketplaces offer product feeds that are more stable than scraping and explicitly permitted.
- Attribute prices to their source, and make clear to users that prices can change and should be confirmed at the retailer.
- Don't misrepresent scraped data as an official feed from a retailer you're not partnered with.
Grounding in live data is powerful precisely because it's real, so treat the sources with the respect that keeps the whole thing sustainable.
The Bottom Line
An AI shopping assistant is only as good as the data underneath it. Search for current products, fetch their pages to structured fields, ground the model strictly in that live data, cite every source, and re-fetch the volatile stuff. Do that, and the assistant stops making up prices and starts earning trust. Skip it, and you've built a very fluent way to quote last year's catalog.
Building a shopping assistant that needs live prices and availability? link.sc gives you search and fetch in one API. Get started free with 500 credits a month.