The Problem
AI agents make more search calls than developers expect. A ReAct agent might search 3-8 times per user query, and agentic workflows with multiple steps can easily hit 20+ searches per session. At $0.01-0.025/search with traditional SERP APIs, costs add up fast: 10K daily agent sessions at 5 searches each is 50K searches/day, costing $500-1,250/day. Many teams discover their search API bill is the single largest infrastructure cost after LLM inference.
The Scavio Solution
Reduce agent search costs with three strategies: use a cheaper per-query API (Scavio at $0.005 vs $0.01-0.025), implement result caching for repeated queries within the same session, and add a search budget per agent session that forces the agent to reason before searching. These three changes typically reduce search costs by 60-80% with no quality loss.
Before
Before: An agent averaged 6 searches per session at $0.015/search (SerpAPI). With 10K sessions/day, the monthly search bill was $27,000. Caching was not implemented. The agent searched redundantly for similar queries within the same conversation.
After
After: Switching to Scavio ($0.005/search) cut the base cost by 67%. Adding a TTL cache for identical queries within a session reduced search volume by 30%. A 4-search budget per session forced the agent to be deliberate, reducing average searches from 6 to 3.5. Monthly bill dropped from $27,000 to $3,675 (86% reduction).
Who It Is For
Agent developers and engineering leads managing search API costs for production agents. Anyone whose search API bill has become the second-largest infrastructure cost after LLM inference.
Key Benefits
- Cut per-search cost 50-80% by switching from $0.01-0.025 APIs to $0.005
- In-session caching reduces redundant searches by 25-35%
- Search budgets force agents to reason before searching, reducing volume 30-40%
- Combined strategies yield 60-80% total cost reduction
- Monthly savings of $20K+ for high-volume agent deployments
Python Example
import requests
import hashlib
import json
from functools import lru_cache
API_KEY = "your_scavio_api_key"
SESSION_BUDGET = 4
class CachedSearch:
def __init__(self):
self.cache = {}
self.session_count = 0
def search(self, query: str, platform: str = "google") -> dict:
cache_key = hashlib.md5(f"{platform}:{query}".encode()).hexdigest()
if cache_key in self.cache:
return self.cache[cache_key] # Free: cached result
if self.session_count >= SESSION_BUDGET:
return {"error": "search budget exceeded", "remaining": 0}
r = requests.post(
"https://api.scavio.dev/api/v1/search",
headers={"x-api-key": API_KEY},
json={"platform": platform, "query": query},
timeout=10,
)
result = r.json()
self.cache[cache_key] = result
self.session_count += 1
return result
searcher = CachedSearch()
print(searcher.search("python async patterns")) # API call (1/4)
print(searcher.search("python async patterns")) # Cache hit (free)
print(f"Budget remaining: {SESSION_BUDGET - searcher.session_count}")JavaScript Example
const API_KEY = "your_scavio_api_key";
const SESSION_BUDGET = 4;
class CachedSearch {
constructor() {
this.cache = new Map();
this.sessionCount = 0;
}
async search(query, platform = "google") {
const cacheKey = `${platform}:${query}`;
if (this.cache.has(cacheKey)) return this.cache.get(cacheKey);
if (this.sessionCount >= SESSION_BUDGET) {
return { error: "search budget exceeded", remaining: 0 };
}
const res = await fetch("https://api.scavio.dev/api/v1/search", {
method: "POST",
headers: { "x-api-key": API_KEY, "content-type": "application/json" },
body: JSON.stringify({ platform, query }),
});
const result = await res.json();
this.cache.set(cacheKey, result);
this.sessionCount++;
return result;
}
}
const searcher = new CachedSearch();
console.log(await searcher.search("python async patterns")); // API call (1/4)
console.log(await searcher.search("python async patterns")); // Cache hit (free)
console.log(`Budget remaining: ${SESSION_BUDGET - searcher.sessionCount}`);Platforms Used
Web search with knowledge graph, PAA, and AI overviews
YouTube
Video search with transcripts and metadata
Amazon
Product search with prices, ratings, and reviews
Community, posts & threaded comments from any subreddit