GraphRAG recommendations
Recommendations that walk a knowledge graph from a seed node — for RAG and agentic flows, not commerce.
GET /knowledge/graphrag/recommendations returns nodes related to a seed node in a KnowledgeSpace, ranked by graph distance + LLM relevance.
Unlike commerce engines (similar, trending), GraphRAG operates on a knowledge graph of entities and relations — built from your ingested documents — not on a product catalogue.
Request
GET /knowledge/graphrag/recommendations?knowledgeSpaceId=<id>&nodeId=<id>&depth=2&limit=10
Authorization: Bearer <api-key>| Param | Type | Required | Notes |
|---|---|---|---|
knowledgeSpaceId | string | yes | The KnowledgeSpace to traverse. |
nodeId | string | yes | Seed node to start from. |
depth | number | no | 1–3, default 2. Higher depth = more breadth + cost. |
relationTypes | string | no | Comma-separated; e.g. WORKS_AT,FOUNDED_BY. |
limit | number | no | 1–50, default 10. |
Response
{
"items": [
{
"id": "node_42",
"canonicalName": "Anthropic",
"nodeType": "Organization",
"score": 0.84,
"distance": 1,
"viaRelations": ["FOUNDED_BY", "DEVELOPS"]
}
],
"anchorId": "node_1",
"engine": "graphrag"
}distance is the shortest path in edges. score blends inverse-distance with an LLM-derived relevance score.
Multi-seed variant
For agentic flows that have several anchor nodes (e.g. the user just chatted about three companies), use the multi-seed variant:
GET /knowledge/graphrag/recommendations/multi-seed?nodeIds=node_1,node_2,node_3&...Returns nodes most central to all seeds (intersection), not the union — useful for "find the topic that connects these three things."
When to use
- Knowledge-base assistant — "Related concepts" sidebar in a documentation chatbot.
- Research tools — Suggest entities to explore next from the current entity.
- Agentic RAG — Multi-hop reasoning that needs to expand the working set.
When NOT to use
- Ecommerce. Use
similaroralso-viewed— your catalogue probably isn't a knowledge graph. - Real-time UIs with tight latency budgets — GraphRAG includes an LLM step. Budget 150 ms p95 on Pro.
Tenant isolation
Returns 404 (not 403) if the KnowledgeSpace belongs to another tenant — see the tenant isolation invariant. The procedure verifies KnowledgeSpace ownership before any data flows back.
Latency
p95 ~150 ms on Pro. The LLM step is cached aggressively (per node + relation set) so repeat calls within an hour are ~50 ms.
Code path
packages/api/modules/recommendations/procedures/graphrag.ts (single-seed) + graphragMultiSeed (multi-seed). Backed by the GraphCommunity and GraphNode Prisma models.