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
Agent Team
Create a file agent_team.py
with the following code:
agent_team.py
from phi.agent import Agent
from phi.model.openai import OpenAIChat
from phi.tools.duckduckgo import DuckDuckGo
from phi.tools.yfinance import YFinanceTools
web_agent = Agent(
name="Web Agent",
role="Search the web for information",
model=OpenAIChat(id="gpt-4o"),
tools=[DuckDuckGo()],
instructions=["Always include sources"],
show_tool_calls=True,
markdown=True,
)
finance_agent = Agent(
name="Finance Agent",
role="Get financial data",
model=OpenAIChat(id="gpt-4o"),
tools=[YFinanceTools(stock_price=True, analyst_recommendations=True, company_info=True)],
instructions=["Use tables to display data"],
show_tool_calls=True,
markdown=True,
)
agent_team = Agent(
team=[web_agent, finance_agent],
instructions=["Always include sources", "Use tables to display data"],
show_tool_calls=True,
markdown=True,
)
agent_team.print_response("Summarize analyst recommendations and share the latest news for NVDA", stream=True)
Usage
1
Create a virtual environment
Open the Terminal
and create a python virtual environment.
2
Install libraries
pip install openai yfinance duckduckgo-search phidata
3
Run the agent
python agent_team.py
Was this page helpful?
On this page