> ## Documentation Index
> Fetch the complete documentation index at: https://phidatainc-studio-tools-doc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Team with Reasoning Tools

This is a multi-agent team reasoning example with reasoning tools.

<Tip>
  Enabling the reasoning option on the team leader helps optimize delegation and enhances multi-agent collaboration by selectively invoking deeper reasoning when required.
</Tip>

<Steps>
  <Step title="Add the following code to your Python file">
    ```python reasoning_finance_team.py theme={null}
    from textwrap import dedent

    from agno.agent import Agent
    from agno.models.anthropic import Claude
    from agno.models.openai import OpenAIResponses
    from agno.team.team import Team
    from agno.tools.hackernews import HackerNewsTools
    from agno.tools.reasoning import ReasoningTools

    web_agent = Agent(
        name="Web Search Agent",
        role="Handle web search requests",
        model=OpenAIResponses(id="gpt-5.2"),
        tools=[HackerNewsTools()],
        instructions="Always include sources",
        add_datetime_to_context=True,
    )

    finance_agent = Agent(
        name="Finance Agent",
        role="Handle financial data requests",
        model=OpenAIResponses(id="gpt-5.2"),
        tools=[HackerNewsTools()],
        instructions=[
            "You are a financial data specialist. Provide concise and accurate data.",
            "Use tables to display stock prices, fundamentals (P/E, Market Cap), and recommendations.",
            "Clearly state the company name and ticker symbol.",
            "Briefly summarize recent company-specific news if available.",
            "Focus on delivering the requested financial data points clearly.",
        ],
        add_datetime_to_context=True,
    )

    team_leader = Team(
        name="Reasoning Finance Team Leader",
        model=Claude(id="claude-sonnet-4-5"),
        members=[
            web_agent,
            finance_agent,
        ],
        tools=[ReasoningTools(add_instructions=True)],
        instructions=[
            "Only output the final answer, no other text.",
            "Use tables to display data",
        ],
        markdown=True,
        show_members_responses=True,
        add_datetime_to_context=True,
    )


    def run_team(task: str):
        team_leader.print_response(
            task,
            stream=True,
            show_full_reasoning=True,
        )


    if __name__ == "__main__":
        run_team(
            dedent("""\
        Analyze the impact of recent US tariffs on market performance across these key sectors:
        - Steel & Aluminum: (X, NUE, AA)
        - Technology Hardware: (AAPL, DELL, HPQ)
        - Agricultural Products: (ADM, BG, INGR)
        - Automotive: (F, GM, TSLA)

        For each sector:
        1. Compare stock performance before and after tariff implementation
        2. Identify supply chain disruptions and cost impact percentages
        3. Analyze companies' strategic responses (reshoring, price adjustments, supplier diversification)
        4. Assess analyst outlook changes directly attributed to tariff policies
        """)
        )

        # run_team(dedent("""\
        # Assess the impact of recent semiconductor export controls on:
        # - US chip designers (Nvidia, AMD, Intel)
        # - Asian manufacturers (TSMC, Samsung)
        # - Equipment makers (ASML, Applied Materials)
        # Include effects on R&D investments, supply chain restructuring, and market share shifts."""))

        # run_team(dedent("""\
        # Compare the retail sector's response to consumer goods tariffs:
        # - Major retailers (Walmart, Target, Amazon)
        # - Consumer brands (Nike, Apple, Hasbro)
        # - Discount retailers (Dollar General, Five Below)
        # Include pricing strategy changes, inventory management, and consumer behavior impacts."""))

        # run_team(dedent("""\
        # Analyze the semiconductor market performance focusing on:
        # - NVIDIA (NVDA)
        # - AMD (AMD)
        # - Intel (INTC)
        # - Taiwan Semiconductor (TSM)
        # Compare their market positions, growth metrics, and future outlook."""))

        # run_team(dedent("""\
        # Evaluate the automotive industry's current state:
        # - Tesla (TSLA)
        # - Ford (F)
        # - General Motors (GM)
        # - Toyota (TM)
        # Include EV transition progress and traditional auto metrics."""))

        # run_team(dedent("""\
        # Compare the financial metrics of Apple (AAPL) and Google (GOOGL):
        # - Market Cap
        # - P/E Ratio
        # - Revenue Growth
        # - Profit Margin"""))

        # run_team(dedent("""\
        # Analyze the impact of recent Chinese solar panel tariffs on:
        # - US solar manufacturers (First Solar, SunPower)
        # - Chinese exporters (JinkoSolar, Trina Solar)
        # - US installation companies (Sunrun, SunPower)
        # Include effects on pricing, supply chains, and installation rates."""))
    ```
  </Step>

  <Snippet file="create-venv-step.mdx" />

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U openai anthropic agno ddgs
    ```
  </Step>

  <Step title="Export your API keys">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
        export OPENAI_API_KEY="your_openai_api_key_here"
        export ANTHROPIC_API_KEY="your_anthropic_api_key_here"
      ```

      ```bash Windows theme={null}
        $Env:OPENAI_API_KEY="your_openai_api_key_here"
        $Env:ANTHROPIC_API_KEY="your_anthropic_api_key_here"
      ```
    </CodeGroup>
  </Step>

  <Step title="Run Agent">
    ```bash theme={null}
    python reasoning_finance_team.py
    ```
  </Step>
</Steps>
