Skip to content

Commit

Permalink
xAI agent team
Browse files Browse the repository at this point in the history
  • Loading branch information
ashpreetbedi committed Nov 25, 2024
1 parent aa4ecaf commit 5bcfc55
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions cookbook/providers/xai/agent_team.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from phi.agent import Agent
from phi.model.xai import xAI
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=xAI(id="grok-beta"),
tools=[DuckDuckGo()],
instructions=["Always include sources"],
show_tool_calls=True,
markdown=True,
)

finance_agent = Agent(
name="Finance Agent",
role="Get financial data",
model=xAI(id="grok-beta"),
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 TSLA", stream=True)

0 comments on commit 5bcfc55

Please sign in to comment.