# ParallelWebSearchTool

> **Class** in `langchain_parallel`

📖 [View in docs](https://reference.langchain.com/python/langchain-parallel/search_tool/ParallelWebSearchTool)

Parallel Search tool with web research capabilities.

This tool calls Parallel's Search API, which streamlines the traditional
search -> scrape -> extract pipeline into a single API call. It supports
natural-language objectives, keyword queries, domain filters, three modes
(`turbo`, `basic`, `advanced`), location targeting, and async usage.

## Signature

```python
ParallelWebSearchTool()
```

## Description

**Setup:**

Install `langchain-parallel` and set environment variable
`PARALLEL_API_KEY`.

```bash
pip install -U langchain-parallel
export PARALLEL_API_KEY="your-api-key"
```

**Key init args:**

api_key: Optional[SecretStr]
    Parallel API key. If not provided, will be read from
    PARALLEL_API_KEY env var.
base_url: str
    Base URL for Parallel API. Defaults to "https://api.parallel.ai".

**Instantiation:**

```python
from langchain_parallel import ParallelWebSearchTool

tool = ParallelWebSearchTool()
```

**Invocation:**

```python
result = tool.invoke({
    "objective": "Latest developments in AI agents",
    "search_queries": ["AI agents 2026", "autonomous LLM systems"],
    "mode": "advanced",
    "max_results": 5,
})
print(result["search_id"], len(result["results"]))
```

**Domain and freshness filters:**

```python
from langchain_parallel import SourcePolicy

result = tool.invoke({
    "search_queries": ["climate research breakthroughs"],
    "source_policy": SourcePolicy(
        include_domains=["nature.com", "science.org"],
        after_date="2025-01-01",
    ),
    "location": "us",
})
```

**Async:**

```python
result = await tool.ainvoke({"search_queries": ["..."]})
```

**Response shape:**

```python
{
    "search_id": "search_abc123",
    "session_id": "sess_...",
    "results": [
        {"url": "...", "title": "...", "publish_date": "...",
         "excerpts": ["..."]},
        ...
    ],
    "warnings": [...],
    "usage": {...},
    "search_metadata": {  # added by this tool when include_metadata=True
        "search_duration_seconds": 2.451,
        "search_timestamp": "2026-04-27T10:30:00",
        "actual_results_returned": 5,
    }
}
```

## Extends

- `BaseTool`

## Properties

- `name`
- `description`
- `args_schema`
- `api_key`
- `base_url`

## Methods

- [`validate_environment()`](https://reference.langchain.com/python/langchain-parallel/search_tool/ParallelWebSearchTool/validate_environment)

---

[View source on GitHub](https://github.com/parallel-web/langchain-parallel/blob/234dcb368dc21a0291eaf9e7f37c777b5e9a1fcc/langchain_parallel/search_tool.py#L184)