Search Providers

Pick a web-search backend (DuckDuckGo, Tavily, Serper) for your agent — or plug in your own

Pick a web-search backend (DuckDuckGo, Tavily, Serper) for your agent — or plug in your own.

python
from praisonaiagents import Agent

agent = Agent(
    name="Researcher",
    instructions="Search the web and summarise findings.",
    web=True,
)
agent.start("Latest news on renewable energy")

The user enables web=True; PraisonAI routes searches through DuckDuckGo, Tavily, Serper, or a custom provider.

Diagram

Agent

SearchProviderRegistry

DuckDuckGo / Tavily / Serper

Search results

How It Works

Diagram
Search ProvidersAgentUserSearch ProvidersAgentUserRequestProcess requestResult Agent–>>User: Response

Quick Start

  1. Simple Usage

    Give your agent web search with the default DuckDuckGo provider:

    python
    from praisonaiagents import Agent
    
    agent = Agent(
        name="Researcher",
        instructions="Search the web and summarise findings.",
        web=True,
    )
    agent.start("Latest news on renewable energy")
  2. Switch providers via config

    Select Tavily or Serper from the CLI or bot config:

    bash
    praisonai bot run telegram --web-search --web-provider tavily
    python
    from praisonaiagents import Agent
    
    agent = Agent(
        name="Researcher",
        instructions="Use Tavily for deep web search.",
        web=True,
    )
    # Set WEB_SEARCH_PROVIDER=tavily in the environment, or pass via bot YAML
  3. Register a custom search provider

    Distribute a custom provider as a pip plugin:

    toml
    # pyproject.toml
    [project.entry-points."praisonai.tools.search"]
    my-search = "my_pkg.tools:MySearchTool"
    python
    from praisonai.cli.features._search_registry import SearchProviderRegistry
    
    registry = SearchProviderRegistry.default()
    tool_cls = registry.resolve("my-search")
    tool = tool_cls()

Built-in Providers

ProviderAPI key needed?Free tierBest for
duckduckgoNoYesDefault, no setup, general queries
tavilyYes (TAVILY_API_KEY)LimitedResearch-grade results, citations
serperYes (SERPER_API_KEY)LimitedGoogle SERP-style results

Entry-point group: praisonai.tools.search


Which Provider Should I Pick?

Diagram

No

Yes

Yes

No, SERP-style

Need web search?

Have an API key?

duckduckgo

Need citations / research?

tavily

serper


Best Practices

Store API keys in the environment

Set TAVILY_API_KEY or SERPER_API_KEY in your shell or deployment secrets — never hard-code keys in agent instructions.

bash
export TAVILY_API_KEY=tvly-...
praisonai bot run telegram --web-search --web-provider tavily
Fall back to DuckDuckGo

The registry falls back to duckduckgo when an unknown provider name is requested — useful for resilient bot configs.

Cache repeated queries

For high-volume agents, cache search results in Redis or session memory to avoid rate limits on paid providers.


Related