Skip to main content
Three tools for querying the knowledge graph built by POST .../knowledge-graph/builds. All return coverage reporting files withheld by the access predicate. All return 409 kg_not_built when no graph exists for the workspace.

KG info

Snapshot metadata for the workspace knowledge graph. Call this first to confirm the graph exists and to discover hub node IDs for kg-walk. Cost class: cacheable. Query parameters:
  • path_prefix (optional) — Scope node/edge counts to files under this prefix.
  • include_graph (optional, default false) — Also return a drawable sample subgraph.
  • graph_nodes (optional, default 150, max 500) — Node budget for the sample. Ignored when include_graph=false.
Response:
Response fields:
  • snapshot_id — Changes when the graph is rebuilt; use to detect staleness.
  • node_types / edge_types — Counts by type.
  • hubs — Highest-degree nodes in the caller-visible slice (good kg-walk starting points).
  • graph — Drawable subgraph sample when include_graph=true; null otherwise.

Find graph nodes by semantic similarity to a query. Returns nodes with their facts and source-file provenance. Cost class: medium. Request body:
Body fields:
  • query (required, max 4096 chars) — Natural-language or keyword search.
  • k (optional, default 10, max 100) — Number of results.
  • node_types (optional) — Restrict to a subset of node types from kg-info.
  • path_prefix (optional) — Restrict to nodes sourced from files under this prefix.
Response:
Each fact’s evidence.component names the public component of the source file the fact was extracted from — a spreadsheet tab name or a split document’s section — exactly what qa-file / read-file accept as component=, so a fact hands off directly to a targeted read. For document sections the locator’s page is a real source page and is kept alongside component; for spreadsheet facts the locator carries no page (tabs have no pages — address the tab by component), and the tab name is best-effort — a fact from a small tab processed together with its neighbors can name an adjacent tab of the same file. component is null for single-component files or when attribution is unavailable.

KG walk

Traverse the graph from a set of seed nodes, following relationships up to a hop limit. Returns nodes, edges, and the paths that explain why each node was reached. Cost class: medium. Request body:
Body fields:
  • start_node_ids (required, 1–50) — Node IDs from kg-info hubs or kg-search results.
  • hops (optional, default 2, max 5) — Breadth-first hop budget.
  • edge_types (optional) — Restrict traversal to these edge types.
  • node_types (optional) — Include only these node types in the result.
  • max_nodes (optional, default 100, max 500) — Maximum nodes to return.
  • path_prefix (optional) — Restrict to nodes sourced from files under this prefix. A walk cannot traverse out of scope and back in.
Response:
Response fields:
  • nodes — All reached nodes with facts and provenance.
  • edges — Edges traversed, with optional evidence. Edge evidence carries the same component handoff as kg-search facts: pass it to qa-file / read-file as component= (spreadsheet-tab evidence has component and no page; document evidence keeps its real page).
  • paths — The hop sequences justifying each node’s inclusion.
  • truncatedtrue when max_nodes was hit before the walk was complete.

Typical workflow