Google Search
Google Search
integration in AG2, follow these
steps:
Install AG2 with the google-search
extra. Since our examples also use
openai
and gemini
, install them as well:
Note: If you have been usingYou’re all set! Now you can start using Google Search with AG2.autogen
orag2
, all you need to do is upgrade it using:orasautogen
, andag2
are aliases for the same PyPI package.
GoogleSearchTool
enables search functionalities in AG2 and can be
configured to use Gemini GenAI for an enhanced search experience. This
section covers agent configuration and tool initialization.
use_internal_llm_tool_if_available
to True
.
Note: You cannot combine other tools with the prebuilt Google Search tool. If you need multiple tools, refer to the AG2 implementation section.
Get Started
and create a search engine.Sites to Search
, select Search the entire web
if you
want global search.cx
parameter from the url)bash export GOOGLE_SEARCH_ENGINE_ID="your_engine_id" export GOOGLE_SEARCH_API_KEY="your_api_key"
GoogleSearchTool
with your search_api_key
and
search_engine_id
.