Implementation:CrewAIInc CrewAI Parallel Search Tool
| Knowledge Sources | |
|---|---|
| Domains | Tools, Web_Search |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
ParallelSearchTool performs web searches using Parallel's Search API (v1beta) and returns ranked results with compressed excerpts optimized for LLM consumption.
Description
ParallelSearchTool extends BaseTool and provides a streamlined single-API-call alternative to the traditional search-scrape-extract pipeline. It accepts either a natural-language objective or a list of keyword queries (or both), sends them to the Parallel Search API, and returns LLM-optimized compressed excerpts as a compact JSON string. The tool validates that at least one of objective or search_queries is provided, constructs a JSON payload, and sends a POST request with an API key header. Timeout is processor-dependent: 90 seconds for "pro" and 30 seconds for "base". Error handling covers missing API keys, HTTP errors, timeouts, and unexpected exceptions.
Usage
Use this tool when agents need to perform web research and retrieve ranked search results with compressed content excerpts, reducing token usage compared to raw web scraping. Supports both exploratory natural-language objectives and specific keyword queries, with optional source policy controls for domain allow/deny filtering.
Code Reference
Source Location
- Repository: CrewAI
- File: lib/crewai-tools/src/crewai_tools/tools/parallel_tools/parallel_search_tool.py
- Lines: 1-125
Signature
class ParallelSearchInput(BaseModel):
objective: str | None = Field(None, description="Natural-language goal for the web research (<=5000 chars)", max_length=5000)
search_queries: list[Annotated[str, Field(max_length=200)]] | None = Field(default=None, min_length=1, max_length=5)
processor: str = Field(default="base", pattern=r"^(base|pro)$")
max_results: int = Field(default=10, ge=1, le=40)
max_chars_per_result: int = Field(default=6000, ge=100)
source_policy: dict[str, Any] | None = Field(default=None)
class ParallelSearchTool(BaseTool):
name: str = "Parallel Web Search Tool"
description: str = "Search the web using Parallel's Search API (v1beta)..."
args_schema: type[BaseModel] = ParallelSearchInput
env_vars: list[EnvVar] # PARALLEL_API_KEY required
search_url: str = "https://api.parallel.ai/v1beta/search"
def _run(self, objective=None, search_queries=None, processor="base",
max_results=10, max_chars_per_result=6000, source_policy=None, **_) -> str
Import
from crewai_tools import ParallelSearchTool
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| objective | str or None | No | Natural-language goal for the web research (max 5000 chars) |
| search_queries | list[str] or None | No | List of keyword queries (max 5 items, each max 200 chars) |
| processor | str | No | Search processor: "base" (fast/low cost) or "pro" (higher quality). Default "base" |
| max_results | int | No | Maximum number of search results to return (1-40). Default 10 |
| max_chars_per_result | int | No | Maximum characters per result excerpt (min 100). Default 6000 |
| source_policy | dict or None | No | Optional source policy configuration for domain filtering |
Outputs
| Name | Type | Description |
|---|---|---|
| _run() returns | str | Compact JSON string containing search_id and ranked results, or an error message string |
Usage Examples
Basic Usage
from crewai_tools import ParallelSearchTool
# Search with a natural-language objective
tool = ParallelSearchTool()
result = tool._run(objective="Find recent developments in quantum computing")
# Search with keyword queries and pro processor
result = tool._run(
search_queries=["quantum computing 2025", "quantum error correction"],
processor="pro",
max_results=20
)