Skip to content

researcher ​

Use researcherAgent for a cited answer from retrieved sources. It asks for an answer again when the first reply is too short and reports a failure if that follow-up is blank. No separate reviewer checks the answer.

As an LLM tool, this handoff continues the caller's conversation. From code, use a thread block to isolate the research. keepDraft: false makes a budget stop a failure even when a draft is available. The draft is then in the failure's data as draft. Pass offerSaveDraft: false as well when nothing reads that draft, so the model spends no rounds saving one.

The model reports progress in a sentence beside each tool call, and nothing prints it by default. std::agents/lib/toolkits shows the callback that does.

Types ​

ResearchEvalInput ​

What an eval hands the researcher: the question, and the conversation before it when the test has one. The shape the evals/researcher suite uses as its input.

ts
/** What an eval hands the researcher: the question, and the conversation
  before it when the test has one. The shape the `evals/researcher` suite
  uses as its input. */
export type ResearchEvalInput = {
  task: string;
  history?: ThreadMessage[]
}

(source)

Functions ​

buildTools ​

ts
buildTools(): any[]

Return the researcher's source lookup and communication tools.

Returns: any[]

(source)

researcherAgent ​

ts
@guarded(cost: maxCost, time: maxTime, keepDraft: keepDraft)
researcherAgent(
  task: string,
  context: string = "",
  maxCost: number = $50.00,
  maxTime: number = 30m,
  model: string = "",
  provider: string = "",
  extraTools: any[] = [],
  history: ThreadMessage[] = [],
  keepDraft: boolean = true,
  offerSaveDraft: boolean = true,
): Result<string>

Answer a research question from web and Wikipedia sources and return a cited answer.

Parameters:

NameTypeDefaultDescription
taskstringThe research question
contextstring""Extra material folded into the prompt, or ""
maxCostnumber$50.00Cost budget in USD.
maxTimenumber30mTime budget in milliseconds.
modelstring""Model override, or "" for the ambient model
providerstring""Provider for the model override, ignored when model is empty.
extraToolsany[][]Extra tools to offer the LLM, appended to the built-in set
historyThreadMessage[][]Prior messages, oldest first, used only when the active thread is empty.
keepDraftbooleantrueFalse returns a budget failure even when a draft was saved.
offerSaveDraftbooleantrueFalse keeps saveDraft out of the model's tools, for a caller that never reads the draft.

Returns: Result<string>

Throws: std::guard

(source)