***

title: web_search
slug: /reference/python/agents/skills/web-search
description: Search the web using the Google Custom Search API.
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

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)

<ParamField path="api_key" type="str" required={true} toc={true}>
  Google API key with Custom Search JSON API enabled.
</ParamField>

<ParamField path="search_engine_id" type="str" required={true} toc={true}>
  Programmable Search Engine ID from Google.
</ParamField>

<ParamField path="num_results" type="int" default="3" toc={true}>
  Number of search results to return (1-10).
</ParamField>

<ParamField path="delay" type="float" default="0.5" toc={true}>
  Delay between scraping pages in seconds.
</ParamField>

<ParamField path="max_content_length" type="int" default="32768" toc={true}>
  Maximum total response size in characters.
</ParamField>

<ParamField path="oversample_factor" type="float" default="2.5" toc={true}>
  How many extra results to fetch for quality filtering (e.g., `2.5` fetches 2.5x the
  requested number). Range: 1.0-3.5.
</ParamField>

<ParamField path="min_quality_score" type="float" default="0.3" toc={true}>
  Quality threshold for filtering results (0.0-1.0).
</ParamField>

<ParamField path="no_results_message" type="str" toc={true}>
  Message to show when no quality results are found. Use `{query}` as a placeholder
  for the search query.
</ParamField>

<ParamField path="tool_name" type="str" default="web_search" toc={true}>
  Custom function name.
</ParamField>

```python
from signalwire import AgentBase

class MyAgent(AgentBase):
    def __init__(self):
        super().__init__(name="assistant", route="/assistant")
        self.set_prompt_text("You are a helpful assistant.")
        self.add_skill("web_search", {
            "api_key": "YOUR_GOOGLE_API_KEY",
            "search_engine_id": "YOUR_SEARCH_ENGINE_ID",
            "num_results": 3
        })

agent = MyAgent()
agent.serve()
```