Skip to content

Web Search

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
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 }, ...]
const webSearch = new WebSearch({
provider: "tavily",
providerApiKey: "tvly-xxx",
maxResults: 10,
});
const webSearch = new WebSearch({
provider: "serper",
providerApiKey: "serper-xxx",
});
const webSearch = new WebSearch({
provider: "brave",
providerApiKey: "brave-xxx",
});
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.

OptionTypeDefaultDescription
maxResultsnumber5Results per search
provider"schift" | "tavily" | "serper" | "brave""schift"Search provider
providerApiKeystringAPI key for BYOK providers