AgentsSkills

web_search

View as MarkdownOpen in Claude

Search the web using the Google Custom Search API. Results are filtered for quality and summarized for voice delivery.

Tools: web_search

Requirements: Google Custom Search API key + Search Engine ID

Multi-instance: Yes (use different tool_name and search_engine_id per instance)

api_key
strRequired

Google API key with Custom Search JSON API enabled.

search_engine_id
strRequired

Programmable Search Engine ID from Google.

num_results
intDefaults to 3

Number of search results to return (1-10).

delay
floatDefaults to 0.5

Delay between scraping pages in seconds. Ignored when parallel_scrape is True.

max_content_length
intDefaults to 32768

Maximum total response size in characters.

oversample_factor
floatDefaults to 2.5

How many extra results to fetch for quality filtering (e.g., 2.5 fetches 2.5x the requested number). Range: 1.0-3.5.

min_quality_score
floatDefaults to 0.3

Quality threshold for filtering results (0.0-1.0).

no_results_message
str

Message to show when no quality results are found. Use {query} as a placeholder for the search query.

per_page_timeout
floatDefaults to 2.0

Maximum seconds to wait on a single page scrape. Minimum 0.1.

overall_deadline
floatDefaults to 10.0

Wall-clock budget in seconds for the whole tool call. In-flight scrapes are abandoned past this point so the response beats the webhook timeout. Minimum 1.0.

parallel_scrape
boolDefaults to True

Scrape all candidate pages concurrently in a thread pool instead of sequentially.

snippets_only
boolDefaults to False

Skip page scraping entirely and return Google CSE snippets only. Fastest mode (sub-second).

response_prefix
str

Optional text prepended to every non-empty search result.

response_postfix
str

Optional text appended to every non-empty search result.

tool_name
strDefaults to web_search

Custom function name.

1from signalwire import AgentBase
2
3class MyAgent(AgentBase):
4 def __init__(self):
5 super().__init__(name="assistant", route="/assistant")
6 self.set_prompt_text("You are a helpful assistant.")
7 self.add_skill("web_search", {
8 "api_key": "YOUR_GOOGLE_API_KEY",
9 "search_engine_id": "YOUR_SEARCH_ENGINE_ID",
10 "num_results": 3
11 })
12
13agent = MyAgent()
14agent.serve()