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 usingautogenorag2, all you need to do is upgrade it using:orasautogen, andag2are aliases for the same PyPI package.
Set your API Endpoint
TheLLMConfig.from_json
method 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 align 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 aBrowserUseTool Tool.