> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ag2.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# DeepResearchAgent - Your Shortcut for Faster Research

<div>
  <img noZoom className="social-share-img" src="https://media.githubusercontent.com/media/ag2ai/ag2/refs/heads/main/website/static/img/cover.png" alt="social preview" style={{ position: 'absolute', left: '-9999px' }} />
</div>

<div class="blog-authors">
  <p class="authors">Authors:</p>

  <CardGroup cols={2}>
    <Card href="https://github.com/rjambrecic">
      <div class="col card">
        <div class="img-placeholder">
          <img noZoom src="https://github.com/rjambrecic.png" />
        </div>

        <div>
          <p class="name">Robert Jambrecic</p>
          <p>Machine Learning Engineer at Airt</p>
        </div>
      </div>
    </Card>

    <Card href="https://github.com/sternakt">
      <div class="col card">
        <div class="img-placeholder">
          <img noZoom src="https://github.com/sternakt.png" />
        </div>

        <div>
          <p class="name">Tvrtko Sternak</p>
          <p>Machine Learning Engineer at Airt</p>
        </div>
      </div>
    </Card>
  </CardGroup>
</div>

<img src="https://mintcdn.com/ag2ai/LGIgOcmjvGq1jJYv/snippets/reference-agents/img/DeepResearchAgent.png?fit=max&auto=format&n=LGIgOcmjvGq1jJYv&q=85&s=1e039047fc8d80dc240793604ad2e108" alt="DeepResearchAgent workflow" width="1920" height="1080" data-path="snippets/reference-agents/img/DeepResearchAgent.png" />

## Introduction

We are excited to unveil [`DeepResearchAgent`](/docs/api-reference/autogen/agents/experimental/DeepResearchAgent), a powerful autonomous research capability within our **AG2** framework. Inspired by [OpenAI's Deep Research](https://openai.com/index/introducing-deep-research), our agent is designed to tackle complex, multi-step research tasks efficiently, synthesizing insights from diverse online sources.

With [`DeepResearchAgent`](/docs/api-reference/autogen/agents/experimental/DeepResearchAgent), we take a significant step toward the future of autonomous knowledge synthesis—freeing up valuable time and enabling deeper, data-driven decision-making

## Installation

<Warning>
  [`DeepResearchAgent`](/docs/api-reference/autogen/agents/experimental/DeepResearchAgent) is built on top of [`Browser Use`](https://github.com/browser-use/browser-use), which requires **Python 3.11 or higher**.
</Warning>

To get started with the [`DeepResearchAgent`](/docs/api-reference/autogen/agents/experimental/DeepResearchAgent) agent, follow these steps:

1. Install AG2 with the `browser-use` extra:

   ```bash theme={null}
   pip install -U ag2[openai,browser-use]
   ```

   <Tip>
     If you have been using `autogen` or `ag2`, all you need to do is upgrade it using:

     ```bash theme={null}
     pip install -U autogen[openai,browser-use]
     ```

     or

     ```bash theme={null}
     pip install -U ag2[openai,browser-use]
     ```

     as `autogen` and `ag2` are aliases for the same PyPI package.
   </Tip>

2. Set up Playwright:

   ```bash theme={null}
   # Installs Playwright and browsers for all OS
   playwright install
   # Additional command, mandatory for Linux only
   playwright install-deps
   ```

3. For running the code in Jupyter, use `nest_asyncio` to allow nested event loops.
   ```bash theme={null}
   pip install nest_asyncio
   ```

You're all set! Now you can start solving complex tasks.

## Imports

```python theme={null}
import os
import nest_asyncio

from autogen.agents.experimental import DeepResearchAgent

nest_asyncio.apply()
```

## Starting the Conversation

This code initializes [`DeepResearchAgent`](/docs/api-reference/autogen/agents/experimental/DeepResearchAgent) and asks it to find out `What was the impact of DeepSeek on stock prices and why?` using `GPT-4o`.

<Tip>
  We recommend using `gpt-4o`

  Models like `gpt-4o-mini` often don’t perform well enough for complex tasks.
</Tip>

```python theme={null}
from autogen import LLMConfig

llm_config = LLMConfig(
    config_list=[{"api_type": "openai", "model": "gpt-4o", "api_key": os.environ["OPENAI_API_KEY"]}],
)

with llm_config:
    agent = DeepResearchAgent(name="DeepResearchAgent")

message = "What was the impact of DeepSeek on stock prices and why?"

result = agent.run(
    message=message,
    tools=agent.tools,
    max_turns=2,
    user_input=False,
    summary_method="reflection_with_llm",
)
result.process()
print(result.summary)
```

The agent will break down the initial task into smaller, manageable subtasks and tackle them sequentially. Once all subtasks are completed, a final summary will be generated, for example:

```console theme={null}
The investigation into the impact of DeepSeek on stock prices reveals several key insights:

1. **DeepSeek's Role and Functionality:**
 - DeepSeek is a renowned Chinese AI company, known for its cutting-edge, open-source language models that compete with those of major U.S. tech giants. The models offer significant advancements in reasoning and optimization of tasks requiring logical inference and problem-solving, utilizing methods such as "Chain of Thought" and reinforcement learning.

2. **Impact on Stock Prices:**
 - The introduction and application of DeepSeek have led to significant repercussions in stock markets. The tech industry experienced a selloff, notably impacting companies like Nvidia, with stock valuations decreasing markedly—from 50 times to 36 times estimated earnings. Major indexes, including Nasdaq and S&P 500, faced declines of 3.1% and 1.5%, respectively.

3. **Factors behind the Changes in Stock Prices:**
 - The shifts in stock prices are attributed to several factors:
 - **Technological Advancements:** DeepSeek's technological breakthroughs have triggered notable market changes.
 - **Impact on Major Tech Companies:** There have been significant market-cap losses for companies like Nvidia due to concerns about competition from DeepSeek.
 - **Market Volatility:** Concerns over Chinese AI enhancements have induced market-wide volatility.
 - **Investment Opportunities:** DeepSeek's advancements have sparked interest in investing in undervalued Chinese AI stocks, indicating potential growth areas.
 - **Financial Market Reactions:** The rapid changes induced by DeepSeek's developments have caused noticeable financial market fluctuations, particularly affecting Wall Street.

Overall, DeepSeek's emergence has profoundly influenced stock prices by fostering both immediate market anxiety and potential long-term investment opportunities.
Reasoning: The answer comprehensively covers the impact of DeepSeek on stock prices and the reasons behind these changes. It is well-structured, providing a clear understanding of DeepSeek's functions, its effects on the stock market, and the underlying factors contributing to these effects. Each aspect of the investigation aligns with the subquestions previously addressed, ensuring completeness and coherence. Thus, this summary effectively communicates the investigation's findings.
```

## Conclusion

The [`DeepResearchAgent`](/docs/api-reference/autogen/agents/experimental/DeepResearchAgent) within the AG2 framework helps automate complex research tasks by gathering information from different online sources. It breaks down big questions into smaller tasks and works through them one by one. After completing all the steps, the agent creates a detailed summary, making it easier for users to handle research challenges and find useful insights quickly.

<div className="edit-url-container">
  <a className="edit-url" href="https://github.com/ag2ai/ag2/edit/main/website/docs/_blogs/2025-02-13-DeepResearchAgent/index.mdx" target="_blank"><Icon icon="pen" iconType="solid" size="13px" /> Edit this page</a>
</div>
