Skip to content
TuffTasks, docs and chat for teams and AI agents

Observability

Research Trail

Live trail of a deep-research run: each search query with the pages it opened as they're read, used or skipped, folding into one chip when done.

1 variantMIT

Preview

Deep research

Is a cold-climate heat pump worth it for a 1970s house in Minnesota?

Researching
Queries
0
Pages
0
Cited
0

    Installation

    Copies the component into components/ui and installs its dependencies and theme tokens.

    pnpm dlx shadcn@latest add https://tuffui.com/r/research-trail.json

    Usage

    Pass your own data and wire the callbacks to your agent runtime.

    import { ResearchTrail } from "@/components/ui/research-trail";
    
    // Rendered above the answer while a deep-research run streams in.
    export function ResearchProgress({ run }: Props) {
      return (
        <ResearchTrail
          subtitle={run.question}
          status={run.finished ? "done" : "running"}
          queries={run.searches.map((search) => ({
            id: search.id,
            query: search.query, // "Minnesota heat pump rebate 2026"
            status: search.results ? "done" : "searching",
            pages: search.visits.map((visit) => ({
              id: visit.id,
              domain: new URL(visit.url).hostname, // "mn.gov"
              title: visit.title,
              url: visit.url,
              status: visit.state, // "reading" | "used" | "skipped"
              facts: visit.extracted?.length, // 3 → "+3 facts"
              reason: visit.skipReason, // "Paywalled"
            })),
          }))}
        />
      );
    }

    Props

    PropTypeDefaultDescription
    queries*ResearchQuery[]—Search queries in the order they ran, each with the pages it opened. Append to it as the run streams.
    status"running" | "done""running"Running keeps the newest query open. Done shows a collapse button and, with `autoCollapse`, folds the trail into its chip.
    collapsedboolean—Controlled: the trail folded into a single "Researched N pages · cited N" chip.
    defaultCollapsedbooleanfalseStarting state when uncontrolled.
    onCollapsedChange(collapsed: boolean) => void—Called when the chip is opened, the trail is collapsed, or it folds on finishing.
    autoCollapsebooleantrueFolds the trail into its chip when `status` turns "done".
    onPageClick(page: ResearchPage) => void—Called when a page title is clicked. Without it, pages with a `url` open in a new tab.
    iconIconBinocularsPhosphor icon in the header tile.
    titleReactNode"Deep research"Header title.
    subtitleReactNode—Secondary line under the title, usually the research question.
    classNamestring—Extra classes for the root element.
    type ResearchQuery = {
      id: string;
      query: string;                    // "Minnesota heat pump rebate 2026"
      status: "searching" | "done";     // searching shimmers the query
      pages: ResearchPage[];
    };
    
    type ResearchPage = {
      id: string;
      domain: string;                   // "mn.gov", its first letter is the monogram
      title: string;
      url?: string;
      status: "reading" | "used" | "skipped";
      facts?: number;                   // used: "+3 facts"
      reason?: string;                  // skipped: shown on hover or focus
    };