Parallel
Use Parallel with Kern for AI-optimized web search and content extraction.
ParallelTools enable an Agent to perform AI-optimized web search and content extraction using Parallel's APIs.
Prerequisites
The following example requires the parallel-web library and an API key which can be obtained from Parallel.
1uv pip install -U parallel-web1export PARALLEL_API_KEY=***Example
The following agent will search for information on AI agents and autonomous systems, then extract content from specific URLs:
1from kern.agent import Agent2from kern.tools.parallel import ParallelTools34agent = Agent(5 tools=[6 ParallelTools(7 enable_search=True,8 enable_extract=True,9 max_results=5,10 max_chars_per_result=8000,11 )12 ],13 markdown=True,14)1516# Should use parallel_search17agent.print_response(18 "Search for the latest information on 'AI agents and autonomous systems' and summarize the key findings"19)2021# Should use parallel_extract22agent.print_response(23 "Extract information about the product features from https://parallel.ai and https://docs.parallel.ai"24)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