Parallel Web
Token-efficient web search and extraction for AI agents
Parallel Web Tools
Parallel provides best-in-class tools to search and extract context from the web. Results are compressed for optimal token efficiency at inference time.
Installation
npm install @parallel-web/ai-sdk-toolsEnvironment Variables
PARALLEL_API_KEY=your-parallel-api-keyGet your API key from Parallel Platform.
Available Tools
| Tool | Description |
|---|---|
searchTool | Search the web with token-efficient results |
extractTool | Extract content from URLs |
Quick Start
- Simple Usage
typescript import { Agent } from 'praisonai'; import { parallelSearch } from 'praisonai/tools'; const agent = new Agent({ name: 'Researcher', instructions: 'Search the web for information.', tools: [parallelSearch()], }); const result = await agent.run('When was Vercel Ship AI?'); console.log(result.text); - With Configuration
Adjust agent instructions, tool options, and provider settings for production — see the Configuration section below.
Using with AI SDK Directly
import { generateText, stepCountIs } from 'ai';
import { searchTool, extractTool } from '@parallel-web/ai-sdk-tools';
import { openai } from '@ai-sdk/openai';
const { text } = await generateText({
model: openai('gpt-4o'),
prompt: 'When was Vercel Ship AI?',
tools: {
webSearch: searchTool,
webExtract: extractTool,
},
stopWhen: stepCountIs(3),
});
console.log(text);Search Tool
import { parallelSearch } from 'praisonai/tools';
const searchTool = parallelSearch({
// Number of results
numResults: 10,
// Search objective for semantic matching
objective: 'Find recent AI news',
});Extract Tool
import { generateText } from 'ai';
import { extractTool } from '@parallel-web/ai-sdk-tools';
const { text } = await generateText({
model: openai('gpt-4o'),
prompt: 'Extract the main content from https://example.com',
tools: {
webExtract: extractTool,
},
});Token Efficiency
Parallel compresses web results for optimal token usage:
- Semantic compression – Extracts relevant content based on search objective
- Token-dense excerpts – Returns compressed, information-rich snippets
- Smart truncation – Intelligently limits content length
Advanced Example
import { Agent } from 'praisonai';
import { parallelSearch } from 'praisonai/tools';
const agent = new Agent({
name: 'EfficientResearcher',
instructions: `You are a research assistant that uses web search efficiently.
Always cite your sources and provide concise summaries.`,
tools: [parallelSearch({ numResults: 5 })],
});
const result = await agent.run(
'Research the latest developments in large language models'
);
console.log(result.text);Response Format
interface ParallelSearchResult {
results: Array<{
title: string;
url: string;
excerpt: string;
relevanceScore?: number;
}>;
}Best Practices
Guidelines
- Use semantic objectives – Describe what you’re looking for
- Limit results – Fewer results = faster responses
- Combine with extract – Search first, then extract full content
- Trust compression – Results are optimized for LLM consumption
Related Tools
- Exa – Semantic web search
- Tavily – Web search and extraction
- Perplexity – Real-time search