Live web search and fetch with WebConfig
Give any agent live web access in one parameter
Language models freeze knowledge at their training cutoff. Pass web=True or WebConfig(search=True, fetch=True, max_results=5) so your agent can search current information and fetch source pages directly.
Example
from praisonai import Agent, WebConfig
web_cfg = WebConfig(search=True, fetch=False, max_results=3)
researcher = Agent(
name='WebResearcher',
instructions='Answer in one concise sentence.',
web=web_cfg,
output='silent',
)
print('WebConfig -> search:', web_cfg.search, '| max_results:', web_cfg.max_results)
print(researcher.start('What is PraisonAI in one sentence?'))Example explained
- WebConfig(search=True, fetch=True, max_results=3) — Enables web search + page fetching while capping result volume to save tokens.
- web=True — One-line shorthand for default search and fetch capabilities.
Choose search vs RAG carefully
Use web=True for public, constantly changing internet facts; use Knowledge (RAG) for private internal documentation and company policies.
Common pitfall: fetching huge pages without capping max_results
Fetching 10 full HTML pages can blow past context limits. Start with max_results=3 and instruct the agent to cite URLs.
Reference: documentation