WebSurferAgent
WebSurfer Agent
In
browser-use tool
and
crawl4ai tool
notebooks, we demonstrated how to create Agents with basic web surfing
capabilities.
Now, we’re taking it a step further with WebSurferAgent
—a powerful
agent equipped with built-in web surfing tools right out of the box!
WebSurferAgent with browser-use
tool
Warning: Browser Use
requires Python 3.11 or higher.
Installation
To get started with the browser-use
integration in AG2, follow these
steps:
-
Install AG2 with the
browser-use
extra:Note: If you have been using
autogen
orpyautogen
, all you need to do is upgrade it using:or
as
pyautogen
,autogen
, andag2
are aliases for the same PyPI package. -
Set up Playwright:
-
For running the code in Jupyter, use
nest_asyncio
to allow nested event loops.bash pip install nest_asyncio
You’re all set! Now you can start using browsing features in AG2.
Imports
browser-use
WebSurferAgent
Note:
Browser Use
supports the following models: Supported ModelsWe had great experience with
OpenAI
,Anthropic
, andGemini
. However,DeepSeek
andOllama
haven’t performed as well.
There are two ways to start a chat session which is using only one agent with LLM configuration.
Recommended: Using the run
Method
The new run
method simplifies the process by eliminating the need for
manual UserProxyAgent
creation.
- ✅ Easier setup – No need to manually register tools
Manual Setup: Using initiate_chat
Method
This method requires manually creating a UserProxyAgent
and
registering tools for execution.
- ⚠️ More setup required
- ⚠️ Must manually register tools
WebSurferAgent with crawl4ai
tool
Installation
To get started with the crawl4ai
integration in AG2, follow these
steps:
-
Install AG2 with the
crawl4ai
extra:Note: If you have been using
autogen
orpyautogen
, all you need to do is upgrade it using:or
as
pyautogen
,autogen
, andag2
are aliases for the same PyPI package. -
Set up Playwright:
-
For running the code in Jupyter, use
nest_asyncio
to allow nested event loops.bash pip install nest_asyncio
You’re all set! Now you can start using browsing features in AG2.
Imports
Crawl4AI WebSurferAgent
Note:
Crawl4AI
is built on top of LiteLLM and supports the same models as LiteLLM.We had great experience with
OpenAI
,Anthropic
,Gemini
andOllama
. However, as of this writing,DeepSeek
is encountering some issues.
There are two ways to start a chat session which is using only one agent with LLM configuration.
Recommended: Using the run
Method
The new run
method simplifies the process by eliminating the need for
manual UserProxyAgent
creation.
- ✅ Easier setup – No need to manually register tools
Manual Setup: Using initiate_chat
Method
This method requires manually creating a UserProxyAgent
and
registering tools for execution.
- ⚠️ More setup required
- ⚠️ Must manually register tools