web_search.py with the following code:
web_search.py
Usage
1
Create a virtual environment
Open the
Terminal and create a python virtual environment.2
Install libraries
3
Run the agent
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
web_search.py with the following code:
from phi.agent import Agent
from phi.model.openai import OpenAIChat
from phi.tools.duckduckgo import DuckDuckGo
web_agent = Agent(
name="Web Agent",
model=OpenAIChat(id="gpt-4o"),
tools=[DuckDuckGo()],
instructions=["Always include sources"],
show_tool_calls=True,
markdown=True,
)
web_agent.print_response("Whats happening in France?", stream=True)
Create a virtual environment
Terminal and create a python virtual environment.python3 -m venv ~/.venvs/aienv
source ~/.venvs/aienv/bin/activate
python3 -m venv aienv
aienv/scripts/activate
Install libraries
pip install openai duckduckgo-search phidata
Run the agent
python web_search.py
Was this page helpful?