performanceasyncsearch-api

Parallel Multi-Platform Search for Faster Agents

Sequential multi-platform search takes 5-10 seconds. Parallel search with asyncio or Promise.all cuts it to 1-3 seconds. Same data, same cost, 3-5x faster.

5 min read

Searching five platforms sequentially takes 5-10 seconds: each API call waits for the previous one to complete. For an AI agent that needs to research a topic before responding, that is too slow for interactive use. Searching in parallel cuts the total time to the latency of the slowest single call, typically 1-3 seconds. Same data, 3-5x faster.

The parallel pattern

Use asyncio in Python or Promise.all in JavaScript to fire all platform searches simultaneously. Since Scavio uses the same API key for all platforms, there is no authentication overhead for additional parallel requests.

Python
import asyncio, aiohttp, os

async def parallel_search(query, platforms=['google', 'reddit', 'youtube']):
    async with aiohttp.ClientSession() as session:
        async def search(platform):
            async with session.post('https://api.scavio.dev/api/v1/search',
                headers={'x-api-key': os.environ['SCAVIO_API_KEY'],
                         'Content-Type': 'application/json'},
                json={'platform': platform, 'query': query}) as resp:
                data = await resp.json()
                return {'platform': platform, 'results': data.get('organic', [])}
        return await asyncio.gather(*[search(p) for p in platforms])

# 3 platforms, ~1.5s total (not 4.5s sequential)
results = asyncio.run(parallel_search('wireless earbuds 2026'))

When to use parallel vs sequential

Parallel: when you need data from multiple platforms for the same query. Research tasks, content ideation, comprehensive monitoring. Sequential with failover: when you need one good answer and want to try platforms in priority order. Agent tool calls, customer support grounding. The choice depends on whether you want breadth (parallel) or reliability (sequential failover).

Merge and deduplicate

Parallel results from multiple platforms may contain the same URLs (a Reddit thread that also appears in Google results). Deduplicate by URL before injecting into the LLM context. Tag each result with its source platform so the model can attribute findings and the user can judge reliability per source.

Cost is the same

Parallel does not cost more than sequential. You pay per query regardless of timing. Three parallel searches cost the same as three sequential searches: $0.015. The only difference is wall clock time: 1.5 seconds instead of 4.5 seconds. Speed is free.