Skip to main content
SerplyTools enable an Agent to search Google web results, Google News, and Google Scholar through the Serply API, returning results as JSON.

Prerequisites

The following example requires the requests and openai libraries:
Set the SERPLY_API_KEY environment variable. Get your key at serply.io; the toolkit sends it as the X-Api-Key header.
Without the key, construction logs a warning and every call returns a JSON error asking for it.

Example

cookbook/91_tools/serply_tools.py

Toolkit Params

Toolkit Functions

Every failure — a missing key, an HTTP error, or an invalid response — is returned as a JSON error string, never raised. Serply serves about ten organic results per page for web search and does not stitch pages, so num_results above 10 still returns roughly 10 there; Scholar accepts up to 200. Each page costs one Serply credit, and rate limits depend on your Serply plan — see Serply’s docs.

Developer Resources