Web Search
Overview
Section titled “Overview”WebSearch lets your agent search the web during the ReAct loop. Two modes:
- Schift Cloud (default) — proxied through Schift, billed on usage
- BYOK — call Tavily, Serper, or Brave directly with your own API key
Schift Cloud Mode
Section titled “Schift Cloud Mode”import { Schift, WebSearch } from "@schift-io/sdk";
const schift = new Schift({ apiKey: "sch_..." });const webSearch = new WebSearch({}, schift.transport);
const results = await webSearch.search("AI regulations 2026");// [{ title, url, snippet }, ...]BYOK Mode
Section titled “BYOK Mode”Tavily
Section titled “Tavily”const webSearch = new WebSearch({ provider: "tavily", providerApiKey: "tvly-xxx", maxResults: 10,});Serper
Section titled “Serper”const webSearch = new WebSearch({ provider: "serper", providerApiKey: "serper-xxx",});const webSearch = new WebSearch({ provider: "brave", providerApiKey: "brave-xxx",});As an Agent Tool
Section titled “As an Agent Tool”const agent = new Agent({ name: "Researcher", instructions: "Search the web when you need current information.", tools: [webSearch.asTool()], transport: schift.transport,});The tool is registered as web_search. The LLM calls it when it needs real-time information.
Configuration
Section titled “Configuration”| Option | Type | Default | Description |
|---|---|---|---|
maxResults | number | 5 | Results per search |
provider | "schift" | "tavily" | "serper" | "brave" | "schift" | Search provider |
providerApiKey | string | — | API key for BYOK providers |