Skip to main content
Open In Colab Open on GitHub This notebook shows how to use Apify tools with AG2 agents to scrape data from a website and format the output. First we need to install the Apify SDK and the AG2 library.
Setting up the LLM configuration and the Apify API key is also required.
Let’s define the tool for scraping data from the website using Apify actor. Read more about tool use in this tutorial chapter.
Create the agents and register the tool.
Start the conversation for scraping web data. We used the reflection_with_llm option for summary method to perform the formatting of the output into a desired format. The summary method is called after the conversation is completed given the complete history of the conversation.
The output is stored in the summary.