Google Search Tool
Learn about the Google Search Tool used by the Newsletter AI Agent
Google Search Tool
The Google Search Tool is a custom tool that allows the Newsletter AI Agent to search the web for relevant information using the Apify Google Search Scraper actor.
Overview
The Google Search Tool is primarily used by the Researcher Agent to gather general information about the specified topic. It provides a flexible interface for searching Google and extracting structured data from search results.
Implementation
The Google Search Tool is implemented as a CrewAI BaseTool
that interacts with the Apify Google Search Scraper actor. Here’s the implementation:
Parameters
The Google Search Tool accepts the following parameters:
Parameter | Type | Description | Default |
---|---|---|---|
queries | List[str] | Search terms or Google Search URLs | Required |
resultsPerPage | int | Number of results to return per page | 10 |
languageCode | str | Language for search results | ”en” |
forceExactMatch | bool | Wrap query in quotes for exact phrase matching | False |
site | str | Limit search to specific site (e.g. site:example.com) | None |
relatedToSite | str | Filter pages related to specific site | None |
wordsInTitle | List[str] | Filter pages with specific words in title | [] |
wordsInText | List[str] | Filter pages with specific words in text | [] |
wordsInUrl | List[str] | Filter pages with specific words in URL | [] |
quickDateRange | str | Filter by date range (e.g. d10, w2, m6, y1) | “d30” |
beforeDate | str | Filter results before date (YYYY-MM-DD) | None |
afterDate | str | Filter results after date (YYYY-MM-DD) | None |
fileTypes | List[str] | Filter by file types | [] |
mobileResults | bool | Return mobile version of search results | False |
includeUnfilteredResults | bool | Include lower quality results | False |
Usage
The Google Search Tool is used by the Researcher Agent to gather information about the specified topic:
Return Value
The tool returns a list of search results, where each result is a dictionary containing information about a search result, including:
title
: The title of the search resulturl
: The URL of the search resultdescription
: A snippet of text from the search resultposition
: The position of the result in the search results- Additional metadata about the search result
Apify Integration
The tool uses the Apify Google Search Scraper actor, which provides several advantages:
- Scalability: The actor can handle large numbers of search queries efficiently
- Reliability: The actor is designed to handle rate limiting and other issues that can arise when scraping search results
- Structured Data: The actor returns search results in a structured format that is easy to process
Configuration
To use the Google Search Tool, you need to set up the following environment variables:
Next Steps
- Learn about the Reddit Scraper Tool
- Explore the Researcher Agent that uses this tool
- See how this tool contributes to the newsletter generation process