Skip to main content
The user asks an open web question; the agent runs built-in web search and synthesises results.
Prerequisites
  • Python 3.10 or higher
  • PraisonAI Agents package installed
  • At least one search provider configured (API key or package)
The 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

With Max Results

Specify Providers

Check Available Providers

With PraisonAI Agent

Multi-Agent Research

Fallback Logic

For each provider in order:
  1. Check API key (if required) → skip if not set
  2. Check package availability → skip if not installed
  3. Try search → on success, return results
  4. On failure → log error and try next provider
This ensures your search always works as long as at least one provider is available.

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

Run pip install duckduckgo_search to ensure search_web always has at least one provider.
Configure providers=['tavily', 'exa', 'duckduckgo'] - paid providers first for higher quality.
Call get_available_providers() on startup to log which providers are active.
Five results gives enough context for most agent tasks - more results increase token usage.

Custom Tools

Build your own agent tools

Tools Overview

Browse PraisonAI tool documentation