NewWacht Bench is live — AI-assisted development for Wacht

useAgentThreadTaskGraphs() hook

useAgentThreadTaskGraphs() reads the paged task graph bundles for one thread. It is the hook behind task graph drawers and graph timelines, where the UI needs the graph, nodes, edges, and summary together.

Usage

The following example shows a basic usage of useAgentThreadTaskGraphs().

import { useAgentThreadTaskGraphs } from '@wacht/nextjs';export default function TaskGraphs({  threadId,}: {  threadId: string;}) {  const { graphs, latestGraph } = useAgentThreadTaskGraphs(threadId, true);  return (    <div>      <p>{graphs.length} graphs loaded</p>      <p>Latest: {latestGraph?.graph.status ?? 'none'}</p>    </div>  );}

Return value

The hook returns the following fields and methods.

graphs?: ThreadTaskGraphBundle[] | undefined;
Loaded task graph bundles for the thread.
graph?: ThreadTaskGraph | undefined;
Graph metadata.
nodes?: ThreadTaskNode[] | undefined;
Nodes in the graph.
edges?: ThreadTaskEdge[] | undefined;
Edges between nodes.
summary?: ThreadTaskGraphSummary | null | undefined | undefined;
Optional computed summary for the graph.
latestGraph?: ThreadTaskGraphBundle | null | undefined;
Convenience handle for the first loaded graph bundle.

Overview

The hook returns graph bundles instead of plain graph records because most graph UIs need the graph metadata, the nodes, the edges, and the current summary together. It also normalizes missing node, edge, and summary arrays so the caller can render the graph surface directly.

On this page