Prerequisites
The following example requires theparallel-web library and an API key which can be obtained from Parallel.
Example
The following agent will search for information on AI agents and autonomous systems, then extract content from specific URLs:cookbook/tools/parallel_tools.py
Toolkit Params
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | Optional[str] | None | Parallel API key. If not provided, will use PARALLEL_API_KEY environment variable. |
enable_search | bool | True | Enable Search API functionality for AI-optimized web search. |
enable_extract | bool | True | Enable Extract API functionality for content extraction from URLs. |
all | bool | False | Enable all tools. Overrides individual flags when True. |
max_results | int | 10 | Default maximum number of results for search operations. |
max_chars_per_result | int | 10000 | Default maximum characters per result for search operations. |
beta_version | str | "search-extract-2025-10-10" | Beta API version header. |
mode | Optional[str] | None | Default search mode. Options: “one-shot” or “agentic”. |
include_domains | Optional[List[str]] | None | Default domains to restrict results to. |
exclude_domains | Optional[List[str]] | None | Default domains to exclude from results. |
max_age_seconds | Optional[int] | None | Default cache age threshold. When set, minimum value is 600 seconds. |
timeout_seconds | Optional[float] | None | Default timeout for content retrieval. |
disable_cache_fallback | Optional[bool] | None | Default cache fallback behavior. |
Toolkit Functions
| Function | Description |
|---|---|
parallel_search | Search the web using Parallel’s Search API with natural language objective. Parameters include objective (str) for natural-language description, search_queries (list) for traditional keyword queries, max_results (int) for maximum number of results, and max_chars_per_result (int) for maximum characters per result. Returns JSON formatted string with URLs, titles, publish dates, and relevant excerpts. |
parallel_extract | Extract content from specific URLs using Parallel’s Extract API. Parameters include urls (list) for URLs to extract from, objective (str) to guide extraction, search_queries (list) for targeting relevant content, excerpts (bool, default=True) to include text snippets, max_chars_per_excerpt (int) to limit excerpt characters, full_content (bool, default=False) to include complete page text, and max_chars_for_full_content (int) to limit full content characters. Returns JSON formatted string with extracted content in clean markdown format. |
Developer Resources
- View Example
- View Parallel SDK Documentation
- View Parallel API Reference