nexo-web-search
Multi-provider web search router for Nexo — Brave / Tavily / DuckDuckGo / Perplexity behind one trait, with caching, sanitisation, and per-provider circuit breakers.
This crate is part of Nexo — a multi-agent Rust framework with a NATS event bus, pluggable LLM providers (MiniMax, Anthropic, OpenAI-compat, Gemini, DeepSeek), per-agent credentials, MCP support, and channel plugins for WhatsApp, Telegram, Email, and Browser (CDP).
- Main repo: https://github.com/lordmacu/nexo-rs
- Runtime engine:
nexo-core - Public docs: https://lordmacu.github.io/nexo-rs/
What this crate does
SearchProvidertrait — uniformsearch(args) -> Result<SearchResult>shape implemented byBraveProvider,TavilyProvider,DuckDuckGoProvider,PerplexityProvider. New providers just impl the trait.WebSearchRouter— fanout / fallback orchestrator.provider: autopicks the first credentialed in priority order; explicitprovider:overrides per call.- LRU result cache — TTL-based (
cache_ttl_secs), query-keyed; cache hits don't count against per-provider rate limits. - Per-provider circuit breaker — uses
nexo-resilience. A flapping provider opens its breaker; the router auto-skips to the next. - Result sanitisation — strips tracking params (
utm_*,fbclid, …), HTML entities in titles, and oversized snippets. - Telemetry —
nexo_web_search_calls_total{provider,result},nexo_web_search_cache_total{provider,hit},nexo_web_search_breaker_open_total{provider},nexo_web_search_latency_ms{provider}histogram. - Used by the
web_searchagent tool (source) — agents call it throughnexo-core's tool registry.
Public API
Configuration
# config/agents.yaml — per-agent gating
agents:
- id: ana
web_search:
enabled: true
provider: auto # auto | brave | tavily | duckduckgo | perplexity
default_count: 5 # 1..=10
cache_ttl_secs: 600 # 0 disables cache
expand_default: false
API keys via env: BRAVE_SEARCH_API_KEY, TAVILY_API_KEY,
PERPLEXITY_API_KEY. DuckDuckGo doesn't need a key.
Install
[]
= "0.1"
Documentation for this crate
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.