nat.plugins.agno.tools.serp_api_tool#

Attributes#

Classes#

SerpApiToolConfig

Tool that retrieves search results from the web using SerpAPI.

Functions#

serp_api_tool(tool_config, builder)

Create a SerpAPI search tool for use with Agno.

Module Contents#

logger#
class SerpApiToolConfig(/, **data: Any)#

Bases: nat.data_models.function.FunctionBaseConfig

Tool that retrieves search results from the web using SerpAPI. Requires a SERP_API_KEY.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

api_key: str | None = None#
max_results: int = None#
async serp_api_tool(
tool_config: SerpApiToolConfig,
builder: nat.builder.builder.Builder,
)#

Create a SerpAPI search tool for use with Agno.

This creates a search function that uses SerpAPI to search the web.

Args:

tool_config (SerpApiToolConfig): Configuration for the SerpAPI tool. builder (Builder): The NAT builder instance.

Returns:

FunctionInfo: A FunctionInfo object wrapping the SerpAPI search functionality.