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.
Quick Start
1
Install
2
Search with agent
Search Provider Priority
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:Error Handling
If all providers fail, returns a list with a single error dict:Parameters
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
Best Practices
Install DuckDuckGo as minimum fallback
Install DuckDuckGo as minimum fallback
Run
pip install duckduckgo_search to ensure search_web always has at least one provider.Order providers by quality
Order providers by quality
Configure
providers=['tavily', 'exa', 'duckduckgo'] - paid providers first for higher quality.Check provider availability at startup
Check provider availability at startup
Call
get_available_providers() on startup to log which providers are active.Use max_results=5 for most tasks
Use max_results=5 for most tasks
Five results gives enough context for most agent tasks - more results increase token usage.
Related
Custom Tools
Build your own agent tools
Tools Overview
Browse PraisonAI tool documentation

