Skip to main content
Enable agents to search the web and fetch page content for real-time information retrieval.

Quick Start

1

Simple Enable

Enable web capabilities with defaults:
from praisonaiagents import Agent

agent = Agent(
    name="Web Agent",
    instructions="Search the web for information",
    web=True
)
2

With Configuration

Configure search provider and settings:
from praisonaiagents import Agent
from praisonaiagents.config import WebConfig

agent = Agent(
    name="Web Agent",
    instructions="Search the web for information",
    web=WebConfig(
        search=True,
        fetch=True,
        search_provider="duckduckgo",
        max_results=5
    )
)

Configuration Options

from praisonaiagents.config import WebConfig, WebSearchProvider

config = WebConfig(
    # Enable web search
    search=True,
    
    # Enable web fetch (retrieve full page content)
    fetch=True,
    
    # Search provider
    search_provider=WebSearchProvider.DUCKDUCKGO,
    
    # Search settings
    max_results=5,
    
    # Provider-specific settings
    search_config=None,
    
    # Fetch config
    fetch_config=None
)
ParameterTypeDefaultDescription
searchboolTrueEnable web search capability
fetchboolTrueEnable page content fetching
search_providerstr | WebSearchProvider"duckduckgo"Search provider (duckduckgo, google, bing, tavily, serper)
max_resultsint5Maximum search results to return
search_configDict | NoneNoneProvider-specific search settings
fetch_configDict | NoneNonePage fetching configuration

Search Providers

ProviderAPI Key RequiredBest For
duckduckgoNoFree, privacy-focused
googleYesComprehensive results
bingYesMicrosoft ecosystem
tavilyYesAI-optimized search
serperYesGoogle results via API

Common Patterns

from praisonaiagents import Agent
from praisonaiagents.config import WebConfig

agent = Agent(
    name="AI Search Agent",
    instructions="Find accurate information",
    web=WebConfig(
        search_provider="tavily",
        max_results=10,
        search_config={"api_key": "your-tavily-key"}
    )
)

Pattern 2: Search Only (No Fetching)

from praisonaiagents import Agent
from praisonaiagents.config import WebConfig

agent = Agent(
    name="Search Agent",
    instructions="List search results",
    web=WebConfig(
        search=True,
        fetch=False,  # Don't fetch page content
        max_results=10
    )
)

Best Practices

DuckDuckGo requires no API key and is suitable for most use cases.
Tavily is designed for AI agents and returns more relevant, concise results.
Fewer results means faster responses. Start with 5 and increase if needed.