Skip to main content
Cost: 10 operations per call. Available on Starter plan and above.

POST /brain/retrieve/graph-qa

Graph QA is the highest-intelligence retrieval mode. Instead of simple vector similarity, it:
  1. Finds seed entities — uses vector search to locate the starting nodes most relevant to your question
  2. Traverses the graph — BFS expansion up to max_hops hops from each seed
  3. Grounds the answer — passes only the traversed facts to the LLM, forcing a fact-grounded response with zero hallucination
This is ideal for questions that require connecting multiple pieces of information stored across different ingestion sessions.

Request body


Response


Code examples


Graph QA vs. regular retrieve

Use retrieve when you want to control the LLM call yourself. Use graph-qa when you want Atlas to answer the question directly.

Example — building a Q&A agent


Guardrails

Graph QA has built-in prompt injection protection:
  • Facts are numbered and sandboxed — the LLM is instructed to cite by number, not quote
  • Instructions embedded in stored facts (e.g. “ignore previous instructions”) are stripped before being passed to the LLM
  • Results are scoped to your user_id — the traversal query includes user_id filters at every hop, so cross-tenant leakage is impossible at the database level
Graph 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.