Skip to content
Start free

Verify a Model Answer Against Live Sources

Take a claim your model produced, check it against live sources with /research, and return a verdict plus the pages behind it. Shows how to read claim-level citations off the complete event.

A model states something with total confidence and no way for you to check it. This example takes that claim, researches it against live sources, and returns the answer alongside the pages that support it, so a person or a downstream step can judge it.

This example uses balanced mode, which requires a paid plan.

The pattern is deliberately narrow. Tabstack does not label a claim true or false. It gives you a current, sourced answer to compare against, and the claims each source was cited for.

import Tabstack from "@tabstack/sdk";
const client = new Tabstack();
type Evidence = {
claim: string;
finding: string;
sources: { url: string; title: string | null; supports: string[] }[];
};
async function gatherEvidence(claim: string): Promise<Evidence> {
const stream = await client.agent.research({
// Ask for the current state of the world, not for a true/false verdict.
query: `What do current sources say about this claim? Claim: "${claim}"`,
// balanced populates each source's claims; fast returns them empty.
mode: "balanced",
// A claim worth checking is usually a claim about something that changed.
nocache: true,
});
for await (const event of stream) {
if (event.event === "error") {
throw new Error(event.data.error?.message ?? "Research failed");
}
if (event.event === "complete") {
const cited = event.data.metadata.citedPages ?? [];
return {
claim,
finding: event.data.report,
sources: cited.map((page) => ({
url: page.url,
title: page.title ?? null,
// The specific claims this source was cited for.
supports: page.claims ?? [],
})),
};
}
}
throw new Error("Stream ended before the complete event");
}
const evidence = await gatherEvidence(
"Node.js 24 is the current long-term support release.",
);
console.log("Claim: ", evidence.claim);
console.log("Finding: ", evidence.finding);
if (evidence.sources.length === 0) {
// No citations is a result too: treat it as unverified, not as confirmation.
console.log("Verdict: unverified, no sources cited");
} else {
console.log(`Verdict: ${evidence.sources.length} source(s) cited`);
for (const source of evidence.sources) {
console.log(`- ${source.title ?? "(untitled)"}: ${source.url}`);
for (const supported of source.supports) {
console.log(` supports: ${supported}`);
}
}
}
  • Ask what sources say, not whether the claim is true. Phrasing the query as a verdict request invites a confident yes or no. Phrasing it as “what do current sources say” returns something you can compare against, with pages attached.
  • claims is the useful field, and it needs balanced mode. In balanced mode each entry in citedPages (cited_pages in Python) carries the claims that source was cited for, so you can show a reviewer the specific sentence a URL backs rather than a bare link list. In fast mode claims is an empty array. balanced requires a paid plan.
  • Treat an empty citation list as unverified. citedPages is optional and can be absent. That is not evidence the claim is right; it means you have no sources and should say so. Read the optional fields defensively, as Autonomous Research describes.
  • nocache: true is the right default here. Anything worth fact-checking is usually something that changed recently, and the content cache is keyed by URL, effort, and region rather than by account.
  • Before shipping model output to users, on the small set of claims that matter: prices, versions, dates, availability.
  • In an evaluation harness, to sample answers and flag the ones with no supporting sources.
  • In review workflows, where the output is a claim plus its sources for a human to sign off.

For a fuller research walkthrough, see the Technical Landscape Researcher. For the endpoint reference, see Autonomous Research.

Terminal window
npm install @tabstack/sdk

Set your API key before running:

Terminal window
export TABSTACK_API_KEY=your_api_key