Agentic Query API
Endpoint
Section titled “Endpoint”POST /graphs/{graphId}/agentic-queryRequest body
Section titled “Request body”{ "query": "Who works at technology companies connected to Alice?", "topK": 5, "depth": 2, "direction": "outbound", "nodeType": "Person"}| Field | Type | Required | Default | Description |
|---|---|---|---|---|
query | string | yes | — | Natural language or semantic text |
topK | number | no | 5 | Number of vector similarity results |
depth | number | no | 2 | Traversal depth from each hit |
direction | string | no | outbound | Edge direction for traversal |
nodeType | string | no | all | Restrict vector search to a node type |
Response
Section titled “Response”{ "query": "Who works at technology companies connected to Alice?", "vectorHits": [ { "nodeId": "node_alice", "score": 0.94 } ], "context": { "nodes": [ ... ], "edges": [ ... ] }, "tokenEstimate": 420}tokenEstimate is a rough count of the serialised context size in tokens — useful for LLM prompt budget planning.
Using the context in a prompt
Section titled “Using the context in a prompt”const result = await client.agenticQuery(graphId, { query });
const systemPrompt = [ "You are a helpful assistant.", "Use the following graph context to answer the user's question.", "Graph nodes: " + JSON.stringify(result.context.nodes), "Graph edges: " + JSON.stringify(result.context.edges),].join("\n");