Resumen
Este flujo de trabajo serializes diario resultados de busqueda en compact JSON files ese AI agents consume as context in their flujos de trabajo. Instead of agents making en tiempo real search calls durante execution (cual agrega latencia y cost), este pipeline pre-fetches search datos for comun consultas y almacena it in agent-optimized formato JSON. Agents cargar el pre-fetched context at el iniciar of their ejecutar, reducing per-execution llamadas un API mientras keeping datos fresh dentro de 24 horas.
Desencadenador
Cron programar (diario at 5:00 AM UTC)
Programación
Ejecuta diario at 5:00 AM UTC
Pasos del flujo de trabajo
Cargar agent consulta plantillas
Leer el lista of consultas ese agents commonly usar de el agent configuracion registry.
Ejecutar searches y recopilar resultados
Ejecutar cada consulta contra Scavio Google search y recopilar resultados organicos, AI Overviews, y PAA datos.
Compress y serialize resultados
Strip unnecessary campos, truncate long text, y serialize resultados en compact JSON for context injection.
Escribir to agent context almacenar
Save el serialized resultados to el shared context almacenar ese agents leer de at execution time.
Log freshness metadata
Record marcas de tiempo y consulta counts so agents puede verify context freshness antes de usando it.
Implementacion en Python
import requests
import json
from pathlib import Path
from datetime import datetime
API_KEY = "your_scavio_api_key"
# Queries that agents commonly use
AGENT_QUERIES = [
"best search API for AI agents 2026",
"web search API pricing comparison",
"structured SERP data providers",
"MCP search tool integration",
"AI agent web grounding methods",
]
def fetch_and_compress(query: str) -> dict:
res = requests.post(
"https://api.scavio.dev/api/v1/search",
headers={"x-api-key": API_KEY},
json={"platform": "google", "query": query, "ai_overview": True},
timeout=15,
)
res.raise_for_status()
data = res.json()
# Compress for agent consumption: only essential fields
return {
"q": query,
"organic": [
{"t": r.get("title", "")[:80], "s": r.get("snippet", "")[:150], "u": r.get("link", "")}
for r in data.get("organic", [])[:5]
],
"aio": (data.get("ai_overview") or {}).get("text", "")[:400],
"paa": [q.get("question", "") for q in data.get("people_also_ask", [])[:3]],
}
def run():
date = datetime.utcnow().strftime("%Y-%m-%d")
context_dir = Path("agent_context")
context_dir.mkdir(exist_ok=True)
results = [fetch_and_compress(q) for q in AGENT_QUERIES]
context = {
"fetched_at": datetime.utcnow().isoformat(),
"date": date,
"queries": len(results),
"data": results,
}
context_path = context_dir / "latest.json"
context_path.write_text(json.dumps(context, indent=2))
# Also archive by date
(context_dir / f"context_{date}.json").write_text(json.dumps(context, indent=2))
total_chars = sum(len(json.dumps(r)) for r in results)
print(f"Agent context bridge {date}: {len(results)} queries, {total_chars:,} chars total")
for r in results:
print(f" {r['q'][:50]}: {len(r['organic'])} results, AIO={'yes' if r['aio'] else 'no'}")
if __name__ == "__main__":
run()Implementacion en JavaScript
const API_KEY = "your_scavio_api_key";
const QUERIES = ["best search API for AI agents 2026", "web search API pricing comparison", "MCP search tool integration"];
async function fetchAndCompress(query) {
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: "google", query, ai_overview: true }),
});
if (!res.ok) throw new Error(`scavio ${res.status}`);
const data = await res.json();
return {
q: query,
organic: (data.organic ?? []).slice(0, 5).map((r) => ({ t: (r.title ?? "").slice(0, 80), s: (r.snippet ?? "").slice(0, 150), u: r.link ?? "" })),
aio: ((data.ai_overview ?? {}).text ?? "").slice(0, 400),
paa: (data.people_also_ask ?? []).slice(0, 3).map((q) => q.question ?? ""),
};
}
const results = [];
for (const q of QUERIES) results.push(await fetchAndCompress(q));
const totalChars = results.reduce((s, r) => s + JSON.stringify(r).length, 0);
console.log(`Agent context: ${results.length} queries, ${totalChars.toLocaleString()} chars`);Plataformas utilizadas
Búsqueda web con grafo de conocimiento, PAA y resúmenes de IA