# Riding the Web with WebSurferAgent

## Introduction

In our [Adding Browsing Capabilities to AG2](https://docs.ag2.ai/docs/blog/2025/01/31/Websurfing-Tools) guide, we explored how to build agents with basic web surfing capabilities. Now, let's take it to the next level with [`WebSurferAgent`](https://docs.ag2.ai/0.12.3/docs/api-reference/autogen/agents/experimental/WebSurferAgent/)—a powerful agent that comes with built-in web browsing tools right out of the box!

With [`WebSurferAgent`](https://docs.ag2.ai/0.12.3/docs/api-reference/autogen/agents/experimental/WebSurferAgent/), your agents can seamlessly browse the web, retrieve real-time information, and interact with web pages—all with minimal setup.

## WebSurferAgent with BrowserUseTool

Warning

[`Browser Use`](https://github.com/browser-use/browser-use) requires **Python 3.11 or higher**.

### Installation

To get started with the [`Browser Use`](https://github.com/browser-use/browser-use) integration in AG2, follow these steps:

1. Install AG2 with the `browser-use` extra:
    
    ```
    pip install -U ag2[openai,browser-use]
    ```

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

```
    pip install -U autogen[openai,browser-use]
    ```

or

```
    pip install -U ag2[openai,browser-use]
    ```

as `autogen` and `ag2` are aliases for the same PyPI package.
2. Set up Playwright:

```
    # 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.

```
    pip install nest_asyncio
    ```

You're all set! Now you can start using browsing features in AG2.

### Imports

```python
import os

import nest_asyncio

from autogen import LLMConfig
from autogen.agentchat import UserProxyAgent
from autogen.agents.experimental import WebSurferAgent

nest_asyncio.apply()
```

### Configure WebSurferAgent with Browser Use

Tip

[`Browser Use`](https://github.com/browser-use/browser-use) supports the following models: [Supported Models](https://docs.browser-use.com/customize/supported-models#supported-models)

We had great experience with `OpenAI`, `Anthropic`, and `Gemini`. However, `DeepSeek` and `Ollama` haven't performed as well.

````python
llm_config = LLMConfig(config_list={
