웹 검색
WebSearch는 에이전트가 ReAct 루프 중에 웹을 검색할 수 있게 합니다. 두 가지 모드가 있습니다:
- Schift Cloud (기본) — Schift를 통해 프록시되며 사용량 기준 과금
- BYOK — Tavily, Serper, Brave를 직접 호출 (본인 API 키 사용)
Schift Cloud 모드
섹션 제목: “Schift Cloud 모드”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 모드
섹션 제목: “BYOK 모드”Tavily
섹션 제목: “Tavily”const webSearch = new WebSearch({ provider: "tavily", providerApiKey: "tvly-xxx", maxResults: 10,});Serper
섹션 제목: “Serper”const webSearch = new WebSearch({ provider: "serper", providerApiKey: "serper-xxx",});Brave
섹션 제목: “Brave”const webSearch = new WebSearch({ provider: "brave", providerApiKey: "brave-xxx",});Agent 도구로 사용
섹션 제목: “Agent 도구로 사용”const agent = new Agent({ name: "Researcher", instructions: "Search the web when you need current information.", tools: [webSearch.asTool()], transport: schift.transport,});도구는 web_search로 등록됩니다. LLM이 실시간 정보가 필요할 때 호출합니다.
| 옵션 | 타입 | 기본값 | 설명 |
|---|---|---|---|
maxResults | number | 5 | 검색당 결과 수 |
provider | "schift" | "tavily" | "serper" | "brave" | "schift" | 검색 제공자 |
providerApiKey | string | — | BYOK 제공자용 API 키 |