This example shows how to create a powerful team of AI agents working together to provide comprehensive financial analysis and news reporting. The team consists of:
  1. Web Agent: Searches and analyzes latest news
  2. Finance Agent: Analyzes financial data and market trends
  3. Lead Editor: Coordinates and combines insights from both agents
Example prompts to try:
  • “What’s the latest news and financial performance of Apple (AAPL)?”
  • “Analyze the impact of AI developments on NVIDIA’s stock (NVDA)”
  • “How are EV manufacturers performing? Focus on Tesla (TSLA) and Rivian (RIVN)”
  • “What’s the market outlook for semiconductor companies like AMD and Intel?”
  • “Summarize recent developments and stock performance of Microsoft (MSFT)“

Code

agent_team.py
from textwrap import dedent

from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.duckduckgo import DuckDuckGoTools

web_agent = Agent(
    name="Web Agent",
    role="Search the web for information",
    model=OpenAIChat(id="gpt-4o"),
    tools=[DuckDuckGoTools()],
    instructions=dedent("""\
        You are an experienced web researcher and news analyst! 🔍

        Follow these steps when searching for information:
        1. Start with the most recent and relevant sources
        2. Cross-reference information from multiple sources
        3. Prioritize reputable news outlets and official sources
        4. Always cite your sources with links
        5. Focus on market-moving news and significant developments

        Your style guide:
        - Present information in a clear, journalistic style
        - Use bullet points for key takeaways
        - Include relevant quotes when available
        - Specify the date and time for each piece of news
        - Highlight market sentiment and industry trends
        - End with a brief analysis of the overall narrative
        - Pay special attention to regulatory news, earnings reports, and strategic announcements\
    """),
    show_tool_calls=True,
    markdown=True,
)

research_agent = Agent(
    name="Research Agent",
    role="Get research data and insights",
    model=OpenAIChat(id="gpt-4o"),
    tools=[
        DuckDuckGoTools(search=True, news=True)
    ],
    instructions=dedent("""\
        You are a skilled research analyst with expertise in information gathering! 📊

        Follow these steps when analyzing research data:
        1. Start with the latest developments, trends, and key findings
        2. Present detailed insights and expert perspectives
        3. Include key metrics: growth rates, market share, adoption rates
        4. Analyze patterns and emerging trends
        5. Compare developments against industry benchmarks

        Your style guide:
        - Use tables for structured data presentation
        - Include clear headers for each data section
        - Add brief explanations for technical terms
        - Highlight notable changes with emojis (📈 📉)
        - Use bullet points for quick insights
        - Compare current values with historical trends
        - End with a data-driven research outlook\
    """),
    show_tool_calls=True,
    markdown=True,
)

agent_team = Agent(
    team=[web_agent, research_agent],
    model=OpenAIChat(id="gpt-4o"),
    instructions=dedent("""\
        You are the lead editor of a prestigious financial news desk! 📰

        Your role:
        1. Coordinate between the web researcher and research analyst
        2. Combine their findings into a compelling narrative
        3. Ensure all information is properly sourced and verified
        4. Present a balanced view of both news and research data
        5. Highlight key trends and opportunities

        Your style guide:
        - Start with an attention-grabbing headline
        - Begin with a powerful executive summary
        - Present research findings first, followed by news context
        - Use clear section breaks between different types of information
        - Include relevant charts or tables when available
        - Add 'Current Trends' section with emerging patterns
        - Include a 'Key Takeaways' section at the end
        - End with 'Future Outlook' when appropriate
        - Sign off with 'Research Team' and the current date\
    """),
    add_datetime_to_instructions=True,
    show_tool_calls=True,
    markdown=True,
)

# Example usage with diverse queries
agent_team.print_response(
    "Summarize the latest developments and share recent news about renewable energy technology", stream=True
)
agent_team.print_response(
    "What's the current outlook and recent developments in artificial intelligence and machine learning?",
    stream=True,
)
agent_team.print_response(
    "Analyze recent developments and financial performance of TSLA", stream=True
)

# More example prompts to try:
"""
Advanced queries to explore:
1. "Compare the financial performance and recent news of major cloud providers (AMZN, MSFT, GOOGL)"
2. "What's the impact of recent Fed decisions on banking stocks? Focus on JPM and BAC"
3. "Analyze the gaming industry outlook through ATVI, EA, and TTWO performance"
4. "How are social media companies performing? Compare META and SNAP"
5. "What's the latest on AI chip manufacturers and their market position?"
"""

Usage

1

Create a virtual environment

Open the Terminal and create a python virtual environment.
python3 -m venv .venv
source .venv/bin/activate
2

Install libraries

pip install openai duckduckgo-search ddgs agno
3

Run the agent

python agent_team.py