
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@elizaos/plugin-web-search
Advanced tools
A plugin for powerful web search capabilities, providing efficient search query handling and result processing through a customizable API interface.
This plugin provides functionality to:
pnpm install @elizaos/plugin-web-search
The plugin requires the following environment variables:
TAVILY_API_KEY=your_api_key # Required: API key for search service
Import and register the plugin in your Eliza configuration.
import { webSearchPlugin } from "@elizaos/plugin-web-search";
export default {
plugins: [webSearchPlugin],
// ... other configuration
};
Custom Usage If you want custom usage, for example, a social media client to search the web before posting, you can also import the webSearchService and use it directly. Here's how you can do it:
// Example usage in a social media client
const webSearchService = new WebSearchService();
await webSearchService.initialize(runtime);
const latestNews = await webSearchService.search(
"latest news on AI Agents",
// searchOptions
);
const state = await this.runtime.composeState(
{ } // memory,
{ // additional keys
latestNews: latestNews,
}
);
// Then modify the post template to include the {{latestNews}} and however you need
The plugin provides comprehensive web search capabilities:
import { webSearch } from "@elizaos/plugin-web-search";
// Execute a search query
const result = await webSearch.handler(
runtime,
{
content: { text: "What is the latest news about AI?" },
},
state,
{},
callback
);
// The plugin automatically handles token limits
const DEFAULT_MAX_WEB_SEARCH_TOKENS = 4000;
// Example of token-limited response
const response = MaxTokens(searchResult, DEFAULT_MAX_WEB_SEARCH_TOKENS);
pnpm run build
pnpm run test
pnpm run dev
@elizaos/core: Core Eliza functionalityjs-tiktoken: Token counting and managementtsup: Build toolinterface Action {
name: "WEB_SEARCH";
similes: string[];
description: string;
validate: (runtime: IAgentRuntime, message: Memory) => Promise<boolean>;
handler: (
runtime: IAgentRuntime,
message: Memory,
state: State,
options: any,
callback: HandlerCallback
) => Promise<void>;
examples: Array<Array<any>>;
}
interface SearchResult {
title: string;
url: string;
answer?: string;
results?: Array<{
title: string;
url: string;
}>;
}
webSearch.handler: Main method for executing searchesgenerateWebSearch: Core search generation functionMaxTokens: Token limit management functiongetTotalTokensFromString: Token counting utility// Basic search
const searchQuery = "Latest developments in quantum computing";
const results = await generateWebSearch(searchQuery, runtime);
// With formatted response
if (results && results.results.length) {
const formattedResponse = `${results.answer}\n\nFor more details, check out:\n${results.results
.map(
(result, index) => `${index + 1}. [${result.title}](${result.url})`
)
.join("\n")}`;
}
const DEFAULT_MODEL_ENCODING = "gpt-3.5-turbo";
const DEFAULT_MAX_WEB_SEARCH_TOKENS = 4000;
The plugin includes multiple search action similes:
Contributions are welcome! Please see the CONTRIBUTING.md file for more information.
This plugin integrates with and builds upon several key technologies:
Special thanks to:
For more information about the search capabilities and tools:
This plugin is part of the Eliza project. See the main project repository for license information.
FAQs
Unknown package
We found that @elizaos/plugin-web-search demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.