Skip to main content

Tools Overview

The Newsletter AI Agent uses a set of custom tools powered by Apify actors to gather information from various sources. These tools are primarily used by the Researcher Agent to collect comprehensive data about the specified topic.

Tool Architecture

The tools are implemented using CrewAI’s BaseTool class and Apify’s actor system. Each tool is designed to interact with a specific Apify actor to gather information from a particular source, such as Google Search, Reddit, Twitter, YouTube, or Google News.

Base Implementation

All tools share a common base implementation in src/tools/base.py that handles the interaction with Apify actors:
This base class provides a standardized way to call Apify actors and process their results.

Available Tools

The Newsletter AI Agent includes the following tools:
  1. Google Scraper Tool: Uses the apify/google-search-scraper actor to search the web for relevant information
  2. Reddit Scraper Tool: Uses a Reddit scraper actor to gather discussions from relevant subreddits
  3. Twitter Scraper Tool: Uses the apidojo/twitter-scraper-lite actor to collect tweets related to the topic
  4. YouTube Scraper Tool: Uses a YouTube scraper actor to find relevant video content
  5. Google News Scraper Tool: Uses the aymorato/super-fast-google-news-scraper-pay-per-result actor to gather the latest news articles

Tool Implementation

Each tool follows a similar pattern:
  1. Define an input schema using Pydantic models
  2. Create a tool class that inherits from BaseTool
  3. Implement the _run method to call the appropriate Apify actor
Here’s a general pattern for tool implementation:

Apify Integration

The tools use the Apify Python SDK to interact with Apify actors. This requires an Apify API key, which should be set in the .env file:
The Apify actors provide powerful web scraping and data extraction capabilities without requiring complex infrastructure setup.

Tool Usage

Tools are assigned to the Researcher Agent during agent creation:

Next Steps

Explore each tool in detail: Or learn about the agents that use these tools to generate newsletters.