Prerequisites
- Python 3.10 or higher
- PraisonAI Agents package installed
- At least one search provider configured (API key or package)
search_web tool provides a unified interface for web search that automatically tries multiple providers in order, falling back to the next if one fails.
Search Provider Priority
| Priority | Provider | Requirements |
|---|---|---|
| 1 | Tavily | TAVILY_API_KEY + tavily-python |
| 2 | Exa | EXA_API_KEY + exa_py |
| 3 | You.com | YDC_API_KEY + youdotcom |
| 4 | DuckDuckGo | duckduckgo_search (no API key) |
| 5 | SearxNG | requests + running SearxNG instance |
Installation
Setup
Basic Usage
Simple Search
With Max Results
Specify Providers
Check Available Providers
With PraisonAI Agent
Multi-Agent Research
Fallback Logic
For each provider in order:- Check API key (if required) → skip if not set
- Check package availability → skip if not installed
- Try search → on success, return results
- On failure → log error and try next provider
Response Format
Each result contains:| Field | Type | Description |
|---|---|---|
title | str | Result title |
url | str | Result URL |
snippet | str | Result description/snippet |
provider | str | Name of the provider that returned the result |
Error Handling
If all providers fail, returns a list with a single error dict:Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
query | str | required | Search query string |
max_results | int | 5 | Maximum number of results |
providers | list | None | List of provider names to try in order |
searxng_url | str | None | Custom SearxNG instance URL |
Key Points
- Zero configuration: Works with DuckDuckGo out of the box (no API key)
- Automatic fallback: Tries providers in order until one succeeds
- Unified response: Same response format regardless of provider
- Provider info: Each result includes which provider returned it
- Graceful degradation: Always returns results if any provider works

