Skip to main content
This notebook goes over how to use the Google Serper component to search the web. First you need to sign up for a free account at serper.dev and get your api key.

As part of a Self Ask With Search Agent

In order to create an agent that uses the Google Serper tool install LangGraph
and use the create_agent functionality to initialize a ReAct agent. You will also need to set up your OPENAI_API_KEY (visit platform.openai.com) in order to access OpenAI’s chat models.

Obtaining results with metadata

If you would also like to obtain the results in a structured way including metadata. For this we will be using the results method of the wrapper.

Searching for Google Images

We can also query Google Images using this wrapper. For example:

Searching for Google News

We can also query Google News using this wrapper. For example:
If you want to only receive news articles published in the last hour, you can do the following:
Some examples of the tbs parameter: qdr:h (past hour) qdr:d (past day) qdr:w (past week) qdr:m (past month) qdr:y (past year) You can specify intermediate time periods by adding a number: qdr:h12 (past 12 hours) qdr:d3 (past 3 days) qdr:w2 (past 2 weeks) qdr:m6 (past 6 months) qdr:y2 (past 2 years) For all supported filters simply go to Google Search, search for something, click on β€œTools”, add your date filter and check the URL for β€œtbs=”.

Searching for Google Places

We can also query Google Places using this wrapper. For example:

Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.