Skip to content

Deep Research

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 report
import { 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 report
console.log(report.sources.length); // Number of sources
console.log(report.iterations); // Iterations used
console.log(report.totalQueries); // Total queries executed

The 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;
};
const agent = new Agent({
tools: [research.asTool()],
...
});

Registered as deep_research. The agent calls it for questions that need thorough, multi-source research.

OptionTypeDefaultDescription
maxIterationsnumber3Maximum research rounds
resultsPerSearchnumber5Results per query
queriesPerIterationnumber2Queries generated per round
queryModelModelId | string"gpt-4o-mini"Model for query generation
synthesisModelModelId | string"gpt-4o-mini"Model for final report
webSearchWebSearchConfigWeb search provider config