web_search.py
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
python3 -m venv ~/.venvs/aienv source ~/.venvs/aienv/bin/activate
Install libraries
pip install openai duckduckgo-search phidata
Run the agent
python web_search.py
Was this page helpful?