콘텐츠로 이동

웹 검색

WebSearch는 에이전트가 ReAct 루프 중에 웹을 검색할 수 있게 합니다. 두 가지 모드가 있습니다:

  • Schift Cloud (기본) — Schift를 통해 프록시되며 사용량 기준 과금
  • BYOK — Tavily, Serper, Brave를 직접 호출 (본인 API 키 사용)
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,
});

도구는 web_search로 등록됩니다. LLM이 실시간 정보가 필요할 때 호출합니다.

옵션타입기본값설명
maxResultsnumber5검색당 결과 수
provider"schift" | "tavily" | "serper" | "brave""schift"검색 제공자
providerApiKeystringBYOK 제공자용 API 키