Agents
Research Agent
Examples
- Introduction
- Agents
- Web Search Agent
- AI Recipe Creator Agent
- Finance Agent
- Books Recommendation Agent
- Shopping Agent
- Weekend Planner Agent
- Agent Team
- Reasoning Agent
- Python Agent
- Data Analyst
- Structured Output
- Python Function Agent
- Image Agent
- Generate Image Agent
- Cal.com Agent
- Image to Text Agent
- Research Agent
- ModelsLabs Agent
- Slack Agent
- Discord Agent
- Firecrawl Agent
- Github Agent
- RAG Agent
- Popcorn Pal
- Globe Hopper Agent
- Baidu Search Agent
- Youtube Timestamp Agent
- Study Scout Agent
- Models
- Integrations
- Agent Teams
- Use Cases
How To
Agents
Research Agent
Create a file research_agent.py
with the following code:
rag_agent.py
from phi.agent import Agent
from phi.model.openai import OpenAIChat
from phi.tools.duckduckgo import DuckDuckGo
from phi.tools.newspaper4k import Newspaper4k
agent = Agent(
model=OpenAIChat(id="gpt-4o"),
tools=[DuckDuckGo(), Newspaper4k()],
description="You are a senior NYT researcher writing an article on a topic.",
instructions=[
"For a given topic, search for the top 5 links.",
"Then read each URL and extract the article text, if a URL isn't available, ignore it.",
"Analyse and prepare an NYT worthy article based on the information.",
],
markdown=True,
show_tool_calls=True,
add_datetime_to_instructions=True,
# debug_mode=True,
)
agent.print_response("Simulation theory", stream=True)
Usage
1
Create a virtual environment
Open the Terminal
and create a python virtual environment.
python3 -m venv ~/.venvs/aienv
source ~/.venvs/aienv/bin/activate
2
Install libraries
pip install openai duckduckgo-search newspaper4k lxml_html_clean phidata
3
Run the agent
python research_agent.py
Was this page helpful?
On this page