Run a standalone AssistantAgent
Run a standalone AssistantAgent, browsing the web using the BrowserUseTool
AG2 supports running AssistantAgent
as a standalone agent with the
ability to execute simple tasks without the need for interacting with
other agents.
In this notebook, we’ll enable our assistant agent access to surf the
web. We will use the BrowserUseTool
Tool, for which we need to install
the browser-use optional dependency and
playwright.
Warning: Browser Use
requires Python 3.11 or higher.
Install ag2
and playwright
:
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 your API Endpoint
The
config_list_from_json
function loads a list of configurations from an environment variable or
a JSON file.
Configure your assistant agent
Here we will configure two assistant agents: 1. x_assistant, tasked with exploring the trending topics on X (formally Twitter) 2. arxiv_researcher, tasked with discovery of papers that allign with the hot topic of the day
We will set the browser configuration to not run headless, this will open the browser as a window so you can see it in action.
Running the assistant agents
Let’s run our x_assistant to discover the hot topic of the day.
To be able to do this we give our assistant the capability to browse the
web using a BrowserUseTool
Tool.
After discovering the hot topic, let’s run the discovery of papers that align with the topic
Now, let’s create an X post using our x_assistant
Finally, let’s ask our x_assistant who should we follow on X