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.
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.
How It Works
Quick Start
- 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") - Switch providers via config
Select Tavily or Serper from the CLI or bot config:
bash praisonai bot run telegram --web-search --web-provider tavilypython 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 - 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
| Provider | API key needed? | Free tier | Best for |
|---|---|---|---|
duckduckgo | No | Yes | Default, no setup, general queries |
tavily | Yes (TAVILY_API_KEY) | Limited | Research-grade results, citations |
serper | Yes (SERPER_API_KEY) | Limited | Google SERP-style results |
Entry-point group: praisonai.tools.search
Which Provider Should I Pick?
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.
export TAVILY_API_KEY=tvly-...
praisonai bot run telegram --web-search --web-provider tavilyFall 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.