Overview
Acting like an air-traffic controller for retrieval — deciding where to enter the graph and how far to fly before generation starts.
Why it matters
A knowledge graph with no query planning is dangerous precisely because it's too powerful: an unconstrained traversal can follow edges outward indefinitely, pulling in thousands of increasingly irrelevant nodes the further it travels from the original question — latency explodes and the LLM's prompt fills with noise instead of evidence.
Query planning is the orchestration layer that prevents this, and it has to answer two questions before any traversal starts:
- Where do we enter the graph? — Vector search (from the hybrid-retrieval lesson) picks the seed entity node(s) that best match the query's intent. Get this wrong and every subsequent hop walks from the wrong starting point.
- How far are we allowed to travel? — A fixed hop budget (e.g. 'never traverse more than 2 edges from any seed node') bounds both latency and noise. Without this cap, a densely connected graph can pull in an entire neighbourhood of tangentially related entities for a question that only needed one hop.
Locking the seed entities and the hop budget first — before deciding anything about prompt formatting or how many examples to show the LLM — is what keeps the evidence paths clean and minimal. Everything downstream (which facts get cited, how long the prompt is) is a direct consequence of getting these two variables right.
