Answer complex relational questions using multi-hop traversal over your Neo4j knowledge graph.
/brain/retrieve/graph-qaGraph QA is the highest-intelligence retrieval mode. Instead of simple vector similarity, it:
max_hops hops from each seedThis is ideal for questions that require connecting multiple pieces of information stored across different ingestion sessions.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
query | string | ✓ | — | Natural language question to answer from the knowledge graph. |
max_hops | int | 3 | Graph traversal depth (1–5). Higher = more connected context. | |
k | int | 10 | Max facts to retrieve (1–50). | |
persona | string | null | Restrict graph traversal to a persona. |
| Field | Type | Description |
|---|---|---|
answer | string | LLM-generated answer grounded in retrieved graph facts. Cites fact numbers. |
facts_used | int | Number of graph facts passed to the LLM as context. |
| Feature | retrieve | graph-qa |
|---|---|---|
| Memory sources | Episodic + Semantic + Working | Semantic graph only |
| Answer type | Ranked facts list | Natural language answer |
| Multi-hop | Optional | Always |
| LLM call | Optional (compression) | Always |
| Best for | Injecting context into your own LLM call | Direct factual Q&A from the graph |
| Cost | 2 ops | 10 ops |
Use retrieve when you want to control the LLM call yourself. Use graph-qa when you want Atlas to answer the question directly.
Graph QA has built-in prompt injection protection:
user_id — the traversal query includes user_id filters at every hop, so cross-tenant leakage is impossible at the database levelGraph QA requires OPENAI_API_KEY to be set on the server. If it is unavailable, the endpoint returns {"answer": "", "error": "LLM not available"}.
In this case, use the retrieve endpoint instead and pass the facts to your own LLM.