Workflow

Agent Search Provider Health Check Workflow

Scheduled workflow that tests search API health across platforms with latency, result quality, and SLA monitoring for agent reliability.

Overview

Run periodic health checks against your search API to verify latency, result quality, and availability. Detect degradation before it affects production agents. Track SLA compliance over time.

Trigger

Every 15 minutes via cron

Schedule

Every 15 minutes

Workflow Steps

1

Define test queries

Maintain a set of known-good test queries across platforms: Google (informational), Amazon (product), YouTube (video), Reddit (discussion). Each has expected minimum result counts.

2

Execute test searches

Run each test query and measure response time, HTTP status, and result count. Parse results to verify structural integrity (titles, links, snippets present).

3

Validate result quality

Check that results meet quality thresholds: minimum result count, all top-3 results have titles and links, response under SLA latency.

4

Log and alert

Log pass/fail status for each test. If any platform fails 2 consecutive checks, send an alert via Slack or PagerDuty.

5

Generate daily SLA report

At end of day, calculate uptime percentage, p50/p95 latency, and quality score per platform. Store for trend analysis.

Python Implementation

Python
import requests, os, time, json

H = {'x-api-key': os.environ['SCAVIO_API_KEY']}

TESTS = [
    {'query': 'python programming', 'platform': 'google', 'min_results': 5},
    {'query': 'wireless headphones', 'platform': 'amazon', 'min_results': 3},
    {'query': 'javascript tutorial', 'platform': 'youtube', 'min_results': 3},
    {'query': 'programming advice', 'platform': 'reddit', 'min_results': 3},
]
SLA_LATENCY_MS = 3000

def run_health_check(test):
    start = time.time()
    try:
        r = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
            json={'platform': test['platform'], 'query': test['query']},
            timeout=10).json()
        latency_ms = int((time.time() - start) * 1000)
        organic = r.get('organic', [])
        checks = {
            'has_results': len(organic) > 0,
            'meets_min': len(organic) >= test['min_results'],
            'has_titles': all(o.get('title') for o in organic[:3]),
            'has_links': all(o.get('link') for o in organic[:3]),
            'under_sla': latency_ms < SLA_LATENCY_MS,
        }
        return {
            'platform': test['platform'], 'query': test['query'],
            'status': 'OK' if all(checks.values()) else 'DEGRADED',
            'latency_ms': latency_ms, 'result_count': len(organic), 'checks': checks,
        }
    except Exception as e:
        return {'platform': test['platform'], 'query': test['query'],
                'status': 'DOWN', 'error': str(e)}

for test in TESTS:
    result = run_health_check(test)
    print(f"[{result['status']}] {result['platform']}/{result['query']} | "
          f"{result.get('latency_ms', 'N/A')}ms | {result.get('result_count', 0)} results")

JavaScript Implementation

JavaScript
const H = {"x-api-key": process.env.SCAVIO_API_KEY, "Content-Type": "application/json"};

const TESTS = [
  {query: "python programming", platform: "google", minResults: 5},
  {query: "wireless headphones", platform: "amazon", minResults: 3},
  {query: "javascript tutorial", platform: "youtube", minResults: 3},
  {query: "programming advice", platform: "reddit", minResults: 3},
];
const SLA_LATENCY_MS = 3000;

async function runHealthCheck(test) {
  const start = Date.now();
  try {
    const r = await fetch("https://api.scavio.dev/api/v1/search", {
      method: "POST", headers: H,
      body: JSON.stringify({platform: test.platform, query: test.query})
    }).then(r => r.json());
    const latencyMs = Date.now() - start;
    const organic = r.organic || [];
    const checks = {
      hasResults: organic.length > 0,
      meetsMin: organic.length >= test.minResults,
      hasTitles: organic.slice(0, 3).every(o => o.title),
      hasLinks: organic.slice(0, 3).every(o => o.link),
      underSla: latencyMs < SLA_LATENCY_MS,
    };
    return {
      platform: test.platform, query: test.query,
      status: Object.values(checks).every(Boolean) ? "OK" : "DEGRADED",
      latencyMs, resultCount: organic.length, checks,
    };
  } catch (e) {
    return {platform: test.platform, query: test.query, status: "DOWN", error: e.message};
  }
}

(async () => {
  for (const test of TESTS) {
    const r = await runHealthCheck(test);
    console.log(`[${r.status}] ${r.platform}/${r.query} | ${r.latencyMs || "N/A"}ms | ${r.resultCount || 0} results`);
  }
})();

Platforms Used

Google

Web search with knowledge graph, PAA, and AI overviews

Amazon

Product search with prices, ratings, and reviews

YouTube

Video search with transcripts and metadata

Reddit

Community, posts & threaded comments from any subreddit

Frequently Asked Questions

Run periodic health checks against your search API to verify latency, result quality, and availability. Detect degradation before it affects production agents. Track SLA compliance over time.

This workflow uses a every 15 minutes via cron. Every 15 minutes.

This workflow uses the following Scavio platforms: google, amazon, youtube, reddit. Each platform is called via the same unified API endpoint.

Yes. Scavio's free tier includes 250 credits per month with no credit card required. That is enough to test and validate this workflow before scaling it.

Agent Search Provider Health Check Workflow

Scheduled workflow that tests search API health across platforms with latency, result quality, and SLA monitoring for agent reliability.