An r/AZURE post showcased a 6-part build of an AI product search agent. The data layer determines breadth of coverage. This tutorial wires Scavio as the multi-source layer.
Prerequisites
- Azure subscription
- Azure AI Foundry or Azure Functions
- Scavio API key
Walkthrough
Step 1: Provision an Azure Function
TypeScript or Python runtime.
// Azure Function HTTP trigger; runtime: Node 20 or Python 3.11.Step 2: Define a product_search tool
Calls Scavio Amazon + Walmart endpoints.
async function productSearch(query: string) {
const H = { 'x-api-key': process.env.SCAVIO_API_KEY!, 'Content-Type': 'application/json' };
const [a, w] = await Promise.all([
fetch('https://api.scavio.dev/api/v1/amazon/search', { method: 'POST', headers: H, body: JSON.stringify({ query }) }).then(r => r.json()),
fetch('https://api.scavio.dev/api/v1/walmart/search', { method: 'POST', headers: H, body: JSON.stringify({ query }) }).then(r => r.json())
]);
return { amazon: a.products?.slice(0, 5) ?? [], walmart: w.products?.slice(0, 5) ?? [] };
}Step 3: Wire into Azure AI Foundry
Register product_search as an agent tool.
// In Azure AI Foundry agent config, point to the Function URL with API-Key auth.Step 4: Add Reddit signal as second tool
r/BuyItForLife and product subs.
async function redditOpinions(query: string) {
return fetch('https://api.scavio.dev/api/v1/reddit/search', { method: 'POST', headers: H, body: JSON.stringify({ query }) }).then(r => r.json());
}Step 5: Test end-to-end
Prompt: 'best home fitness equipment under $100 with positive Reddit reviews.'
// Agent uses both tools; LLM ranks based on cross-source signal.Python Example
# Equivalent Python with azure.functions framework.JavaScript Example
// TypeScript variant shown in steps.Expected Output
Azure-native product search agent that covers Amazon + Walmart + Reddit opinion signal. Outperforms single-source agents on subjective product queries.