Workflow

Multi-Vendor Search Failover Workflow

Production failover pattern: primary search API fails, rotate to secondary within the same request. No downtime, no user-facing errors.

Overview

Wrap search calls in a failover chain: try primary vendor, catch errors or timeouts, rotate to secondary. Log which vendor served each request for cost tracking. Keeps uptime above 99.9% even during vendor outages.

Trigger

Every search request in production

Schedule

Every search request

Workflow Steps

1

Define vendor priority list

Primary: Scavio. Secondary: Serper. Tertiary: Brave Search API. Stored in config.

2

Try primary vendor

POST to Scavio /api/v1/search with 5s timeout.

3

On failure: rotate to secondary

Catch timeout/5xx, log the failure, try Serper with same query.

4

On failure: rotate to tertiary

If secondary also fails, try Brave Search API.

5

Log vendor used

Record which vendor served the response for cost reconciliation and reliability metrics.

6

Return result to caller

Caller sees a unified response shape regardless of which vendor served it.

Python Implementation

Python
import requests, os, time

vendors = [
    {"name": "scavio", "url": "https://api.scavio.dev/api/v1/search",
     "headers": {"x-api-key": os.environ["SCAVIO_API_KEY"]},
     "body": lambda q: {"query": q, "platform": "google", "limit": 10}},
    {"name": "serper", "url": "https://google.serper.dev/search",
     "headers": {"X-API-KEY": os.environ.get("SERPER_KEY", "")},
     "body": lambda q: {"q": q}},
]

def search_with_failover(query: str):
    for v in vendors:
        try:
            resp = requests.post(v["url"], headers=v["headers"],
                json=v["body"](query), timeout=5)
            resp.raise_for_status()
            return {"vendor": v["name"], "results": resp.json()}
        except Exception as e:
            print(f"{v['name']} failed: {e}")
    raise RuntimeError("All vendors failed")

print(search_with_failover("best crm 2026"))

JavaScript Implementation

JavaScript
async function searchWithFailover(query) {
  const vendors = [
    { name: "scavio", url: "https://api.scavio.dev/api/v1/search",
      headers: { "x-api-key": process.env.SCAVIO_API_KEY },
      body: { query, platform: "google", limit: 10 } },
    { name: "serper", url: "https://google.serper.dev/search",
      headers: { "X-API-KEY": process.env.SERPER_KEY },
      body: { q: query } },
  ];
  for (const v of vendors) {
    try {
      const resp = await fetch(v.url, {
        method: "POST", headers: { ...v.headers, "Content-Type": "application/json" },
        body: JSON.stringify(v.body), signal: AbortSignal.timeout(5000)
      });
      if (!resp.ok) throw new Error(resp.statusText);
      return { vendor: v.name, results: await resp.json() };
    } catch (e) { console.error(`${v.name} failed: ${e.message}`); }
  }
  throw new Error("All vendors failed");
}

Platforms Used

Google

Web search with knowledge graph, PAA, and AI overviews

Frequently Asked Questions

Wrap search calls in a failover chain: try primary vendor, catch errors or timeouts, rotate to secondary. Log which vendor served each request for cost tracking. Keeps uptime above 99.9% even during vendor outages.

This workflow uses a every search request in production. Every search request.

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

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

Multi-Vendor Search Failover Workflow

Production failover pattern: primary search API fails, rotate to secondary within the same request. No downtime, no user-facing errors.