Deep Research
Overview
Section titled “Overview”DeepResearch performs multi-round web searches. It generates queries, searches, evaluates if it has enough information, refines queries, and repeats until satisfied. Then it synthesizes a report.
Question -> Generate queries -> Search -> Sufficient? | No -> Refine queries -> Search -> ... Yes -> Synthesize reportimport { DeepResearch } from "@schift-io/sdk";
const research = new DeepResearch( { maxIterations: 5, resultsPerSearch: 10, queriesPerIteration: 3, synthesisModel: "gpt-4o", webSearch: { provider: "tavily", providerApiKey: "tvly-xxx", }, }, llmFn,);
const report = await research.run("AI agent framework trends 2026");
console.log(report.answer); // Synthesized reportconsole.log(report.sources.length); // Number of sourcesconsole.log(report.iterations); // Iterations usedconsole.log(report.totalQueries); // Total queries executedThe llmFn parameter is a function that calls any chat completions API:
const llmFn = async (messages: Array<{ role: string; content: string }>) => { const resp = await fetch("https://api.openai.com/v1/chat/completions", { method: "POST", headers: { Authorization: `Bearer ${process.env.OPENAI_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ model: "gpt-4o-mini", messages }), }); const data = await resp.json(); return data.choices[0].message.content;};As an Agent Tool
Section titled “As an Agent Tool”const agent = new Agent({ tools: [research.asTool()], ...});Registered as deep_research. The agent calls it for questions that need thorough, multi-source research.
Configuration
Section titled “Configuration”| Option | Type | Default | Description |
|---|---|---|---|
maxIterations | number | 3 | Maximum research rounds |
resultsPerSearch | number | 5 | Results per query |
queriesPerIteration | number | 2 | Queries generated per round |
queryModel | ModelId | string | "gpt-4o-mini" | Model for query generation |
synthesisModel | ModelId | string | "gpt-4o-mini" | Model for final report |
webSearch | WebSearchConfig | — | Web search provider config |